Skip to content

fix(ci): the secret scan skips templ's generated Go - #146

Merged
jayleaton merged 1 commit into
mainfrom
fix/secret-scan-skip-generated-templ
Oct 31, 2026
Merged

jayleaton merged 1 commit into
mainfrom
fix/secret-scan-skip-generated-templ

Conversation

@jayleaton

@jayleaton jayleaton commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Rules. Before merge, run what this change needs on its exact head (docs/CI.md, "What to run"): for Go, make lint test scoped with LINT_DIRS/TEST_PKGS (scripts/affected.sh prints them) or make check-fast, plus the checks of what you touched. Then make ci-local RAN="<what you ran>" posts local-ci and fills "Local verification" with that statement and the head SHA. Never edit that section by hand. The Local verification check, make pr-merge and the staging gate refuse the PR while it is missing, names another head, or differs from what local-ci attested. A new push or rebase needs a new attestation. A reported failure (FAILED=) is final for that head: fix it in a new commit (docs/CI.md, "Local verification").

Problem

A full-tree secret scan (make secret-scan ARGS=--all, which make nightly runs) fails on generated templ code. In sparkrack, apiclient.BuybackQuoted: followed by templ_7745c5c3_Err reads to gitleaks' generic-api-key rule as a key.

Fix

  • The scan skips x_templ.go when x.templ sits beside it (verify.GeneratedTempl), in every mode: checkout, named files, --all, and a PR head read as data.
  • The .templ file stays scanned. A _templ.go with no source beside it is scanned like any other file, and make check-generated fails one that templ did not generate.
  • .gitleaks.toml is unchanged.
  • Proof: I planted a Stripe key in apps/admin/ui/pages_auth.templ and its _templ.go. The scan reported it in the .templ (named files and --all). Given only the _templ.go, it scanned nothing. With the plant removed, --all is clean.

Local verification

Filled by make ci-local, 2026-10-31T18:08:07Z. Never edit this section by hand.

Head 18c101a4dc98399515881b32309880e34e3e37e8 · tree 3877671025b5 · passed
Attested by JJ Eaton on MacBook-Pro-3.local

Ran: Rebased onto 3d558d6 (#145). make ci passed on this change before the rebase (4 vCPU Davit box); on this exact head: go build ./..., go vet ./..., go test ./scripts/cilocal/..., golangci-lint ./scripts/cilocal/..., make secret-scan ARGS=--all (465 files, no leaks), pre-push make check-fast; the planted-key proof (reported in the .templ, generated Go skipped). Same change merged in sparkrack as #56.

🤖 Generated with Claude Code

A full-tree scan (make secret-scan ARGS=--all, which make nightly runs)
fails on generated templ code: "apiclient.BuybackQuoted:" followed by
"templ_7745c5c3_Err" reads to gitleaks' generic-api-key rule as a key
(sparkrack apps/web/ui/pages_buyback_templ.go). The scan now skips
x_templ.go when x.templ sits beside it (verify.GeneratedTempl), in every
mode: the checkout, named files, --all and a PR head read as data. The
.templ stays scanned; a _templ.go with no source is scanned like any file.

Proof: a Stripe key planted in apps/admin/ui/pages_auth.templ and its
_templ.go is reported in the .templ (named files and --all); the
_templ.go alone is skipped; with the plant removed, --all is clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jayleaton
jayleaton force-pushed the fix/secret-scan-skip-generated-templ branch from 29ef241 to 18c101a Compare October 31, 2026 18:08
@jayleaton
jayleaton merged commit 4f55593 into main Oct 31, 2026
3 checks passed
@jayleaton

Copy link
Copy Markdown
Owner Author

Authorized by JJ, merged by Claude (Opus 5.5, Doug) with --admin after make ci-local attested 18c101a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant