ci: split gitleaks out of the race-helpers branch
Paul's decision: the allowlist needs its own branch. Review twice found that census-shaped lines could still hide a credential, so this removes the 80-gitleaks step, the make target, .gitleaks.toml and their docs. The -race step, the log capture work, the test fixes and the lowered code-health record are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+4
−236
.amadan/README.md+3 −22.amadan/ci.d/80-gitleaks+0 −25.gitleaks.toml+0 −160AGENTS.md+0 −5Makefile+1 −24
CI passed — run details
Intent
diff --git a/.amadan/README.md b/.amadan/README.md| index 4409aa995..622b31f8a 100644 |
| --- a/.amadan/README.md |
| +++ b/.amadan/README.md |
| @@ -33,10 +33,10 @@ no longer exists. |
| | `minio-contract` | `30-minio-contract` | MinIO on loopback, no container | |
| | `gofmt` | `10-gate` | repo-wide, via `make test` — see below | |
| -Seven checks have no ancestor; the deleted workflow never ran them. The |
| +Six checks have no ancestor; the deleted workflow never ran them. The |
| first three were added on 2026-11-16 after a code audit found the gate |
| -could not see them, and the code-health ratchet's two, the race detector |
| -and gitleaks on 2026-11-17. |
| +could not see them, and the code-health ratchet's two and the race |
| +detector on 2026-11-17. |
| | added | here | | |
| |---|---|---| |
| @@ -46,7 +46,6 @@ and gitleaks on 2026-11-17. |
| | code-health gate | `60-code-health` | `make code-health`: the code against `.amadan/code-health.tsv`, scanned with type information; see below | |
| | code-health record | `61-code-health-record` | the record against the merge base's copy; see below | |
| | race detector | `70-race` | `make race`: `go test -race` over the edge, rootaws and systemd packages and host's loop and lease tests, sharded like the gate; see below | |
| -| `gitleaks` | `80-gitleaks` | `make gitleaks`: v8.30.1 over the working tree's tracked files, less the values `.gitleaks.toml` allows; see below | |
| ## `govulncheck`: what turns it red |
| @@ -148,24 +147,6 @@ step with that bump. |
| `-race` needs cgo, so the target sets `CGO_ENABLED=1`, and the runner |
| needs a C compiler. |
| -## `gitleaks`: what turns it red |
| - |
| -`80-gitleaks` runs `make gitleaks`: gitleaks v8.30.1 (rastrillo's pin) |
| -with its default rules over the tracked files of the working tree, copied |
| -out with `git archive` so untracked scratch is never scanned. It reads no |
| -history: what a branch adds is found in the run that adds it, and old |
| -values in the history would otherwise hold every branch red. |
| - |
| -A finding fails the step. Remove the value, and rotate it if it was ever |
| -real. A fake a test needs, or something that is not a value at all, is |
| -allowed in `.gitleaks.toml` by its exact value, scoped to the files it |
| -belongs in where that matters, with the reason beside it. Source digests |
| -are the one exception: they pass only where the whole line is a digest |
| -entry, in the files that hold them. One trap is |
| -written at the top of that file: in `gitleaks dir`, an allowance that |
| -names `paths` without `targetRules` skips those files entirely, whatever |
| -its condition says. |
| - |
| ## `gofmt`: ported by widening it, not by reproducing it |
| This section is the reason it was safe to delete the workflow, so it is |
diff --git a/.amadan/ci.d/80-gitleaks b/.amadan/ci.d/80-gitleaks| deleted file mode 100755 |
| index 834d0d691..000000000 |
| --- a/.amadan/ci.d/80-gitleaks |
| +++ /dev/null |
| @@ -1,25 +0,0 @@ |
| -#!/bin/sh |
| -# Secrets committed to the tree: gitleaks v8.30.1, pinned, with its |
| -# default rules, over the working tree's tracked files. `make gitleaks` is |
| -# the one definition; this step only runs it, so a developer gets the same |
| -# answer with the same command. |
| -# |
| -# Its own step, not part of `make test`, for staticcheck's reasons: a red |
| -# here is a finding, not a failed test, and `make test` stays no slower. |
| -# |
| -# The tree, not the history: what a branch adds is found in the run that |
| -# adds it, and the history's old values would hold every branch red. |
| -# |
| -# Red means a value gitleaks takes for a secret. Remove it (and rotate it, |
| -# if it was ever real). If it is a fake a test needs, or not a value at |
| -# all, allow exactly that value in .gitleaks.toml, in the group that fits, |
| -# with the reason; that file's header says how to scope one. The log |
| -# redacts what it finds: run `make gitleaks` locally to see the file and |
| -# line. |
| -# |
| -# Network: the Go module proxy, to fetch gitleaks, as every step already |
| -# uses. |
| -set -eu |
| -. .amadan/go-toolchain.sh |
| - |
| -make gitleaks |
diff --git a/.gitleaks.toml b/.gitleaks.toml| deleted file mode 100644 |
| index 60d996b34..000000000 |
| --- a/.gitleaks.toml |
| +++ /dev/null |
| @@ -1,160 +0,0 @@ |
| -# gitleaks' default rules, less the values this repository commits on |
| -# purpose. `make gitleaks` (.amadan/ci.d/80-gitleaks) scans the working |
| -# tree's tracked files with it; the Makefile says why not the history. |
| -# |
| -# Every allowance names its values, anchored, so a value that merely |
| -# contains one is still found; only the source digests go by their shape: |
| -# the whole line must be a digest entry, in the files that hold them. Where a value only belongs in some files, |
| -# the allowance is scoped to them (condition AND: a path and a value), so |
| -# the same value anywhere else still fails the gate. Nothing is allowed by |
| -# fingerprint in .gitleaksignore: a fingerprint names a commit, and this |
| -# scan reads no commits. |
| -# |
| -# AN ALLOWANCE WITH `paths` MUST NAME `targetRules`. In `gitleaks dir` |
| -# (v8.30.1), a global allowance's paths skip the whole file before it is |
| -# read, whatever its condition says: an AND of a path and a value allowed |
| -# every secret in every file the path matched. One with targetRules is |
| -# moved onto those rules, where the AND holds and the rest of the file is |
| -# still scanned. |
| -# |
| -# A new finding is fixed, not allowed, unless it is a value that has to be |
| -# committed. Then add it here, in the group that fits, with its reason. |
| -[extend] |
| -useDefault = true |
| - |
| -# sha256 digests the census pins: of a function's source, in |
| -# internal/provision's *_census_test.go layers. A hash of code that is |
| -# itself in this repository; generic-api-key matches it because the field |
| -# before it names a record key. Matched against the whole line, so only a |
| -# complete census entry passes: a hex credential on any other line of these |
| -# files, an `api_key = "..."` above all, is still found. |
| -# |
| -# The second pattern is the same entry cut short. gitleaks reads a big file |
| -# in chunks, and in plan9_b8_census_test.go one boundary falls inside a |
| -# digest. For a finding on a chunk's unterminated last line, gitleaks hands |
| -# over the whole chunk as the "line", so this pattern holds only the chunk's |
| -# last line to the entry's shape. Older layers are frozen, so that boundary |
| -# does not move. |
| -[[allowlists]] |
| -description = "census entries' source digests" |
| -targetRules = ["generic-api-key"] |
| -condition = "AND" |
| -regexTarget = "line" |
| -paths = ['''^internal/provision/[^/]+_census_test\.go$'''] |
| -regexes = [ |
| - '''^\s*(?:censusEntry)?\{"[A-Za-z0-9_./-]+\.go", "[^"\n]+", "[a-z-]+", "(?:key|sel):[A-Za-z]+(?:,(?:key|sel):[A-Za-z]+)*", "[0-9a-f]{64}"\},\s*$''', |
| - '''\n[ \t]*(?:censusEntry)?\{"[A-Za-z0-9_./-]+\.go", "[^"\n]+", "[a-z-]+", "(?:key|sel):[A-Za-z]+(?:,(?:key|sel):[A-Za-z]+)*", "[0-9a-f]{10,63}$''', |
| -] |
| - |
| -# The same digests in a design checklist's source_hashes: a Go file's path, |
| -# then the sha256 of that file. Whole line again, for the same reason. |
| -[[allowlists]] |
| -description = "design checklist's source digests" |
| -targetRules = ["generic-api-key"] |
| -condition = "AND" |
| -regexTarget = "line" |
| -paths = ['''^implementation/always-awake-consumers\.json$'''] |
| -regexes = ['''^\s*"[A-Za-z0-9_./-]+\.go": "[0-9a-f]{64}",?\s*$'''] |
| - |
| -# Fake credentials typed into tests, each recognisable as one: a counting |
| -# run (0123456789abcdef), a word (SecretValue, SENTINEL, nope), a test's |
| -# own label. The Stripe keys exist to test that the console tells a live |
| -# key from a test key and a restricted key from a secret one, so they must |
| -# keep Stripe's prefixes. Three are 64-hex values: 9f86d081... is |
| -# sha256("test"), fd61a03a... a second stand-in for an HMAC, and |
| -# c7aff5eb... the callback signature key derived from the golden vector's |
| -# fixed master, "master-fixed-for-the-vector". Test files only: the same |
| -# value in production code is still found. |
| -[[allowlists]] |
| -description = "fake credentials in tests" |
| -targetRules = ["generic-api-key", "stripe-access-token"] |
| -condition = "AND" |
| -paths = ['''_test\.go$'''] |
| -regexes = [ |
| - '''^rk_test_51SecretValue$''', |
| - '''^rk_live_51SecretValue$''', |
| - '''^sk_test_51SecretValue$''', |
| - '''^rk_live_51AbCdEfGhIjKlMnOpQrStUv$''', |
| - '''^tok-flagship-2$''', |
| - '''^tok-second-64hex$''', |
| - '''^tok_SECRET_123$''', |
| - '''^tok-0123456789abcdef0123456789abcdef$''', |
| - '''^SES_SECRET=s3kr1t$''', |
| - '''^SECRET-SENTINEL-7f3a$''', |
| - '''^cdk1\.bab\.titogo\.0123456789abcdef\.$''', |
| - '''^cdk1\.bae\.titogo\.nope$''', |
| - '''^carlos-0123456789abcdef0123456789abcdef-1$''', |
| - '''^0123456789abcdef0123456789abcdef$''', |
| - '''^0123456789abcdefghij0123456789abcdefghijkl$''', |
| - '''^3f9a0c1d2e4b5a6978877665544332211$''', |
| - '''^AbCd12_EfGh34_IjKl56_MnOp78$''', |
| - '''^ba9876543210$''', |
| - '''^PLAN14_E45_CONTAINED$''', |
| - '''^apps/bab/other/instances/$''', |
| - '''^9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08$''', |
| - '''^fd61a03af4f77d870fc21e05e7e80678095c92d808cfb3b5c279ee04c74aca13$''', |
| - '''^c7aff5eb65835639b68c63a226767768ac2049fe0b57ab83844691ae5cca1d17$''', |
| -] |
| - |
| -# The fake instance key the instance-key tests and their plans share |
| -# (note its tail, ...bC6dF5gH0iJ1kA=: typed, not generated). Allowed in |
| -# tests and docs alike, because the plans quote the tests. |
| -[[allowlists]] |
| -description = "fake instance key shared by tests and plans" |
| -regexes = ['''^q\+/Zk3vJ0aW1Yx9sR7tUe2oPl4mN8bC6dF5gH0iJ1kA=$'''] |
| - |
| -# RFC 6455's sample Sec-WebSocket-Key ("the sample nonce", base64), the |
| -# one every WebSocket handshake test and its spec quotes. A nonce is not a |
| -# secret even when it is not the RFC's. |
| -[[allowlists]] |
| -description = "RFC 6455 sample WebSocket key" |
| -regexes = ['''^dGhlIHNhbXBsZSBub25jZQ==$'''] |
| - |
| -# Committed fixtures. configseal_vectors.json is the cross-language |
| -# vector set sealed by configseal.js and opened by Go; its key is a |
| -# throwaway minted for the vectors and protects nothing (the file says so, |
| -# in the key's own name). lookup.json is a recorded registrar response |
| -# with its domain auth code replaced by a counting run. Each value in its |
| -# own file only. |
| -[[allowlists]] |
| -description = "configseal test-only vector key" |
| -targetRules = ["generic-api-key"] |
| -condition = "AND" |
| -paths = ['''^internal/console/testdata/configseal_vectors\.json$'''] |
| -regexes = ['''^xKbVxY32zPtWRkhfwugpfIdsamLLebvaWKnV9WLWQ48=$'''] |
| - |
| -[[allowlists]] |
| -description = "registrar fixture's placeholder auth code" |
| -targetRules = ["generic-api-key"] |
| -condition = "AND" |
| -paths = ['''^internal/registrar/openprovider/testdata/lookup\.json$'''] |
| -regexes = ['''^1a2b3c4d5e6f$'''] |
| - |
| -# The password 30-minio-contract gives a user of the MinIO it starts on |
| -# loopback for one job and then deletes; the plan that wrote the step |
| -# quotes it. |
| -[[allowlists]] |
| -description = "throwaway MinIO user in the contract step" |
| -targetRules = ["generic-api-key"] |
| -condition = "AND" |
| -paths = [ |
| - '''^\.amadan/ci\.d/30-minio-contract$''', |
| - '''^docs/superpowers/plans/2026-10-22-db-region-forward-plan-2-query\.md$''', |
| -] |
| -regexes = ['''^dbfukboxsecret1$'''] |
| - |
| -# Not values at all: generic-api-key matching the word after "key" in code |
| -# comments and prose (a function name, a header, a review's heading, a |
| -# CLI flag in a list of flags, an env line in a README), and a bucket name |
| -# whose number is an AWS account ID, which identifies and does not |
| -# authenticate. |
| -[[allowlists]] |
| -description = "prose and code the generic rule reads as a key" |
| -regexes = [ |
| - '''^ed25519\.Verify$''', |
| - '''^if-none-match=$''', |
| - '''^retry/duplicate$''', |
| - '''^CARLOS_REGION=ie$''', |
| - '''^--enable-primary-ipv6$''', |
| - '''^carlos-flagship-271376211898$''', |
| -] |
diff --git a/AGENTS.md b/AGENTS.md| index 1576002be..94cd29d99 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -304,11 +304,6 @@ anything. |
| `captureLogBuffer`), never a plain `bytes.Buffer`, and a goroutine a |
| test starts ends before the test does. `internal/activator` and |
| `internal/lease` are out for now (`.amadan/README.md` says why). |
| -- `80-gitleaks` runs `make gitleaks` (v8.30.1, pinned) over the working |
| - tree's tracked files, not the history. A committed fake (a test key, a |
| - fixture) is allowed in `.gitleaks.toml` by its exact value, with the |
| - reason (the census's source digests by their shape, in their own |
| - files); never by a bare path (that file's header says why). |
| - `20-cross@5` adds `GOOS=darwin`/`windows`/`linux-arm64` compiles, one |
| per shard. **The gate is not Linux-only**: `internal/host` is linked |
| into the CLI, which people run on Macs, so a Linux-only type assumption |
diff --git a/Makefile b/Makefile| index d26949523..8eeb2c8f4 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -7,7 +7,7 @@ LDFLAGS := -s -w -X github.com/carlosframework/platform/internal/version.Build=$ |
| GOOS ?= |
| GOARCH ?= |
| -.PHONY: test build build-console fmt staticcheck govulncheck gitleaks race census-card census-propose code-health code-health-record console-mockup-kit parity-doc |
| +.PHONY: test build build-console fmt staticcheck govulncheck race census-card census-propose code-health code-health-record console-mockup-kit parity-doc |
| # The build gate: vet, format, tests. `.amadan/ci.d/10-gate` runs this same |
| # target, so what CI checks and what you check are one definition. |
| @@ -99,29 +99,6 @@ govulncheck: |
| (cd launchctx && go run $(GOVULNCHECK) -format json ./...) >"$$dir/launchctx.json" && \ |
| go run ./scripts/govulncheck-gate -exceptions .amadan/govulncheck-exceptions.tsv "$$dir/platform.json" "$$dir/launchctx.json" |
| -# Secrets committed to the tree, as CI checks them |
| -# (.amadan/ci.d/80-gitleaks): gitleaks v8.30.1, pinned, the version |
| -# rastrillo runs, and fetched with `go run pkg@version` for staticcheck's |
| -# reason (no tool line in go.mod). Its default rules, less the values |
| -# .gitleaks.toml allows, each with its reason. |
| -# |
| -# The working tree's tracked files, not the history: what a branch adds |
| -# is found in the run that adds it, and the history's old values, already |
| -# in every clone, would otherwise hold every branch red. `git stash |
| -# create` names the tracked files as they are now, uncommitted edits |
| -# included (empty on a clean tree, which is HEAD), without touching the |
| -# index or the tree; untracked files are not scanned until they are added. |
| -# git archive copies that into a scratch directory, so a developer's |
| -# untracked scratch never fails it and CI and a laptop scan the same |
| -# files. -v prints each finding (rule, file, line) and --redact keeps its |
| -# value out of the log. |
| -GITLEAKS := github.com/zricethezav/gitleaks/v8@v8.30.1 |
| -gitleaks: |
| - @dir=$$(mktemp -d) || exit 1; trap 'rm -rf "$$dir"' EXIT; \ |
| - tree=$$(git -c user.name='make gitleaks' -c user.email=gitleaks@localhost stash create) && \ |
| - git archive "$${tree:-HEAD}" | tar -xf - -C "$$dir" && \ |
| - cd "$$dir" && go run $(GITLEAKS) dir --no-banner --no-color --redact -v -c "$(CURDIR)/.gitleaks.toml" . |
| - |
| # The race detector over the packages with real concurrency, as CI runs it |
| # (.amadan/ci.d/70-race). Not part of `make test`: -race compiles every |
| # package again and runs its tests several times slower. The tests in |