Repository navigation
fix(secrets): escape terminal controls in readable env values - #184141
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesSanitize readable environment values in human secret-store output while preserving JSON and plain output. Example: SERVICE_MODE contains café, an ANSI color sequence, newline, tab, carriage return, and bell.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current CLI rendering defect with a focused change; no actionable correctness or security findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe secrets CLI reads metadata and environment values from the SQLite store and renders human or machine-readable output; secret-kind values remain write-only. flowchart TD
A[Secrets store CLI] --> B[SQLite store reader]
B --> C[Metadata and env values]
C --> D[Human output sanitizer]
D --> E[Terminal text]
C --> F[JSON or plain output]
Technical reviewBest possible solution: Land the existing sanitizer calls at both human-output boundaries while retaining raw-output and write-only-secret contracts. Do we have a high-confidence way to reproduce the issue? Current-main source exposes both raw interpolations, and retained exact-head proof records matching baseline failures; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete fix: reuse the existing display sanitizer in both human renderers without changing storage, validation, or machine-readable output. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 872cb2afe987. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +29, Docs +2. Total +35 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 26, 2026, 2:50 AM ET / 06:50 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
|
Thanks @steipete for merging this! Appreciate your time. |
…aw#184141) Escape terminal controls in human-readable env list/get output while preserving exact JSON/plain values and write-only secret semantics. Validation: regression fails on base and all 17 owner tests pass on the reviewed head; targeted lint/format and exact-head CI pass. Co-authored-by: Alix-007 <[email protected]>
Escape terminal controls in human-readable env list/get output while preserving exact JSON/plain values and write-only secret semantics. Validation: regression fails on base and all 17 owner tests pass on the reviewed head; targeted lint/format and exact-head CI pass. Co-authored-by: Alix-007 <[email protected]> (cherry picked from commit 6b72c79) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 964cae5c1ecb30d5b074a71eadd0c025a32aa68a)
Escape terminal controls in human-readable env list/get output while preserving exact JSON/plain values and write-only secret semantics. Validation: regression fails on base and all 17 owner tests pass on the reviewed head; targeted lint/format and exact-head CI pass. Co-authored-by: Alix-007 <[email protected]> (cherry picked from commit 6b72c79) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 08265b251159d270c8ff8a41de33092fc453ed09)
What Problem This Solves
Fixes terminal control sequences and forged output rows when
secrets store listorsecrets store getdisplays a readable environment value.User Impact
Human output safely displays environment values. JSON and plain output preserve the original bytes, and secret-kind entries remain write-only.
Why This Change Was Made
Apply the existing
sanitizeTerminalTextpolicy at the two human-output boundaries. Storage, validation, and machine-readable output stay with their existing owners. Thanks to @Alix-007 for the fix and regression coverage.Evidence
origin/main.node scripts/run-vitest.mjs src/cli/secrets-store-cli.test.ts --maxWorkers=1; red command wall time 129.44s, green 204.68s, dominated by cold compiled-worker preparation.git diff --checkpass.1137567ba3b82e0a3b5c429996ad87808df582d0used normal builds and real SQLite state: both human paths changed from three control bytes plus a forged row to safe output; JSON/plain readback retained exact values and secret reads exited 2 without disclosure.pnpm openclawrefused runtime artifact publication because it could not verify the affected Gateway was offline. No running Gateway or operator state was changed.1137567ba3b82e0a3b5c429996ad87808df582d0, run 40262838779; non-green rollup entries are superseded.