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
sec(scripts): git-secrets AWS secret-key pattern is inverted and never matches a key #295
An AWS secret access key is 40 characters from [A-Za-z0-9/+=]. The custom pattern scripts/setup-git-secrets.sh registers for it is the negated class [^A-Za-z0-9/+=]{40}[^A-Za-z0-9/+=], so it matches 41 consecutive characters that are not key characters. Tested with grep -E, it matched only a run of U+2501 box-drawing characters (the separator lines this repo's own scripts print) and never a synthetic 40-character base64 key. Severity is medium rather than high because git secrets --register-aws on line 43 and the assignment-shaped pattern on line 53 still block secret_key = "<40 chars>"; only a bare, unassigned key slips through the local gate.
Location
scripts/setup-git-secrets.sh:52 at 3c0f8ac94048a2c36fce5ccddee54e6c4849a5cd
Failure scenario
A 40-character secret key committed on its own line (a pasted credential, a YAML value without quotes) is not matched by this pattern at all. The comment beside it claims AWS-secret coverage the gate does not provide, and every developer's local pre-commit hook inherits the dead pattern via make setup-git-secrets.
Replace with a positive class anchored on non-key boundaries, for example (^|[^A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}([^A-Za-z0-9/+=]|$), and add a fixture proving it fires on a synthetic 40-character key. Worth fixing together with the allowed-pattern defect in the same script (audit finding A14-010).
Found by the 2026-09-02 codebase audit, finding A14-009, reported by one reviewer and independently confirmed by a second. Full report: docs/audits/codebase-audit-2026-09-02.md.
Reproduced during PR LeanerCloud/cloud-commitments-cli#2071 local pre-commit verification: the inverted pattern flagged 24 existing decorative comment lines across recommendations.ts and two frontend tests. No credential was present in those findings. To avoid bundling scanner work into the purchase fix, the commit ran with invocation-only secrets.allowed entries anchored to those file paths and complete verified comment lines; the remaining detectors and normal hooks ran, and persistent Git config was unchanged. The detector defect itself remains open here.
Activity
fix(scripts): narrow git-secrets allowlist, pin the tag SHA, test the…
fix(scripts): close the remaining allowlist gaps and wire up ci-success
cristim commentedon Sep 9, 2026
Reproduced during PR LeanerCloud/cloud-commitments-cli#2071 local pre-commit verification: the inverted pattern flagged 24 existing decorative comment lines across recommendations.ts and two frontend tests. No credential was present in those findings. To avoid bundling scanner work into the purchase fix, the commit ran with invocation-only secrets.allowed entries anchored to those file paths and complete verified comment lines; the remaining detectors and normal hooks ran, and persistent Git config was unchanged. The detector defect itself remains open here.