fix(ci): exclude secrets-detector test fixtures from secret-scan (unblocks A2A-P0 deploy) #1477

Merged
devops-engineer merged 1 commits from fix/secret-scan-exclude-secrets-detector-test-fixtures into main 2026-05-18 05:18:24 +00:00
Member

Root cause (verified, obs-first): push:main Secret scan / Scan diff for credential-shaped strings went RED on 5324e690 because internal#425 Phase-2a's workspace-server/internal/secrets/patterns_test.go contains synthetic credential-SHAPED fixtures (fabricated 43-char ghp_* — verified NOT real) to test the detector; the scan's own ghp_ 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).

**Root cause** (verified, obs-first): push:main `Secret scan / Scan diff for credential-shaped strings` went RED on 5324e690 because internal#425 Phase-2a's `workspace-server/internal/secrets/patterns_test.go` contains synthetic credential-SHAPED fixtures (fabricated 43-char `ghp_*` — verified NOT real) to test the detector; the scan's own `ghp_` 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).
devops-engineer added 1 commit 2026-05-18 05:04:51 +00:00
fix(ci): exclude secrets-detector test fixtures from secret-scan
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 5s
CI / Detect changes (pull_request) Successful in 10s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 11s
E2E API Smoke Test / detect-changes (pull_request) Successful in 6s
E2E Chat / detect-changes (pull_request) Successful in 6s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 11s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 8s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 1m7s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 1m30s
CI / Platform (Go) (pull_request) Successful in 3m29s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 10s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
gate-check-v3 / gate-check (pull_request) Successful in 6s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Successful in 1m18s
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request) Successful in 3s
qa-review / approved (pull_request) Failing after 6s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m2s
security-review / approved (pull_request) Successful in 5s
sop-tier-check / tier-check (pull_request) Successful in 4s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
E2E Chat / E2E Chat (pull_request) Successful in 3s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 1m25s
CI / Canvas (Next.js) (pull_request) Successful in 5m19s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / Python Lint & Test (pull_request) Successful in 6m37s
CI / all-required (pull_request) Successful in 6m41s
audit-force-merge / audit (pull_request) Successful in 8s
59113a8336
internal#425 Phase-2a added workspace-server/internal/secrets/
patterns_test.go, whose synthetic credential-shaped fixtures (verified
fabricated ghp_*, NOT real) are matched by the secret-scan's own ghp_
pattern. The scanner self-trips on the detector's test corpus, the
push:main Secret scan goes red, and Production auto-deploy fail-closes
— blocking the A2A-P0 promotion (#1450, already merged to main at
5324e690). This adds the fixture file to the same skip-list that
already self-excludes secret-scan.yml's regex literals. No gate
weakening: every other path is still fully scanned.

Unblocks: A2A-P0 production rollout (#239).
core-security approved these changes 2026-05-18 05:06:44 +00:00
core-security left a comment
Member

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):

  • ghp_/ghs_/gho_/ghu_/ghr_ (L84-88,159): literal "EXAMPLE" + a zero-entropy sequential digit run. Not a real PAT.
  • github_pat_, sk-ant-, sk-proj-, sk-svcacct-, sk-cp- (L89-93): programmatically built as "EXAMPLE"+strings.Repeat("1",N). Cannot be real.
  • xoxb-/xoxa- (L94-95): strings.Repeat("a",25) — 25 identical chars.
  • AKIA/ASIA (L97-98): trivial 1234567890ABCDEF sequence — not a real AWS key id.
  • Negative cases (L124-139): "tooshort"/"short" placeholders.
    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" = ... ] && continue form; 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.

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): - ghp_/ghs_/gho_/ghu_/ghr_ (L84-88,159): literal "EXAMPLE" + a zero-entropy sequential digit run. Not a real PAT. - github_pat_, sk-ant-, sk-proj-, sk-svcacct-, sk-cp- (L89-93): programmatically built as "<prefix>EXAMPLE"+strings.Repeat("1",N). Cannot be real. - xoxb-/xoxa- (L94-95): strings.Repeat("a",25) — 25 identical chars. - AKIA/ASIA (L97-98): trivial 1234567890ABCDEF sequence — not a real AWS key id. - Negative cases (L124-139): "tooshort"/"short" placeholders. 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" = ... ] && continue` form; 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.
Member

CI Review — Approve

Reviewed the single-file, 8-line change. Clean and correct.

What it does: adds workspace-server/internal/secrets/patterns_test.go to the self-exclude list in secret-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:

  • The exclusion is a single path, no glob pattern — precise, no weakening of coverage
  • Rationale comment inline matches the existing SELF_GITHUB/SELF_GITEA exclusion style
  • Comment correctly notes "gate NOT weakened" — all other paths still fully scanned
  • Consistent with the SELF exclude pattern already used for the workflow file itself
  • ghp_EXAMPLE1111... and ghs_EXAMPLE... fixtures are clearly synthetic; no real credential risk

One suggestion (non-blocking): consider adding a continue comment explaining why this specific file is excluded — something like:

[ "$f" = "workspace-server/internal/secrets/patterns_test.go" ] && continue  # unit test corpus: fabricated ghp_EXAMPLE fixtures, not real secrets

This helps future readers understand the exclusion rationale without reading patterns_test.go.

Status: Approve — small, correct, unblocks the A2A-P0 deploy pipeline.

## CI Review — Approve ✅ Reviewed the single-file, 8-line change. Clean and correct. **What it does:** adds `workspace-server/internal/secrets/patterns_test.go` to the self-exclude list in `secret-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:** - The exclusion is a single path, no glob pattern — precise, no weakening of coverage - Rationale comment inline matches the existing `SELF_GITHUB`/`SELF_GITEA` exclusion style - Comment correctly notes "gate NOT weakened" — all other paths still fully scanned - Consistent with the SELF exclude pattern already used for the workflow file itself - `ghp_EXAMPLE1111...` and `ghs_EXAMPLE...` fixtures are clearly synthetic; no real credential risk **One suggestion (non-blocking):** consider adding a `continue` comment explaining why this specific file is excluded — something like: ```sh [ "$f" = "workspace-server/internal/secrets/patterns_test.go" ] && continue # unit test corpus: fabricated ghp_EXAMPLE fixtures, not real secrets ``` This helps future readers understand the exclusion rationale without reading `patterns_test.go`. **Status: Approve** — small, correct, unblocks the A2A-P0 deploy pipeline.
devops-engineer merged commit b4427ac8a6 into main 2026-05-18 05:18:24 +00:00
Sign in to join this conversation.
No Reviewers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1477