fix(cli): guard secrets plan JSON.parse against malformed input#109721
Conversation
readPlanFile reads a user-specified file and parses it with JSON.parse without a try-catch. A malformed or corrupted plan file produces a raw SyntaxError that is not user-actionable. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
209a618 to
9cbd8ff
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 4:56 AM ET / 08:56 UTC. Summary PR surface: Source +5, Tests +14. Total +19 across 2 files. Reproducibility: yes. at source level: passing malformed JSON through Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the path-specific parse guard and regression test, with the final CLI behavior demonstrated by a redacted real terminal run before merge. Do we have a high-confidence way to reproduce the issue? Yes at source level: passing malformed JSON through Is this the best way to solve the issue? Yes. Wrapping the existing parse boundary, preserving the cause, and leaving plan-schema validation unchanged is the narrowest maintainable fix; the updated test exercises the public CLI entry point. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 07a36f6eda75. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +14. Total +19 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 (2 earlier review cycles) |
Co-authored-by: 丁宇婷0668001435 <[email protected]>
|
Merged via squash.
|
…claw#109721) * fix(cli): guard secrets plan JSON.parse against malformed input readPlanFile reads a user-specified file and parses it with JSON.parse without a try-catch. A malformed or corrupted plan file produces a raw SyntaxError that is not user-actionable. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * test: tighten malformed secrets plan proof Co-authored-by: 丁宇婷0668001435 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
readPlanFile()insrc/cli/secrets-cli.tsreads a user-specified plan file and callsJSON.parse()on it without a try-catch. If the file is malformed (corrupted on disk, truncated, or hand-edited), the rawSyntaxErroris not user-actionable.This follows the established pattern from #98660 (solodmd) and #98587 (lsr911) for guarding JSON.parse against malformed input.
Evidence
Test
src/cli/secrets-cli.test.ts— 16 tests pass, including 1 new test:CI
Merge Risk
Low. +6 lines in a private helper function, throws a descriptive Error with the malformed JSON cause preserved via
{ cause: err }.