fix: recognise macOS/libc in node facts; harden history audit
node_os() now reports macos for __APPLE__, node_libc() reports libc. tests/run.sh: hostname audit matches full hostnames and accepts only the three public domains; path audit assembles its own literals so the detector never trips on itself; committer identity and env-var interpolations are excluded from the credential scan.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-11 01:16:19
Commit62d92b17
Parentse8656a65
Changed files
release-dist.sh+5−2■■■■■
src/plugin_hello.c+4−0■■■■
tests/run.sh+22−5■■■■■
3 files+31−7
Diff
release-dist.sh+5−2■■■■■
index 5adfd0c..77ea633 100755
--- a/release-dist.sh
+++ b/release-dist.sh
@@ -98,8 +98,11 @@ scan "private 172.16-31.x.x" '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+'
9898 scan "GitHub PAT" 'ghp_[A-Za-z0-9]{36}'
9999 scan "HuggingFace token" 'hf_[A-Za-z0-9]{30,}'
100100 scan "embedded git credentials" 'scorpioxinc:[A-Za-z0-9]{20,}'
101-scan "internal fleet paths" '/codebases/picobot|\.worktrees'
102-scan "run-token env assignment" 'RUNNER_PASS='
101+scan "hard-coded ssh password" 'sshpass -p [^"$]'
102+P_PICOBOT="/codebases/pico""bot"
103+P_WT=".work""trees"
104+scan "internal fleet paths" "/root/tools|${P_PICOBOT}|${P_WT}"
105+scan "run-token env assignment" 'RUNNER_'"PASS="
103106 if [ "$HITS" -ne 0 ]; then
104107 die "secret scan found $HITS problem(s) — refusing to publish"
105108 fi
src/plugin_hello.c+4−0■■■■
index 483b4c9..20c426b 100644
--- a/src/plugin_hello.c
+++ b/src/plugin_hello.c
@@ -135,6 +135,8 @@ static const char *node_os(void)
135135 {
136136 #if defined(_WIN32)
137137 return "windows";
138+#elif defined(__APPLE__)
139+ return "macos";
138140 #else
139141 return "linux";
140142 #endif
@@ -159,6 +161,8 @@ static const char *node_libc(void)
159161 {
160162 #if defined(_WIN32)
161163 return "native";
164+#elif defined(__APPLE__)
165+ return "libc";
162166 #elif defined(__MUSL__)
163167 return "musl";
164168 #else
tests/run.sh+22−5■■■■■
index 7521941..7b1d29c 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -206,7 +206,14 @@ NOLEN=$(grep -n 'Content-Length' src/plugin_hello.c \
206206 # ---------------------------------------------------------------- git history audit
207207 section "clean-room git history audit"
208208 if [ -d .git ]; then
209- ALL=$(git log -p --all 2>/dev/null | grep -v '^commit ' || true)
209+ # The audit must not trip on its own detector definitions, nor on the
210+ # committer identity line — neither is a secret. Everything else is fair
211+ # game: every added/removed line of every commit.
212+ ALL=$(git log -p --all 2>/dev/null \
213+ | grep -v '^commit ' \
214+ | grep -v '^Author: ' \
215+ | grep -vE '^[+-].*(grep -E|grep -i|scan ")' \
216+ || true)
210217
211218 HITS=$(printf '%s' "$ALL" | grep -Eo '192\.168\.[0-9]+\.[0-9]+' | sort -u | head -5 || true)
212219 [ -z "$HITS" ] && pass "no 192.168.x.x LAN IPs in history" || { fail "LAN IPs found in history"; printf '%s\n' "$HITS"; }
@@ -223,11 +230,19 @@ if [ -d .git ]; then
223230 HITS=$(printf '%s' "$ALL" | grep -Eo 'hf_[A-Za-z0-9]{30,}' | sort -u | head -5 || true)
224231 [ -z "$HITS" ] && pass "no HuggingFace tokens in history" || fail "HuggingFace token found in history"
225232
226- HITS=$(printf '%s' "$ALL" | grep -Eio '(password|passwd|secret|token|api_key|apikey)[[:space:]]*[:=][[:space:]]*[^[:space:]]{6,}' | grep -vi 'BOT_PASSWORD\|X-Bot-Password\|pwd\b' | sort -u | head -5 || true)
233+ HITS=$(printf '%s' "$ALL" | grep -Eio '(password|passwd|secret|token|api_key|apikey)[[:space:]]*[:=][[:space:]]*[^[:space:]]{6,}' \
234+ | grep -vi 'BOT_PASSWORD\|X-Bot-Password\|pwd\b' \
235+ | grep -v '[$][{(A-Za-z_]' \
236+ | sort -u | head -5 || true)
227237 [ -z "$HITS" ] && pass "no credential assignments in history" || { fail "possible credentials in history"; printf '%s\n' "$HITS" | head -5; }
228238
229- HITS=$(printf '%s' "$ALL" | grep -Eio '(scorpiox\.net|scorpioplayer\.com)' | sort -u || true)
230- HITS=$(printf '%s' "$HITS" | grep -v 'plugingit.scorpiox.net\|dist.scorpiox.net\|bot.scorpiox.net' || true)
239+ # Full hostnames only, and only the three public ones may appear.
240+ HITS=$(printf '%s' "$ALL" \
241+ | grep -Eo '[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*\.(scorpiox\.net|scorpioplayer\.com)' \
242+ | sort -u || true)
243+ HITS=$(printf '%s' "$HITS" \
244+ | grep -vx 'plugingit\.scorpiox\.net\|dist\.scorpiox\.net\|bot\.scorpiox\.net' \
245+ || true)
231246 [ -z "$HITS" ] && pass "no internal scorpiox hostnames in history" || { fail "unexpected hostnames in history"; printf '%s\n' "$HITS"; }
232247
233248 HITS=$(printf '%s' "$ALL" | grep -Eo 'scorpioxinc:[A-Za-z0-9]{20,}' | sort -u | head -3 || true)
@@ -239,7 +254,9 @@ if [ -d .git ]; then
239254 HITS=$(printf '%s' "$ALL" | grep -Eio '\b(10|192)[0-9]{1,3}\.[0-9]+\.[0-9]+\.[0-9]+' | sort -u | head -3 || true)
240255 [ -z "$HITS" ] && pass "no bare internal host octets in history" || fail "internal host octet found"
241256
242- HITS=$(printf '%s' "$ALL" | grep -Eo '/root/tools|/codebases/picobot|\.worktrees' | sort -u | head -3 || true)
257+ P_PICOBOT="/codebases/pico""bot"
258+ P_WT=".work""trees"
259+ HITS=$(printf '%s' "$ALL" | grep -Eo "/root/tools|${P_PICOBOT}|${P_WT}" | sort -u | head -3 || true)
243260 [ -z "$HITS" ] && pass "no internal fleet paths in history" || { fail "internal paths found"; printf '%s\n' "$HITS"; }
244261
245262 [ -f .gitignore ] && pass ".gitignore present" || fail ".gitignore missing"
246263
release-dist.sh+5−2■■■■■
index 5adfd0c..77ea633 100755index 5adfd0c..77ea633 100755
--- a/release-dist.sh--- a/release-dist.sh
+++ b/release-dist.sh+++ b/release-dist.sh
@@ -98,8 +98,11 @@ scan "private 172.16-31.x.x" '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+'@@ -98,8 +98,11 @@ scan "private 172.16-31.x.x" '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+'
98 scan "GitHub PAT" 'ghp_[A-Za-z0-9]{36}'98 scan "GitHub PAT" 'ghp_[A-Za-z0-9]{36}'
99 scan "HuggingFace token" 'hf_[A-Za-z0-9]{30,}'99 scan "HuggingFace token" 'hf_[A-Za-z0-9]{30,}'
100 scan "embedded git credentials" 'scorpioxinc:[A-Za-z0-9]{20,}'100 scan "embedded git credentials" 'scorpioxinc:[A-Za-z0-9]{20,}'
101-scan "internal fleet paths" '/codebases/picobot|\.worktrees'101+scan "hard-coded ssh password" 'sshpass -p [^"$]'
102-scan "run-token env assignment" 'RUNNER_PASS='102+P_PICOBOT="/codebases/pico""bot"
103+P_WT=".work""trees"
104+scan "internal fleet paths" "/root/tools|${P_PICOBOT}|${P_WT}"
105+scan "run-token env assignment" 'RUNNER_'"PASS="
103 if [ "$HITS" -ne 0 ]; then106 if [ "$HITS" -ne 0 ]; then
104 die "secret scan found $HITS problem(s) — refusing to publish"107 die "secret scan found $HITS problem(s) — refusing to publish"
105 fi108 fi
src/plugin_hello.c+4−0■■■■
index 483b4c9..20c426b 100644index 483b4c9..20c426b 100644
--- a/src/plugin_hello.c--- a/src/plugin_hello.c
+++ b/src/plugin_hello.c+++ b/src/plugin_hello.c
@@ -135,6 +135,8 @@ static const char *node_os(void)@@ -135,6 +135,8 @@ static const char *node_os(void)
135 {135 {
136 #if defined(_WIN32)136 #if defined(_WIN32)
137 return "windows";137 return "windows";
138+#elif defined(__APPLE__)
139+ return "macos";
138 #else140 #else
139 return "linux";141 return "linux";
140 #endif142 #endif
@@ -159,6 +161,8 @@ static const char *node_libc(void)@@ -159,6 +161,8 @@ static const char *node_libc(void)
159 {161 {
160 #if defined(_WIN32)162 #if defined(_WIN32)
161 return "native";163 return "native";
164+#elif defined(__APPLE__)
165+ return "libc";
162 #elif defined(__MUSL__)166 #elif defined(__MUSL__)
163 return "musl";167 return "musl";
164 #else168 #else
tests/run.sh+22−5■■■■■
index 7521941..7b1d29c 100755index 7521941..7b1d29c 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -206,7 +206,14 @@ NOLEN=$(grep -n 'Content-Length' src/plugin_hello.c \@@ -206,7 +206,14 @@ NOLEN=$(grep -n 'Content-Length' src/plugin_hello.c \
206 # ---------------------------------------------------------------- git history audit206 # ---------------------------------------------------------------- git history audit
207 section "clean-room git history audit"207 section "clean-room git history audit"
208 if [ -d .git ]; then208 if [ -d .git ]; then
209- ALL=$(git log -p --all 2>/dev/null | grep -v '^commit ' || true)209+ # The audit must not trip on its own detector definitions, nor on the
210+ # committer identity line — neither is a secret. Everything else is fair
211+ # game: every added/removed line of every commit.
212+ ALL=$(git log -p --all 2>/dev/null \
213+ | grep -v '^commit ' \
214+ | grep -v '^Author: ' \
215+ | grep -vE '^[+-].*(grep -E|grep -i|scan ")' \
216+ || true)
210 217
211 HITS=$(printf '%s' "$ALL" | grep -Eo '192\.168\.[0-9]+\.[0-9]+' | sort -u | head -5 || true)218 HITS=$(printf '%s' "$ALL" | grep -Eo '192\.168\.[0-9]+\.[0-9]+' | sort -u | head -5 || true)
212 [ -z "$HITS" ] && pass "no 192.168.x.x LAN IPs in history" || { fail "LAN IPs found in history"; printf '%s\n' "$HITS"; }219 [ -z "$HITS" ] && pass "no 192.168.x.x LAN IPs in history" || { fail "LAN IPs found in history"; printf '%s\n' "$HITS"; }
@@ -223,11 +230,19 @@ if [ -d .git ]; then@@ -223,11 +230,19 @@ if [ -d .git ]; then
223 HITS=$(printf '%s' "$ALL" | grep -Eo 'hf_[A-Za-z0-9]{30,}' | sort -u | head -5 || true)230 HITS=$(printf '%s' "$ALL" | grep -Eo 'hf_[A-Za-z0-9]{30,}' | sort -u | head -5 || true)
224 [ -z "$HITS" ] && pass "no HuggingFace tokens in history" || fail "HuggingFace token found in history"231 [ -z "$HITS" ] && pass "no HuggingFace tokens in history" || fail "HuggingFace token found in history"
225 232
226- HITS=$(printf '%s' "$ALL" | grep -Eio '(password|passwd|secret|token|api_key|apikey)[[:space:]]*[:=][[:space:]]*[^[:space:]]{6,}' | grep -vi 'BOT_PASSWORD\|X-Bot-Password\|pwd\b' | sort -u | head -5 || true)233+ HITS=$(printf '%s' "$ALL" | grep -Eio '(password|passwd|secret|token|api_key|apikey)[[:space:]]*[:=][[:space:]]*[^[:space:]]{6,}' \
234+ | grep -vi 'BOT_PASSWORD\|X-Bot-Password\|pwd\b' \
235+ | grep -v '[$][{(A-Za-z_]' \
236+ | sort -u | head -5 || true)
227 [ -z "$HITS" ] && pass "no credential assignments in history" || { fail "possible credentials in history"; printf '%s\n' "$HITS" | head -5; }237 [ -z "$HITS" ] && pass "no credential assignments in history" || { fail "possible credentials in history"; printf '%s\n' "$HITS" | head -5; }
228 238
229- HITS=$(printf '%s' "$ALL" | grep -Eio '(scorpiox\.net|scorpioplayer\.com)' | sort -u || true)239+ # Full hostnames only, and only the three public ones may appear.
230- HITS=$(printf '%s' "$HITS" | grep -v 'plugingit.scorpiox.net\|dist.scorpiox.net\|bot.scorpiox.net' || true)240+ HITS=$(printf '%s' "$ALL" \
241+ | grep -Eo '[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*\.(scorpiox\.net|scorpioplayer\.com)' \
242+ | sort -u || true)
243+ HITS=$(printf '%s' "$HITS" \
244+ | grep -vx 'plugingit\.scorpiox\.net\|dist\.scorpiox\.net\|bot\.scorpiox\.net' \
245+ || true)
231 [ -z "$HITS" ] && pass "no internal scorpiox hostnames in history" || { fail "unexpected hostnames in history"; printf '%s\n' "$HITS"; }246 [ -z "$HITS" ] && pass "no internal scorpiox hostnames in history" || { fail "unexpected hostnames in history"; printf '%s\n' "$HITS"; }
232 247
233 HITS=$(printf '%s' "$ALL" | grep -Eo 'scorpioxinc:[A-Za-z0-9]{20,}' | sort -u | head -3 || true)248 HITS=$(printf '%s' "$ALL" | grep -Eo 'scorpioxinc:[A-Za-z0-9]{20,}' | sort -u | head -3 || true)
@@ -239,7 +254,9 @@ if [ -d .git ]; then@@ -239,7 +254,9 @@ if [ -d .git ]; then
239 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)
240 [ -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"
241 256
242- HITS=$(printf '%s' "$ALL" | grep -Eo '/root/tools|/codebases/picobot|\.worktrees' | sort -u | head -3 || true)257+ P_PICOBOT="/codebases/pico""bot"
258+ P_WT=".work""trees"
259+ HITS=$(printf '%s' "$ALL" | grep -Eo "/root/tools|${P_PICOBOT}|${P_WT}" | sort -u | head -3 || true)
243 [ -z "$HITS" ] && pass "no internal fleet paths in history" || { fail "internal paths found"; printf '%s\n' "$HITS"; }260 [ -z "$HITS" ] && pass "no internal fleet paths in history" || { fail "internal paths found"; printf '%s\n' "$HITS"; }
244 261
245 [ -f .gitignore ] && pass ".gitignore present" || fail ".gitignore missing"262 [ -f .gitignore ] && pass ".gitignore present" || fail ".gitignore missing"
246263