Skip to content

parseStaleDuration silently overflows on large day values #210

Description

@d0ugal

Summary

In internal/cli/batch.go, parseStaleDuration uses strconv.Atoi with the error ignored:

n, _ := strconv.Atoi(numStr)
return fmt.Sprintf("%dh", n*24)

Input like --stale 99999999999999999999d would silently produce n=0 (Atoi returns 0 on overflow), matching sessions stale for 0 hours — i.e., everything.

Impact

Low probability but high impact: could accidentally match and delete all sessions if a user copies a very large number.

Suggested Fix

Check the strconv.Atoi error and return an error message if it overflows.

Found during review tribunal audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions