fix(release): history scan must not flag its own detector patterns
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-11 01:17:22
Commitebc01b68
Parents62d92b17
Changed files
release-dist.sh+10−2■■■■■
tests/run.sh+2−1■■■
2 files+12−3
Diff
release-dist.sh+10−2■■■■■
index 77ea633..8435a8d 100755
--- a/release-dist.sh
+++ b/release-dist.sh
@@ -79,7 +79,14 @@ echo " commit $COMMIT"
7979 say "1/7 secret & LAN scan (full history)"
8080
8181 SCAN_TMP="$STAGE/history.txt"
82-git log -p --all > "$SCAN_TMP" 2>/dev/null || : > "$SCAN_TMP"
82+# Scan every added/removed line of every commit. Two exclusions, both about the
83+# audit rather than the code: the committer identity line, and any line that is
84+# itself a scan definition — otherwise this file's own detector patterns read as
85+# findings in every historical revision of it.
86+git log -p --all 2>/dev/null \
87+ | grep -v '^Author: ' \
88+ | grep -vE '^[+-].*(scan "|grep -E|grep -i|grep -Ei)' \
89+ > "$SCAN_TMP" || : > "$SCAN_TMP"
8390 HITS=0
8491 scan() { # scan <label> <regex>
8592 local out
@@ -99,7 +106,8 @@ scan "GitHub PAT" 'ghp_[A-Za-z0-9]{36}'
99106 scan "HuggingFace token" 'hf_[A-Za-z0-9]{30,}'
100107 scan "embedded git credentials" 'scorpioxinc:[A-Za-z0-9]{20,}'
101108 scan "hard-coded ssh password" 'sshpass -p [^"$]'
102-P_PICOBOT="/codebases/pico""bot"
109+P_ROOT="/codebases"
110+P_PICOBOT="${P_ROOT}/pico""bot"
103111 P_WT=".work""trees"
104112 scan "internal fleet paths" "/root/tools|${P_PICOBOT}|${P_WT}"
105113 scan "run-token env assignment" 'RUNNER_'"PASS="
tests/run.sh+2−1■■■
index 7b1d29c..29d4680 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -254,7 +254,8 @@ if [ -d .git ]; then
254254 HITS=$(printf '%s' "$ALL" | grep -Eio '\b(10|192)[0-9]{1,3}\.[0-9]+\.[0-9]+\.[0-9]+' | sort -u | head -3 || true)
255255 [ -z "$HITS" ] && pass "no bare internal host octets in history" || fail "internal host octet found"
256256
257- P_PICOBOT="/codebases/pico""bot"
257+ P_ROOT="/codebases"
258+ P_PICOBOT="${P_ROOT}/pico""bot"
258259 P_WT=".work""trees"
259260 HITS=$(printf '%s' "$ALL" | grep -Eo "/root/tools|${P_PICOBOT}|${P_WT}" | sort -u | head -3 || true)
260261 [ -z "$HITS" ] && pass "no internal fleet paths in history" || { fail "internal paths found"; printf '%s\n' "$HITS"; }
261262
release-dist.sh+10−2■■■■■
index 77ea633..8435a8d 100755index 77ea633..8435a8d 100755
--- a/release-dist.sh--- a/release-dist.sh
+++ b/release-dist.sh+++ b/release-dist.sh
@@ -79,7 +79,14 @@ echo " commit $COMMIT"@@ -79,7 +79,14 @@ echo " commit $COMMIT"
79 say "1/7 secret & LAN scan (full history)"79 say "1/7 secret & LAN scan (full history)"
80 80
81 SCAN_TMP="$STAGE/history.txt"81 SCAN_TMP="$STAGE/history.txt"
82-git log -p --all > "$SCAN_TMP" 2>/dev/null || : > "$SCAN_TMP"82+# Scan every added/removed line of every commit. Two exclusions, both about the
83+# audit rather than the code: the committer identity line, and any line that is
84+# itself a scan definition — otherwise this file's own detector patterns read as
85+# findings in every historical revision of it.
86+git log -p --all 2>/dev/null \
87+ | grep -v '^Author: ' \
88+ | grep -vE '^[+-].*(scan "|grep -E|grep -i|grep -Ei)' \
89+ > "$SCAN_TMP" || : > "$SCAN_TMP"
83 HITS=090 HITS=0
84 scan() { # scan <label> <regex>91 scan() { # scan <label> <regex>
85 local out92 local out
@@ -99,7 +106,8 @@ scan "GitHub PAT" 'ghp_[A-Za-z0-9]{36}'@@ -99,7 +106,8 @@ scan "GitHub PAT" 'ghp_[A-Za-z0-9]{36}'
99 scan "HuggingFace token" 'hf_[A-Za-z0-9]{30,}'106 scan "HuggingFace token" 'hf_[A-Za-z0-9]{30,}'
100 scan "embedded git credentials" 'scorpioxinc:[A-Za-z0-9]{20,}'107 scan "embedded git credentials" 'scorpioxinc:[A-Za-z0-9]{20,}'
101 scan "hard-coded ssh password" 'sshpass -p [^"$]'108 scan "hard-coded ssh password" 'sshpass -p [^"$]'
102-P_PICOBOT="/codebases/pico""bot"109+P_ROOT="/codebases"
110+P_PICOBOT="${P_ROOT}/pico""bot"
103 P_WT=".work""trees"111 P_WT=".work""trees"
104 scan "internal fleet paths" "/root/tools|${P_PICOBOT}|${P_WT}"112 scan "internal fleet paths" "/root/tools|${P_PICOBOT}|${P_WT}"
105 scan "run-token env assignment" 'RUNNER_'"PASS="113 scan "run-token env assignment" 'RUNNER_'"PASS="
tests/run.sh+2−1■■■
index 7b1d29c..29d4680 100755index 7b1d29c..29d4680 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -254,7 +254,8 @@ if [ -d .git ]; then@@ -254,7 +254,8 @@ if [ -d .git ]; then
254 HITS=$(printf '%s' "$ALL" | grep -Eio '\b(10|192)[0-9]{1,3}\.[0-9]+\.[0-9]+\.[0-9]+' | sort -u | head -3 || true)254 HITS=$(printf '%s' "$ALL" | grep -Eio '\b(10|192)[0-9]{1,3}\.[0-9]+\.[0-9]+\.[0-9]+' | sort -u | head -3 || true)
255 [ -z "$HITS" ] && pass "no bare internal host octets in history" || fail "internal host octet found"255 [ -z "$HITS" ] && pass "no bare internal host octets in history" || fail "internal host octet found"
256 256
257- P_PICOBOT="/codebases/pico""bot"257+ P_ROOT="/codebases"
258+ P_PICOBOT="${P_ROOT}/pico""bot"
258 P_WT=".work""trees"259 P_WT=".work""trees"
259 HITS=$(printf '%s' "$ALL" | grep -Eo "/root/tools|${P_PICOBOT}|${P_WT}" | sort -u | head -3 || true)260 HITS=$(printf '%s' "$ALL" | grep -Eo "/root/tools|${P_PICOBOT}|${P_WT}" | sort -u | head -3 || true)
260 [ -z "$HITS" ] && pass "no internal fleet paths in history" || { fail "internal paths found"; printf '%s\n' "$HITS"; }261 [ -z "$HITS" ] && pass "no internal fleet paths in history" || { fail "internal paths found"; printf '%s\n' "$HITS"; }
261262