secrets.sh prints the credential it found #11

Closed
opened 2026-08-17 22:59:54 -05:00 by null · 0 comments
Owner

secrets.sh reports a hit by printing the matching line truncated to 120 characters. That bounds how much of a long value reaches the terminal and does not redact anything: a credential shorter than the budget is printed whole, into the scrollback, the CI log, and wherever that log is shipped.

The comment above the report used to claim "the match is never echoed in full". It does not, and the comment was corrected in the same commit as --built rather than left overclaiming.

Reproduced: a fake JWT planted in a scratch build directory is echoed complete in the finding line.

This affects every mode, not only --built -- --tracked and the pre-commit --staged path print the same way, which means a real leak caught by the hook is also a real leak printed to a terminal.

The fix is to mask the matched span rather than truncate the line: capture the match with grep -o, replace it with a fixed marker in the reported line, and keep enough surrounding text that a person can find it. Keep the file and line prefix — the point is that somebody can go and look, not that they can read the value here.

Verify: a known credential planted in a scratch tree is reported with its file and line, and the value itself does not appear anywhere in the output of any mode.

`secrets.sh` reports a hit by printing the matching line truncated to 120 characters. That bounds how much of a long value reaches the terminal and does not redact anything: a credential shorter than the budget is printed whole, into the scrollback, the CI log, and wherever that log is shipped. The comment above the report used to claim "the match is never echoed in full". It does not, and the comment was corrected in the same commit as `--built` rather than left overclaiming. Reproduced: a fake JWT planted in a scratch build directory is echoed complete in the finding line. This affects every mode, not only `--built` -- `--tracked` and the pre-commit `--staged` path print the same way, which means a real leak caught by the hook is also a real leak printed to a terminal. The fix is to mask the matched span rather than truncate the line: capture the match with `grep -o`, replace it with a fixed marker in the reported line, and keep enough surrounding text that a person can find it. Keep the file and line prefix — the point is that somebody can go and look, not that they can read the value here. Verify: a known credential planted in a scratch tree is reported with its file and line, and the value itself does not appear anywhere in the output of any mode.
null added this to the Batch 01 — Production-readiness controls milestone 2026-08-17 22:59:54 -05:00
null added the
P2
label 2026-08-17 22:59:54 -05:00
null closed this issue 2026-08-17 23:08:59 -05:00
Sign in to join this conversation.
No Label
P0
P1
P2
release-blocker
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: null/Project-Template#11
No description provided.