@windyroad/risk-scorer 0.13.3 → 0.13.4-preview.746
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,3 +21,10 @@ EXTERNAL_COMMS_POLICY_FILE=RISK-POLICY.md
|
|
|
21
21
|
# Whether to run the leak-pattern pre-filter (lib/leak-detect.sh). Risk evaluator
|
|
22
22
|
# checks confidential-information leaks; voice-tone evaluator does not.
|
|
23
23
|
EXTERNAL_COMMS_LEAK_PREFILTER=yes
|
|
24
|
+
|
|
25
|
+
# Surfaces this evaluator's policy disclaims (P360). EMPTY for the risk evaluator:
|
|
26
|
+
# leak detection on commit-message bodies is meaningful (a credential committed to
|
|
27
|
+
# git history is still a leak), so risk-scorer gates every detected surface. The
|
|
28
|
+
# voice-tone evaluator sets this to `git-commit-message` because its policy doc
|
|
29
|
+
# excludes commit messages; the divergence lives in each package's .conf.
|
|
30
|
+
EXTERNAL_COMMS_SKIP_SURFACES=
|
|
@@ -78,6 +78,10 @@ source "$SCRIPT_DIR/lib/external-comms-key.sh"
|
|
|
78
78
|
# EXTERNAL_COMMS_ASSESS_SKILL — on-demand skill path for manual delegation
|
|
79
79
|
# EXTERNAL_COMMS_POLICY_FILE — policy doc whose absence triggers advisory-only
|
|
80
80
|
# EXTERNAL_COMMS_LEAK_PREFILTER — yes|no — whether to run leak-detect pre-filter
|
|
81
|
+
# EXTERNAL_COMMS_SKIP_SURFACES — space-separated surface list this evaluator's
|
|
82
|
+
# policy disclaims; the marker-review delegation
|
|
83
|
+
# silent-passes on those surfaces (P360). Default
|
|
84
|
+
# empty (gate every detected surface).
|
|
81
85
|
# Fail-closed if absent: this hook cannot operate without a configured evaluator.
|
|
82
86
|
CONF_FILE="$SCRIPT_DIR/external-comms-evaluator.conf"
|
|
83
87
|
if [ ! -f "$CONF_FILE" ]; then
|
|
@@ -91,6 +95,7 @@ source "$CONF_FILE"
|
|
|
91
95
|
: "${EXTERNAL_COMMS_ASSESS_SKILL:?assess-skill missing from $CONF_FILE}"
|
|
92
96
|
EXTERNAL_COMMS_POLICY_FILE="${EXTERNAL_COMMS_POLICY_FILE:-RISK-POLICY.md}"
|
|
93
97
|
EXTERNAL_COMMS_LEAK_PREFILTER="${EXTERNAL_COMMS_LEAK_PREFILTER:-yes}"
|
|
98
|
+
EXTERNAL_COMMS_SKIP_SURFACES="${EXTERNAL_COMMS_SKIP_SURFACES:-}"
|
|
94
99
|
|
|
95
100
|
# ---------- Bypass ----------
|
|
96
101
|
if [ "${BYPASS_RISK_GATE:-0}" = "1" ]; then
|
|
@@ -318,6 +323,26 @@ if [ "$EXTERNAL_COMMS_LEAK_PREFILTER" = "yes" ]; then
|
|
|
318
323
|
fi
|
|
319
324
|
fi
|
|
320
325
|
|
|
326
|
+
# ---------- Per-evaluator surface skip (P360) ----------
|
|
327
|
+
# Some surfaces are explicitly disclaimed by THIS evaluator's policy doc, so the
|
|
328
|
+
# marker-review delegation below would be a guaranteed-PASS no-op (the subagent
|
|
329
|
+
# reads the policy, declares the surface out of scope, emits PASS — ~19K tokens
|
|
330
|
+
# per round-trip). EXTERNAL_COMMS_SKIP_SURFACES (per-package .conf) lists those
|
|
331
|
+
# surfaces; the gate silent-passes the prose-review delegation when the detected
|
|
332
|
+
# surface is on the list. Voice-tone sets this to `git-commit-message` because
|
|
333
|
+
# docs/VOICE-AND-TONE.md § Scope excludes commit messages ("covered by ADR-014 +
|
|
334
|
+
# ADR-018"); risk-scorer leaves it empty (its leak check on commit messages is
|
|
335
|
+
# meaningful). Placed AFTER the leak pre-filter so a skipped surface still gets
|
|
336
|
+
# credential/prod-URL scanning — this silences ONLY the prose-review deny, the
|
|
337
|
+
# same conservative shape as the P365 repo-visibility precondition below.
|
|
338
|
+
if [ -n "$EXTERNAL_COMMS_SKIP_SURFACES" ]; then
|
|
339
|
+
case " $EXTERNAL_COMMS_SKIP_SURFACES " in
|
|
340
|
+
*" $SURFACE "*)
|
|
341
|
+
exit 0
|
|
342
|
+
;;
|
|
343
|
+
esac
|
|
344
|
+
fi
|
|
345
|
+
|
|
321
346
|
# ---------- Repo-visibility precondition: git-commit-message surface (P365) ----------
|
|
322
347
|
# A commit message only becomes external-facing prose when it lands in a PUBLIC
|
|
323
348
|
# GitHub repo (git log / PR commits tab / release-page auto-notes / CHANGELOG).
|
|
@@ -385,6 +385,21 @@ run_hook() {
|
|
|
385
385
|
[[ "$output" == *"git-commit-message"* ]]
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
@test "P360: empty EXTERNAL_COMMS_SKIP_SURFACES leaves the risk evaluator gating commit messages (divergence guard)" {
|
|
389
|
+
# The voice-tone evaluator skips git-commit-message (its policy disclaims it);
|
|
390
|
+
# the risk evaluator's .conf leaves EXTERNAL_COMMS_SKIP_SURFACES empty, so its
|
|
391
|
+
# leak check on commit bodies stays meaningful. Guards against a regression
|
|
392
|
+
# that accidentally skips this surface for risk-scorer (e.g. defaulting the
|
|
393
|
+
# knob non-empty, or syncing voice-tone's value into the shared gate body).
|
|
394
|
+
grep -qE '^EXTERNAL_COMMS_SKIP_SURFACES=$' "$HOOKS_DIR/external-comms-evaluator.conf"
|
|
395
|
+
mock_gh_visibility PUBLIC
|
|
396
|
+
INPUT=$(build_bash_input "git commit -m \"fix(foo): handle null input\"")
|
|
397
|
+
run_hook "$INPUT"
|
|
398
|
+
[ "$status" -eq 0 ]
|
|
399
|
+
[[ "$output" == *"deny"* ]]
|
|
400
|
+
[[ "$output" == *"git-commit-message"* ]]
|
|
401
|
+
}
|
|
402
|
+
|
|
388
403
|
@test "P365: leak-shaped credential in a PRIVATE-repo commit body still hard-fails (security net survives)" {
|
|
389
404
|
mock_gh_visibility PRIVATE
|
|
390
405
|
INPUT=$(build_bash_input "git commit -m \"docs: token=${GH_TOKEN_LIKE}\"")
|
package/package.json
CHANGED