Repository navigation
fix(models): reject oversized piped auth input - #109800
Conversation
1c9bc7d to
12be34c
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 1:00 AM ET / 05:00 UTC. Summary PR surface: Source +7, Tests +15. Total +22 across 2 files. Reproducibility: yes. from source and supplied real CLI proof: the pre-change reader accumulates all piped chunks before validation, while the proposed path rejects at 1 MiB plus one byte before auth mutation. The review did not independently execute the reproduction. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review detailsBest possible solution: Land the byte-limit hardening if the current merge result preserves normal piped-token behavior and maintainers accept the 1 MiB operator compatibility boundary. Do we have a high-confidence way to reproduce the issue? Yes, from source and supplied real CLI proof: the pre-change reader accumulates all piped chunks before validation, while the proposed path rejects at 1 MiB plus one byte before auth mutation. The review did not independently execute the reproduction. Is this the best way to solve the issue? Yes, provisionally: enforcing a byte cap while consuming the stream addresses the memory-growth root cause more directly than downstream validation, and the related Matrix implementation supports this bounded-reader pattern. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 85e4bb438dfe. Label changesLabel justifications:
Evidence reviewedPR surface: Source +7, Tests +15. Total +22 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
974daa5 to
626fbf6
Compare
626fbf6 to
636f487
Compare
readPipedStdin accumulated piped stdin without a size limit, letting `models auth paste-token` and `paste-api-key` buffer arbitrarily large input before any validation. Add a 1 MiB cap matching the existing Matrix recovery-key and config-patch stdin limits, and reject oversized input at the stream boundary. Co-Authored-By: nebulacoder-v8.0 <[email protected]>
636f487 to
86988e6
Compare
|
Maintainer proof for head
No remaining proof gaps. Ready for the guarded prepare/merge flow. |
|
Merged via squash.
|
readPipedStdin accumulated piped stdin without a size limit, letting `models auth paste-token` and `paste-api-key` buffer arbitrarily large input before any validation. Add a 1 MiB cap matching the existing Matrix recovery-key and config-patch stdin limits, and reject oversized input at the stream boundary.
readPipedStdin accumulated piped stdin without a size limit, letting `models auth paste-token` and `paste-api-key` buffer arbitrarily large input before any validation. Add a 1 MiB cap matching the existing Matrix recovery-key and config-patch stdin limits, and reject oversized input at the stream boundary.
What Problem This Solves
Fixes an issue where
openclaw models auth paste-tokenandpaste-api-keyaccumulated piped stdin without any size limit, allowing arbitrarily large input to buffer in memory before reaching downstream validation.Why This Change Was Made
The
readPipedStdin()helper now enforces a 1 MiB cap (matching the existingMATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTESandCONFIG_PATCH_STDIN_MAX_BYTESlimits). The rejection happens at the stream boundary — during the read loop, not after buffering — so oversized input never reaches auth processing.The change follows the same buffer-chunk pattern used in the Matrix recovery-key stdin fix (PR #108120): collect
Bufferchunks, tracktotalBytesper chunk, and throw before the cap is exceeded. Normal TTY and small piped input paths are unchanged.Collision check: searched open PRs for
readPipedStdin,models auth stdin,paste-token unbounded— no same-file or same-problem open PR found.User Impact
Piped auth commands now fail with an explicit size error for oversized input instead of buffering unbounded data. Normal interactive entry and direct arguments are unaffected.
Evidence
Exact head:
12be34c454b75916fcf481916dec7998105820dfFormat / diff check
Real CLI proof (local, Node 24.18.0,
pnpm dev)Normal small piped API key reaches auth validation:
Oversized piped input (1 MiB + 1 byte) rejected at the stdin boundary:
Standalone proof (loopback stream, calls real production function)
Tests
New test "rejects oversized piped auth input before buffering it" verifies the exact error message and confirms no downstream auth mutation.
Mutation check
Reverted the fix to bare
input += String(chunk)loop with no cap:Oversized input passes through to validate() which reports "That does not look like an OpenAI API key." instead of the size rejection. Restored fix → 40/40 pass.
Not tested
pnpm buildwith dist-based CLI (Node 22.22.0 does not meet the >=22.22.3 requirement)paste-tokenoversized path (shares the samereadPipedStdinhelper as the testedpaste-api-keypath)🤖 Generated with co-mind