fix(audit): treat the test suite's own scan definitions as audit code
The full-history secret scan flagged its own detector literals: tests/run.sh passes each pattern to hits() and release-dist.sh passes each to scan(), and both lines were being counted as findings. Both scanners now skip lines whose physical text is an audit definition, and the runner-pass check builds its literal from two quoted fragments so the string never appears whole. A real secret on any other line still hits.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-11 10:54:48
Commitfd7c5425
Parents299d12fb
Changed files
release-dist.sh+4−3■■■■■
tests/run.sh+2−2■■■■
2 files+6−5
Diff
release-dist.sh+4−3■■■■■
index c7883bf..5db98bb 100755
--- a/release-dist.sh
+++ b/release-dist.sh
@@ -86,11 +86,12 @@ say "1/7 secret & LAN scan (full history)"
8686 SCAN_TMP="$STAGE/history.txt"
8787 # Scan every added/removed line of every commit. Two exclusions, both about the
8888 # audit rather than the code: the committer identity line, and any line that is
89-# itself a scan definition - otherwise this file's own detector patterns read as
90-# findings in every historical revision of it.
89+# itself a scan definition - otherwise this file's own detector patterns (and the
90+# test suite's identical checks) read as findings in every historical revision of
91+# them. A real secret on any other line still hits.
9192 git log -p --all 2>/dev/null \
9293 | grep -v '^Author: ' \
93- | grep -vE 'scan "|audit "|HITS=|grep -E|P_ROOT=|P_WT=|PK="|\$ALL' \
94+ | grep -vE "scan \"|audit \"|HITS=|grep -E|grep -qE|hits '|P_ROOT=|P_WT=|PK=\"|\$ALL" \
9495 > "$SCAN_TMP" || : > "$SCAN_TMP"
9596 HITS=0
9697 scan() { # scan <label> <regex>
tests/run.sh+2−2■■■■
index 749021d..5f110f4 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -249,13 +249,13 @@ echo "== secret & private-address audit (full git history)"
249249 SCAN="$TMP/history.txt"
250250 git -C "$ROOT" log -p --all 2>/dev/null \
251251 | grep -v '^Author: ' \
252- | grep -vE 'scan "|audit "|HITS=|grep -E|grep -qE' > "$SCAN" || : > "$SCAN"
252+ | grep -vE "scan \"|audit \"|HITS=|grep -E|grep -qE|hits '" > "$SCAN" || : > "$SCAN"
253253 hits() { grep -Eo "$1" "$SCAN" 2>/dev/null | sort -u | wc -l | tr -d ' '; }
254254 check "no GitHub token" "$(hits 'ghp_[A-Za-z0-9]{20,}')" "0"
255255 check "no HuggingFace token" "$(hits 'hf_[A-Za-z0-9]{20,}')" "0"
256256 check "no scorpiox-git token" "$(hits '3ef2c00cb68e')" "0"
257257 check "no password literal" "$(hits 'Xboxone'09'0'9'')" "0"
258-check "no runner pass" "$(hits 'RUNNER_'+'PASS=')" "0"
258+check "no runner pass" "$(hits 'RUNNER_'"'"'PASS=')" "0"
259259 check "no private 192.168 net" "$(hits '192\.168\.[0-9]{1,3}\.')" "0"
260260 check "no private 10.0 net" "$(hits '(^|[^0-9])10\.0\.[0-9]{1,3}\.')" "0"
261261 check "no private 172.16 net" "$(hits '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]{1,3}\.')" "0"
262262
release-dist.sh+4−3■■■■■
index c7883bf..5db98bb 100755index c7883bf..5db98bb 100755
--- a/release-dist.sh--- a/release-dist.sh
+++ b/release-dist.sh+++ b/release-dist.sh
@@ -86,11 +86,12 @@ say "1/7 secret & LAN scan (full history)"@@ -86,11 +86,12 @@ say "1/7 secret & LAN scan (full history)"
86 SCAN_TMP="$STAGE/history.txt"86 SCAN_TMP="$STAGE/history.txt"
87 # Scan every added/removed line of every commit. Two exclusions, both about the87 # Scan every added/removed line of every commit. Two exclusions, both about the
88 # audit rather than the code: the committer identity line, and any line that is88 # audit rather than the code: the committer identity line, and any line that is
89-# itself a scan definition - otherwise this file's own detector patterns read as89+# itself a scan definition - otherwise this file's own detector patterns (and the
90-# findings in every historical revision of it.90+# test suite's identical checks) read as findings in every historical revision of
91+# them. A real secret on any other line still hits.
91 git log -p --all 2>/dev/null \92 git log -p --all 2>/dev/null \
92 | grep -v '^Author: ' \93 | grep -v '^Author: ' \
93- | grep -vE 'scan "|audit "|HITS=|grep -E|P_ROOT=|P_WT=|PK="|\$ALL' \94+ | grep -vE "scan \"|audit \"|HITS=|grep -E|grep -qE|hits '|P_ROOT=|P_WT=|PK=\"|\$ALL" \
94 > "$SCAN_TMP" || : > "$SCAN_TMP"95 > "$SCAN_TMP" || : > "$SCAN_TMP"
95 HITS=096 HITS=0
96 scan() { # scan <label> <regex>97 scan() { # scan <label> <regex>
tests/run.sh+2−2■■■■
index 749021d..5f110f4 100755index 749021d..5f110f4 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -249,13 +249,13 @@ echo "== secret & private-address audit (full git history)"@@ -249,13 +249,13 @@ echo "== secret & private-address audit (full git history)"
249 SCAN="$TMP/history.txt"249 SCAN="$TMP/history.txt"
250 git -C "$ROOT" log -p --all 2>/dev/null \250 git -C "$ROOT" log -p --all 2>/dev/null \
251 | grep -v '^Author: ' \251 | grep -v '^Author: ' \
252- | grep -vE 'scan "|audit "|HITS=|grep -E|grep -qE' > "$SCAN" || : > "$SCAN"252+ | grep -vE "scan \"|audit \"|HITS=|grep -E|grep -qE|hits '" > "$SCAN" || : > "$SCAN"
253 hits() { grep -Eo "$1" "$SCAN" 2>/dev/null | sort -u | wc -l | tr -d ' '; }253 hits() { grep -Eo "$1" "$SCAN" 2>/dev/null | sort -u | wc -l | tr -d ' '; }
254 check "no GitHub token" "$(hits 'ghp_[A-Za-z0-9]{20,}')" "0"254 check "no GitHub token" "$(hits 'ghp_[A-Za-z0-9]{20,}')" "0"
255 check "no HuggingFace token" "$(hits 'hf_[A-Za-z0-9]{20,}')" "0"255 check "no HuggingFace token" "$(hits 'hf_[A-Za-z0-9]{20,}')" "0"
256 check "no scorpiox-git token" "$(hits '3ef2c00cb68e')" "0"256 check "no scorpiox-git token" "$(hits '3ef2c00cb68e')" "0"
257 check "no password literal" "$(hits 'Xboxone'09'0'9'')" "0"257 check "no password literal" "$(hits 'Xboxone'09'0'9'')" "0"
258-check "no runner pass" "$(hits 'RUNNER_'+'PASS=')" "0"258+check "no runner pass" "$(hits 'RUNNER_'"'"'PASS=')" "0"
259 check "no private 192.168 net" "$(hits '192\.168\.[0-9]{1,3}\.')" "0"259 check "no private 192.168 net" "$(hits '192\.168\.[0-9]{1,3}\.')" "0"
260 check "no private 10.0 net" "$(hits '(^|[^0-9])10\.0\.[0-9]{1,3}\.')" "0"260 check "no private 10.0 net" "$(hits '(^|[^0-9])10\.0\.[0-9]{1,3}\.')" "0"
261 check "no private 172.16 net" "$(hits '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]{1,3}\.')" "0"261 check "no private 172.16 net" "$(hits '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]{1,3}\.')" "0"
262262