Repository navigation
/cso keeps going when a .env-style file cannot be read, and reports it as unread - #4688
Merged
Merged
Conversation
A tracked file that /cso already keeps out of the audited snapshot, such as .env.example, aborted start when a sandbox deny rule or a mode-000 file made it unreadable. Such a file is now recorded as an unread input and reported as a snapshot-inputs coverage gap. Every other unreadable file still fails the capture. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…de beforeAll Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…at a denied secret that turns readable is a race Review-Finding: p1/specialist-batched#1 reader=testing Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…d of stopping Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Merged
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/cso's
startno longer aborts when a tracked secret-like file (.env.exampleand the like) cannot be read because of a sandbox deny rule or file permissions; the file is listed as unread and the run's source coverage reads partial.Why: with Claude Code's sandbox and a
Read(**/.env*)deny rule, /cso could not run at all on any repo tracking such a file.Nothing to do after merge.
Repro and fix
Repro on main (c2b4f0d), as a normal user: a repo tracking
.env.examplewith mode 000 gives{"ok":false,"error":{"code":"UNSAFE_PATH","message":"Source could not be opened as a regular file: .env.example"}}. When the sandbox also denieslstat(the reported case), the rawEPERMescapes andstartprints the genericINVALID_SCHEMA. Both are tests intest/cso-unreadable-secret-file.test.tsthat fail on main.Fix, all in
lib/cso/snapshot.ts:EACCES/EPERM) onlstatoropenof a path thatexclusion()already keeps out ofsnapshot/records an entry withoriginalHash: not-readandwithheld: … unreadable (EACCES); its payload was not assessed. It has noexcluded:prefix on purpose, so coverage counts it as an in-scope gap rather than a clean exclusion.lstatwas denied to stay denied.UNSAFE_PATHand the same message as before.Five tests in
test/cso-unreadable-secret-file.test.tscover this: the two repros above, an ordinary unreadable file that still refuses, an ordinary file whoselstatis denied that still refuses, and a denied secret file that becomes readable during capture, which raisesSNAPSHOT_RACE.After the fix,
starton the repro repo runs and reportssnapshot-inputs: partialwith that line.Not changed: an old run whose
readable/folder already holds a copy of such a file can still fail retention cleanup under the same deny rule, and the genericINVALID_SCHEMAmessage does not yet name the errno.Security read
This touches /cso's capture boundary, so the read was about what can now get past it. The only new path is: a file whose name /cso already treats as a credential (the
exclusion()list) and which the OS refuses to let us read. Such a file is never opened, copied, redacted or handed to a scanner; it is reported as an unread gap, so the report cannot claim it was checked. A non-excluded unreadable file, a FIFO, a symlink or a hard link keeps today's refusal. No CI, install, dependency, network, auth or process-spawning change.Review notes (4, all below the blocking floor)
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
lib/cso/snapshot.ts:901With --paths plus --base, an out-of-scope secret-like file that can be lstat'd but not opened still aborts start: gitBlobStable -> readStableWith throws UnreadableSource uncaught. Not a regression (same abort as main).lib/cso/snapshot.ts:837An lstat-denied secret-like file outside --paths is labelled 'withheld: unreadable' instead of OUTSIDE_AUDIT_PATHS, so coverage counts it as an in-scope unread gap.lib/cso/snapshot.ts:305exclusion() also matches omittedPath() (agent config under .claude/, .agents/, .codex/, .cursor/, .github/agents/), so unreadable files there are withheld too; still reported as a coverage gap. The changelog's 'any other unreadable file still stops the run' overstates strictness.lib/cso/snapshot.ts:1088Withheld entries set no gitHashes/gitModes, so under --base they always count as changed; safe default, adds noise to diff-scoped reports.Documentation
Status: current. Audited the release docs for this branch and found none stale, so nothing was edited.
Scope: base c2b4f0d2 to head 7356635 (4 commits):
lib/cso/snapshot.ts,test/cso-unreadable-secret-file.test.ts,changelog.d/fix-cso-unreadable-secret-files.md. Nothing was staged, unstaged or untracked. I checked the /cso docs:cso/SKILL.md.tmpl,docs/cso-scanners.md, and the /cso entries indocs/troubleshooting.md.Documentation health:
cso/SKILL.md.tmpl: Current (its partial-coverage reporting rules already cover an unread input)docs/cso-scanners.md: Current (unaffected)docs/troubleshooting.md: Current (nothing documented the old abort)changelog.d/fix-cso-unreadable-secret-files.md: Current (describes the fix accurately; not edited)Coverage debt: when /cso hits an unreadable secret-like file, it now records the file as withheld and reports source coverage as partial. That behavior is documented only in the changelog fragment, with no troubleshooting entry next to
#cso-capacity(reference-only gap). Diagram drift: none; no diagrams reference the snapshot capture path.Issues
Fixes #4395
Agent notes
Outside-report lane GSTA-802 (GST-3484), #4395 from @kado-ta (no outside code). /ship (run ship-4688): one review round, 0 blocking, 1 informational finding fixed (commit 591d730), 4 notes above. Head 99d9b61 is a base-only merge of main into reviewed head 7356635 (the PR's own lines are unchanged); CI green at 99d9b61 (run 44996781596). Focused: cso lane pass, tests_ran=107.