Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(ci): check every credential match on a line and run the measurement gates

Alfredo Lopez469e47cfd147
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.yml
index 55e8b2b57..c509baff3 100644
--- a/.github/workflows/ci-public.yml
+++ b/.github/workflows/ci-public.yml
@@ -136,7 +136,7 @@ jobs:
- name: Test
working-directory: ${{ matrix.service }}
env:
- PINNED_SUITES: ${{ matrix.service == 'gfs-controller' && 'serve.agentRateLimit.test.ts' || matrix.service == 'mcp-host' && 'gfsClient.retry429.test.ts' || '' }}
+ PINNED_SUITES: ${{ matrix.service == 'gfs-controller' && 'serve.agentRateLimit.test.ts' || matrix.service == 'mcp-host' && 'gfsClient.retry429.test.ts logPayloadKeys.test.ts taskExecutor.test.ts' || '' }}
run: |
set -euo pipefail
if [ -z "$PINNED_SUITES" ]; then
@@ -635,6 +635,16 @@ jobs:
- name: Test minikube Makefile targets
run: bash scripts/tests/test-minikube-makefile.sh
+ # make test-service-matrix fails when Makefile TEST_SERVICES and the
+ # `test` job's service matrix above drift apart.
+ - name: Test local measurement gate and test-service parity
+ run: |
+ node scripts/tests/run-node-test-files.mjs \
+ scripts/tests/test-test-services.cjs \
+ scripts/tests/test-measurement-base.cjs
+ bash scripts/tests/test-repo-intake-packet.sh
+ make test-service-matrix
+
- name: Test local Minikube T0/T1/T2 contract
# Includes test-minikube-docker-cli-env.sh: the real image-manifest
# writer's hermetic sequential-build and derived-base provenance checks.
diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.sh
index f110552ca..24cb4921e 100755
--- a/scripts/tests/test-minikube-t2-contract.sh
+++ b/scripts/tests/test-minikube-t2-contract.sh
@@ -663,18 +663,34 @@ git -C "$marker_repo" commit -q -m base
marker_base="$(git -C "$marker_repo" rev-parse HEAD)"
printf "expect(line).toMatchObject({ apiKey: '[Redacted]' })\n" >"$marker_repo/logger.test.ts"
if ! T2_PUBLIC_ROOT="$marker_repo" T2_PUBLIC_BASE_REF="$marker_base" \
- bash "$ROOT/scripts/tests/test-minikube-t2-public-boundary.sh"; then
+ bash "$ROOT/scripts/tests/test-minikube-t2-public-boundary.sh" >"$tmp/marker-boundary.out"; then
echo 'FAIL: public boundary rejected the [Redacted] marker as a credential' >&2
exit 1
fi
-for leaked in 'sk-live-4f9a2c7e1b' '[Redacted]sk-live-4f9a2c7e1b'; do
- printf "const client = { apiKey: '%s' }\n" "$leaked" >"$marker_repo/client.ts"
+if ! grep -Fxq 'PUBLIC_BOUNDARY_PASS' "$tmp/marker-boundary.out"; then
+ echo 'FAIL: public boundary accepted the [Redacted] marker without reporting PUBLIC_BOUNDARY_PASS' >&2
+ exit 1
+fi
+# The rejected values are composed at runtime, as in the cases above, so this
+# script's own source does not carry a credential assignment. An exempt value
+# earlier on the line must not hide a real one after it.
+marker_value='sk-live-4f9a2c7e1b'
+for leaked in \
+ "apiKey|$marker_value" \
+ "apiKey|[Redacted]$marker_value" \
+ "apiKey: '[Redacted]', password|$marker_value" \
+ "apiKey: 'fixture-api-key', password|$marker_value"; do
+ printf "const client = { %s: '%s' }\n" "${leaked%%|*}" "${leaked#*|}" >"$marker_repo/client.ts"
if T2_PUBLIC_ROOT="$marker_repo" T2_PUBLIC_BASE_REF="$marker_base" \
bash "$ROOT/scripts/tests/test-minikube-t2-public-boundary.sh" 2>"$tmp/marker-boundary.err"; then
echo "FAIL: public boundary accepted a credential assignment ($leaked)" >&2
exit 1
fi
- grep -Fq -- '- client.ts: credential assignment' "$tmp/marker-boundary.err"
+ if ! grep -Fq -- '- client.ts: credential assignment' "$tmp/marker-boundary.err"; then
+ echo "FAIL: public boundary rejected ($leaked) for another reason" >&2
+ cat "$tmp/marker-boundary.err" >&2
+ exit 1
+ fi
done
bash "$ROOT/scripts/tests/test-minikube-t2-scenarios.sh"
bash "$ROOT/scripts/tests/test-minikube-t2-proxy-runtime.sh"
diff --git a/scripts/tests/test-minikube-t2-public-boundary.sh b/scripts/tests/test-minikube-t2-public-boundary.sh
index 8c7fa73a7..771ac142f 100755
--- a/scripts/tests/test-minikube-t2-public-boundary.sh
+++ b/scripts/tests/test-minikube-t2-public-boundary.sh
@@ -105,36 +105,40 @@ for line in diff.splitlines():
r"revision|fixture|placeholder|dummy|fake|example|changeme|local[-_]?only|"
r"test[-_]?token)"
)
- # Logger tests assert the redaction marker under secret-named keys. Only the
- # whole value is exempt; a value that merely contains the marker is not.
+ # The logger's redaction marker is not a credential; logger tests assert it
+ # under secret-named keys. The exemption applies in any file, and only when
+ # the whole value is the marker; a value that merely contains it is flagged.
redaction_marker = re.compile(r"(?i)\[redacted\]")
+ # Every match on the line is checked: an exempt first match must not hide a
+ # real value later on the same line.
for expression, reason in patterns:
- match = re.search(expression, value)
- if match and reason == "private key" and "evidence-scanner" in current:
- continue
- if (
- match
- and reason == "credential assignment"
- and match.group(1)
- and (
- safe_fixture.search(match.group(1))
- or "$" in match.group(1)
- or redaction_marker.fullmatch(match.group(1))
- )
- ):
- continue
- if (
- match
- and reason == "private runtime URL"
- and (
- "/test/" in f"/{current.lower()}"
- or "/tests/" in f"/{current.lower()}"
- or current.lower().startswith("scripts/tests/")
- or current.lower().endswith((".test.ts", ".test.tsx", ".spec.ts", ".spec.tsx"))
- )
- ):
- continue
- if match:
+ flagged = False
+ for match in re.finditer(expression, value):
+ if reason == "private key" and "evidence-scanner" in current:
+ continue
+ if (
+ reason == "credential assignment"
+ and match.group(1)
+ and (
+ safe_fixture.search(match.group(1))
+ or "$" in match.group(1)
+ or redaction_marker.fullmatch(match.group(1))
+ )
+ ):
+ continue
+ if (
+ reason == "private runtime URL"
+ and (
+ "/test/" in f"/{current.lower()}"
+ or "/tests/" in f"/{current.lower()}"
+ or current.lower().startswith("scripts/tests/")
+ or current.lower().endswith((".test.ts", ".test.tsx", ".spec.ts", ".spec.tsx"))
+ )
+ ):
+ continue
+ flagged = True
+ break
+ if flagged:
bad.append((current or "<unknown>", reason))
break