You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9217c38
Browse filesBrowse the repository at this point in the historyBrowse files
fix(secrets): scope the line pre-check veto to benign manifest lines (#812)
* fix(secrets): scope the line pre-check veto to benign manifest lines
containsSecretIndicators, the pre-check in front of the SECRETS keyword
pass, ran three whole-line substring checks before its provider-literal
admits: a version or boolean after the line's first colon, an
"integrity"/"checksum" key beside the bytes sha or md5, and a
"url"/"resolved"/"homepage" key beside a scheme and a registry or forge
host. A hit dropped the whole line, so one "url" member hid an AKIA key
ID, a ghp_/glpat-/xoxb- token, a JWT or a keyword-assigned password
anywhere else on it: no finding, no redacted copy, --pre-commit-mode
exit 0, and the --stdin redaction gateway passed the token through.
The provider-literal admits (JWT, every provider prefix, PEM markers) now
run first, and the three checks are replaced by one veto,
benignManifestLine, that rejects a line only when (a) it is exactly one
JSON member whose value is a version under 20 bytes, a boolean, an SRI
digest or a URL with no user info, query or '=', (b) no keyword stem
from the lists the keyword patterns are compiled from appears anywhere
on it, and (c) one of the old checks fires as well, so the veto is a
subset of what was skipped before. Checking only the key, as the issue's
prototype does, is unsound: in "https://api.session:8443/..." the
unquoted pattern reads `session:` as an assignment. findKeywordSecrets
is split into the gate and keywordCandidates so that the gate's contract
(a rejected line has no candidate) is tested.
Measured against v2.5.5 on identical inputs: the issue's nine triggers
report what their controls report (30 of 30 draws); matrix 1 goes from
99 to 0 of 143 trigger cells reporting nothing (controls 78/78 on both);
every matrix 2 cell, as low as 0/40 before, is 40/40; the redacted
copies, pre-commit exits and stdin gateway are fixed. No existing
finding changes type, text, line or confidence on the matrices, the
reproduction, 39 public npm lockfiles or 3,691 public files that hit an
old check, and main's suppression rules still suppress all of them. The
veto still skips 99.1% of the lockfile lines the old checks skipped;
SECRETS CPU on those lockfiles is 3-6% above v2.5.5 (with no veto at
all, 2.7x).
Closes#765
* test(goldencorpus): state the #765 trigger case's password length right
The fifth line of secrets_line_veto_triggers carries a 41-byte password,
not the 40-byte one its description named. The value stays 41 bytes: a
40-byte value beside an AKIA key ID is the shape secret scanners read
as an AWS key pair. Description only; no snapshot changes.
Refs #765
* docs(changelog): count all 31 seeded draws in the #765 entry
The reproduction ran on seeds 1-31; the entry quoted the 30 draws of
seeds 2-31. On all 31 every trigger reports what its control reports,
and main lost the 40-character password on 10 of them.
Refs #765
* chore(goldencorpus,changelog): rebase #765 onto main after #811
The rebase onto main (now carrying #811 and #799) auto-merged the #765
bullet into the Security section below the Go 1.27.3 entry; it is a bug
fix, so it moves under Bug Fixes, as its first entry: #813 appends its own
bullet after the #773 entry, and two PRs inserting at one seam would
conflict again at the second merge; distinct anchors merge in either order.
corpus.go: both #811 (overlap_groups_render_once) and #765 (the two
line-veto cases) appended to the case table; keep all three in that
order. The metadata key census is regenerated on top of main: the only
movement is +14 findings at 13 keys, which is the secrets_line_veto_triggers
case; no other bucket and no existing snapshot changed, and the two new
snapshots are byte-identical to the ones committed before the rebase.
---------
Co-authored-by: union <union@example.invalid>
0 commit comments