secrets.sh never runs its private-key pattern and verify never scans dist #235
Labels
No Label
P0
P1
P2
P3
accessibility
backend
bug
content
data-integrity
enhancement
frontend
infra
integration
owner
owner-input
performance
phase-7
phase-8
release-blocker
security
seo
ui
ux
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Queue-North-Website#235
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Seen at
a25077d(v0.9.5) and7415e19.What is true now, in
scripts/secrets.sh:grep -nEI "$pattern"(line 320) andgrep -oEI "$pattern"(line 335) have no-e, so the private-key pattern, which starts with dashes, is read as an option. grep exits 2 and2>/dev/nullhides it. A staged private key passes the pre-commit hook. Proven on 2026-09-10 in a scratch repository.7415e19, flags two comment lines (scripts/secrets.sh:29andscripts/check-env.sh:61), sobash scripts/secrets.sh --trackedexits 1,npm run verifyfails, andnpm run releasedies after bumpingpackage.json,package-lock.jsonand the Dockerfile. The comment above the pattern (lines 170-172) no longer describes it.dist/, althoughdocs/security/SECURITY_CHECKLIST.mdlists--built dist/as a release check.What it costs. The one guard between a credential and a pushed commit silently misses private keys, and the release gate is red.
What to do.
-e "$pattern"at both calls; treat a grep exit 2 as "could not scan" (exit 2), never as clean; quote the two comment examples; correct the comment; add--built dist/toscripts/verify.d/20-secrets. Docs:docs/security/SECURITY.md:52, aSECURITY_CHECKLIST.mdrow, and adocs/architecture/GUARDS.mdrule that a matcher's2>/dev/nullturns "could not run" into "found nothing".Trap. Never write a literal private-key header or AWS key id into a tracked file, including the dev log; the fixed scanner flags it.
Verify: in a scratch repository a staged private-key header, a bare
API_KEY=value and an exported secret each exit 1,PASSWORD=${VAR}and a delete-only commit exit 0,bash scripts/secrets.sh --trackedexits 0, andbash scripts/verify.sh --only secretsruns the--built dist/scan.Fixed in
26136f4. grep now takes -e at scripts/secrets.sh:320 and :335, every pattern is compiled against empty input before the scan (an unreadable one exits 2), the NAME=value pattern also catches quoted values, and a line that must show a credential shape carries secrets-ok: with a reason. Guard 20-secrets runs --tracked and --built dist/. Proven by mutation in a scratch repository: a staged PEM header, a bare API_KEY=, a quoted API_KEY=, an exported secret and an AWS key id each exit 1; a ${VAR} value, a , an excused line and a delete-only commit each exit 0; a broken pattern exits 2 both with content staged and with none; a key planted in dist/ fails guard 20-secrets alone and is masked in the report. bash scripts/secrets.sh --tracked and --built dist/ both exit 0 on this tree, and npm run verify passes all three guards.