fix(ci): exclude secrets-detector test fixtures from secret-scan (unblocks A2A-P0 deploy) #1477
Reference in New Issue
Block a user
Delete Branch "fix/secret-scan-exclude-secrets-detector-test-fixtures"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause (verified, obs-first): push:main
Secret scan / Scan diff for credential-shaped stringswent RED on5324e690because internal#425 Phase-2a'sworkspace-server/internal/secrets/patterns_test.gocontains synthetic credential-SHAPED fixtures (fabricated 43-charghp_*— verified NOT real) to test the detector; the scan's ownghp_pattern matched its own test corpus. Production auto-deploy correctly fail-closed on the red required context, blocking the A2A-P0 rollout (PR#1450, already merged).Fix: add the fixture file to the existing per-file skip-list (same mechanism + rationale as the SELF_GITEA/SELF_GITHUB self-excludes for the workflow's own regex literals). Gate is NOT weakened — every other path is still fully scanned; only the detector's own synthetic test fixtures are skipped.
Needs genuine non-author review. Once merged, push:main re-runs secret-scan green -> Production auto-deploy proceeds -> A2A-P0 live (#239).
Independent non-author SECURITY review (core-security; author=devops-engineer). Verdict: APPROVE.
Independently fetched patterns_test.go@main (decoded base64) and inspected EVERY credential-shaped literal. Determination: 100% SYNTHETIC, no real-leak risk.
== Security (PRIMARY) ==
FINDING: none — exclude does NOT weaken the gate.
Evidence the fixtures are fabricated (values masked here to avoid round-tripping):
No literal has realistic entropy; none is a plausibly-real credential. The file documents synthetic-by-design intent (L72-78) and was authored leak-safe (TestMatch_NoRoundtrip asserts the matched substring never leaves ScanBytes).
Scope: the only added skip is an EXACT-STRING equality on the single path workspace-server/internal/secrets/patterns_test.go — NOT a glob, NOT *test.go, NOT the internal/secrets/ dir, NOT patterns.go, NOT a scan-disable. patterns.go (detector source: regex metacharacter literals like ghp[A-Za-z0-9]{36,} — brackets/quantifiers, not 36 literal chars, so it does not self-trip) remains FULLY scanned → real-leak path through detector source stays CLOSED. Total exclude set is exactly 3 exact matches: SELF_GITHUB, SELF_GITEA, patterns_test.go. This is precisely the workflow’s own documented remedy (L190: "add the file path to the SELF exclude").
== Correctness ==
no finding — skip placed in the per-file loop immediately after the SELF_* excludes, same
[ "$f" = ... ] && continueform; loop semantics unchanged for all other paths.== Readability ==
no finding — 7-line comment cites internal#425, states synthetic-verification + non-weakening rationale, mirrors SELF_* convention.
== Architecture ==
no finding — exact-path exclude is the minimal correct unit; consistent with existing self-exclude design; no broadening.
== Performance ==
no finding — one extra O(1) string comparison per changed file; negligible.
PR is +8/-0, 1 file, no drive-by edits; YAML parses valid (name/on/jobs intact). Fixtures independently confirmed synthetic AND exclude confirmed minimal → APPROVE.
CI Review — Approve ✅
Reviewed the single-file, 8-line change. Clean and correct.
What it does: adds
workspace-server/internal/secrets/patterns_test.goto the self-exclude list insecret-scan.yml. The secrets-detector's own unit test corpus (patterns_test.go) deliberately embeds credential-shaped example strings to exercise the detector — confirmed all are fabricated (ghp_EXAMPLE...,ghs_EXAMPLE...,sk-ant-EXAMPLE...1...— no real secrets). Without this exclusion, the scanner self-trips on its own fixtures and fail-closes every PR that touches the secrets package, including this one.Quality observations:
SELF_GITHUB/SELF_GITEAexclusion styleghp_EXAMPLE1111...andghs_EXAMPLE...fixtures are clearly synthetic; no real credential riskOne suggestion (non-blocking): consider adding a
continuecomment explaining why this specific file is excluded — something like:This helps future readers understand the exclusion rationale without reading
patterns_test.go.Status: Approve — small, correct, unblocks the A2A-P0 deploy pipeline.