Skip to content

fix(cli): centralize bounded stdin reads - #12

Merged
GuoMonth merged 1 commit into
mainfrom
fix/cli-stdin-limits
Apr 17, 2026
Merged

GuoMonth merged 1 commit into
mainfrom
fix/cli-stdin-limits

Conversation

@GuoMonth

Copy link
Copy Markdown
Owner

Summary

  • add shared CLI stdin helpers for bounded reads and optional JSON-object parsing
  • migrate gm add, gm mv, and gm batch to the shared 10 MiB limit path
  • add focused CLI tests for valid reads, invalid JSON, and oversized stdin rejection

Validation

  • go test ./internal/cli
  • make check
  • make validate

Closes #8

Replace the ad-hoc stdin handling in add, mv, and batch with shared helpers that enforce the existing 10 MiB limit and unify invalid-input errors. This closes the unbounded gm add path and removes duplicated limit logic.

Add focused CLI tests covering bounded reads, invalid JSON, and oversized stdin rejection.

Closes #8

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GuoMonth
GuoMonth merged commit 389fe52 into main Apr 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli(add): stdin read is unbounded (missing io.LimitReader)

1 participant