ci: add a targeted -race step and gitleaks
70-race runs make race: test-gate.sh with GATE_RACE=1 deals edge, activator, rootaws, systemd and host's loop and lease tests onto shards under -race. internal/lease stays out until litestream reaches v0.5.18: v0.5.14's Store.Close races its own snapshot monitor. 80-gitleaks runs make gitleaks: v8.30.1 over the tracked working tree, not the history. .gitleaks.toml allows each committed fake by exact value. Path allowances name targetRules, because in dir mode a global path allowance skips the whole file whatever its condition says.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 files changed,
+394
−50
.amadan/README.md+48 −2.amadan/ci.d/70-race+37 −0.amadan/ci.d/80-gitleaks+25 −0.amadan/test-gate.sh+94 −47.gitleaks.toml+142 −0AGENTS.md+14 −0Makefile+34 −1
CI failed — run details
Intent
diff --git a/.amadan/README.md b/.amadan/README.md| index 9f559c4de..5015e920d 100644 |
| --- a/.amadan/README.md |
| +++ b/.amadan/README.md |
| @@ -33,9 +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 | |
| -Five checks have no ancestor; the deleted workflow never ran them. The |
| +Seven 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 on 2026-11-17. |
| +could not see them, and the code-health ratchet's two, the race detector |
| +and gitleaks on 2026-11-17. |
| | added | here | | |
| |---|---|---| |
| @@ -44,6 +45,8 @@ could not see them, and the code-health ratchet's two on 2026-11-17. |
| | `govulncheck` | `50-govulncheck` | `make govulncheck`: v1.8.0 over this module and `launchctx`; fails only on vulnerabilities the code calls, less the exceptions file; see below | |
| | 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, activator, 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 |
| @@ -112,6 +115,49 @@ lacks. It fetches main from `origin` (readable without credentials) and, |
| the first time on a workspace, unshallows the clone. Its header says |
| how it finds the base, and why it uses HEAD's parent on main. |
| +## `-race`: what it covers, and what it leaves out |
| + |
| +`70-race` runs `make race`, which is `.amadan/test-gate.sh` with |
| +`GATE_RACE=1`: the tests in `RACE_SPLIT`'s packages, with `-race`, |
| +dealt onto shards by `test-weights.tsv` and held by the same fence as |
| +`make test`, so a new test is covered without touching anything. The |
| +packages are the ones with real concurrency: every test of |
| +`internal/edge`, `internal/activator`, `internal/rootaws` and |
| +`internal/systemd`, and of `internal/host` the tests named for a loop or |
| +a lease (`RACE_ONLY`). The whole host suite under `-race` is far past |
| +the step's budget: measured once on docs-t1 (16 cores, `GOMAXPROCS=4`, |
| +the machine otherwise busy), every host shard ran past fifteen minutes. |
| +The seeded simulations run fewer seeds here (`LINKSIM_SEEDS`, |
| +`SWAP_SIM_SEEDS`); `make test` runs them at full breadth. It is its own |
| +step because `-race` compiles those packages again and runs their tests |
| +several times slower. |
| + |
| +Two packages are left out. The root package's e2e tests build the CLI |
| +many times over and are too slow under `-race`. `internal/lease` trips a |
| +race inside litestream v0.5.14: `Store.Close` closes the database while |
| +the store's own snapshot monitor is still reading it. Upstream fixed it |
| +in v0.5.18 (`Store.Close` now stops its monitors first); lease joins the |
| +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. 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/70-race b/.amadan/ci.d/70-race| new file mode 100755 |
| index 000000000..0b2b08809 |
| --- /dev/null |
| +++ b/.amadan/ci.d/70-race |
| @@ -0,0 +1,37 @@ |
| +#!/bin/sh |
| +# The race detector over the packages with real concurrency: the edge |
| +# (servers, pollers, the tunnel), the activator (wakes, reapers, sweeps), |
| +# the host agent's loops and lease handling, and the two packages those |
| +# loops call into for AWS and systemd, internal/rootaws and |
| +# internal/systemd. `make race` is the one definition; this step only |
| +# runs it, so a developer gets the same answer with the same command. |
| +# |
| +# The tests in those packages, with -race, dealt onto shards and fenced by |
| +# .amadan/test-gate.sh exactly as `make test` deals its own (GATE_RACE=1; |
| +# RACE_SPLIT in that file names the packages and how many shards each). |
| +# Every test of edge, activator, rootaws and systemd; of internal/host only |
| +# the tests named for a loop or a lease (RACE_ONLY), because its whole |
| +# suite under -race is far past this step's budget. |
| +# Its own step, not part of 10-gate: -race compiles the packages again and |
| +# runs their tests several times slower, and a red here is a race, which |
| +# should read as that. |
| +# |
| +# Left out, each for a reason: |
| +# - the root package: its e2e tests build the CLI many times over, too |
| +# slow under -race; |
| +# - internal/lease: litestream v0.5.14's Store.Close closes the database |
| +# while its own snapshot monitor still reads it (a race inside the |
| +# dependency, fixed upstream in v0.5.18, which stops the monitors |
| +# first). Every lease test that closes a store can trip it. Add lease |
| +# here with the bump. |
| +# |
| +# Red means a data race (WARNING: DATA RACE, then the test it was found |
| +# in), or a test that fails only under the detector's timing. A race in a |
| +# test helper is fixed in the helper; each of these packages has one |
| +# locked log capture (captureLog) for exactly that. |
| +# |
| +# -race needs cgo: CGO_ENABLED=1 and a C compiler on the runner. |
| +set -eu |
| +. .amadan/go-toolchain.sh |
| + |
| +make race |
diff --git a/.amadan/ci.d/80-gitleaks b/.amadan/ci.d/80-gitleaks| new file mode 100755 |
| index 000000000..834d0d691 |
| --- /dev/null |
| +++ b/.amadan/ci.d/80-gitleaks |
| @@ -0,0 +1,25 @@ |
| +#!/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/.amadan/test-gate.sh b/.amadan/test-gate.sh| index f3eb2b69b..66e60bdcb 100755 |
| --- a/.amadan/test-gate.sh |
| +++ b/.amadan/test-gate.sh |
| @@ -51,8 +51,40 @@ |
| # |
| # The last thing the gate prints is how much CPU its jobs used against |
| # how long it took, so a slow run says whether it was short of cores. |
| +# |
| +# RACE. GATE_RACE=1 is `make race` (.amadan/ci.d/70-race), not `make |
| +# test`: the race detector over RACE_SPLIT's packages and nothing else (no |
| +# vet, gofmt, launchctx, unsplit packages or cutover witnesses; `make |
| +# test` has those). Every test in those packages is dealt onto shards and |
| +# fenced exactly as above, with -race on the list and on every shard. |
| +# RACE_SPLIT overrides the packages and their shard counts the way |
| +# TEST_SPLIT does; TEST_SPLIT itself is ignored in this mode. RACE_ONLY |
| +# narrows a package to the listed tests whose names match a regex |
| +# ("dir=regex", no spaces); the fence then holds for those. -race needs |
| +# cgo, so CGO_ENABLED=1 is set here and the machine needs a C compiler. |
| set -eu |
| +race="" |
| +if [ "${GATE_RACE:-}" = 1 ]; then |
| + # The packages with real concurrency (.amadan/ci.d/70-race says why |
| + # these and not the rest), heaviest first like TEST_SPLIT. |
| + : "${RACE_SPLIT=./internal/edge=8 ./internal/activator=8 ./internal/host=2 ./internal/rootaws=1 ./internal/systemd=1}" |
| + # internal/host's whole suite under -race is far past the step's |
| + # budget (every shard ran past fifteen minutes on a 16-core box), so |
| + # only its loops and its lease handling: the tests named for them. |
| + : "${RACE_ONLY=./internal/host=Loop|Lease}" |
| + TEST_SPLIT=$RACE_SPLIT |
| + race=-race |
| + # The seeded simulations search for invariant breaks, which `make |
| + # test` does at full breadth. Here they only need to drive the |
| + # concurrent paths, and at full breadth under -race one link sim |
| + # alone ran past twelve minutes. A value already set is kept. |
| + : "${LINKSIM_SEEDS=50}" "${SWAP_SIM_SEEDS=20}" |
| + export LINKSIM_SEEDS SWAP_SIM_SEEDS |
| + CGO_ENABLED=1 |
| + export CGO_ENABLED |
| +fi |
| + |
| # Heaviest first: shards start in this order once their package's tests |
| # have compiled, and the packages that dominate the wall clock should not |
| # queue behind the others. |
| @@ -167,18 +199,21 @@ discover() { |
| return "$discover_rc" |
| } |
| -start launchctx sh -c 'cd launchctx && go vet ./... && go test ./... -count=1' |
| -start vet go vet ./... |
| -# The tagged tests: about 130 test files behind `linux && rootrunner` (the |
| -# root runner's fixtures, nearly all in internal/host) and the cutover |
| -# witnesses. Only the root runner and the cutover-witness job below ever |
| -# compiled them, so a refactor could break a root-runner test and stay |
| -# green. Its own job rather than tags on the line above, because one file, |
| -# internal/host/departure_queue_default.go, is `!rootrunner` and would |
| -# drop out of the plain vet. Nothing here runs those tests: they need |
| -# root. |
| -start vet-tags go vet -tags rootrunner,carlos_cutover_witness ./... |
| -start gofmt sh -c 'fmt_out=$(gofmt -l .); if [ -n "$fmt_out" ]; then echo "gofmt needed:"; echo "$fmt_out"; exit 1; fi; echo "gofmt -l .: clean"' |
| +# The rest of `make test`; `make race` is only the race shards. |
| +if [ -z "$race" ]; then |
| + start launchctx sh -c 'cd launchctx && go vet ./... && go test ./... -count=1' |
| + start vet go vet ./... |
| + # The tagged tests: about 130 test files behind `linux && rootrunner` (the |
| + # root runner's fixtures, nearly all in internal/host) and the cutover |
| + # witnesses. Only the root runner and the cutover-witness job below ever |
| + # compiled them, so a refactor could break a root-runner test and stay |
| + # green. Its own job rather than tags on the line above, because one file, |
| + # internal/host/departure_queue_default.go, is `!rootrunner` and would |
| + # drop out of the plain vet. Nothing here runs those tests: they need |
| + # root. |
| + start vet-tags go vet -tags rootrunner,carlos_cutover_witness ./... |
| + start gofmt sh -c 'fmt_out=$(gofmt -l .); if [ -n "$fmt_out" ]; then echo "gofmt needed:"; echo "$fmt_out"; exit 1; fi; echo "gofmt -l .: clean"' |
| +fi |
| # The split packages' test lists, all at once. `go test -list` compiles the |
| # test binary, which the shards then reuse from the build cache. One after |
| @@ -195,7 +230,7 @@ for spec in $TEST_SPLIT; do |
| ( |
| set +e |
| t0=$(date +%s) |
| - go test -count=1 -list '.*' "${spec%=*}" >"$out/list-$tag.raw" 2>&1 |
| + go test $race -count=1 -list '.*' "${spec%=*}" >"$out/list-$tag.raw" 2>&1 |
| echo $? >"$out/list-$tag.rc" |
| echo $(($(date +%s) - t0)) >"$out/list-$tag.secs" |
| ) & |
| @@ -203,40 +238,42 @@ for spec in $TEST_SPLIT; do |
| eval "list_pid_$tag=\$!" |
| done |
| -# Everything not split runs as one ordinary `go test`. Packages are named |
| -# by import path, so match TEST_SPLIT's directories through `go list`. |
| -split_paths="" |
| -for spec in $TEST_SPLIT; do |
| - discover go list "${spec%=*}" >"$out/go-list" |
| - split_paths="$split_paths $(cat "$out/go-list")" |
| -done |
| -# go list runs on its own, not in a pipeline: a pipeline's status is its |
| -# last command's, and a go list that failed halfway would hand on a short |
| -# package list with a zero status. Each go list goes through discover, and |
| -# set -e stops the gate on its status. |
| -discover go list ./... >"$out/go-list" |
| -all=$(cat "$out/go-list") |
| -if [ -z "$all" ]; then |
| - echo "go list ./... found no packages" >&2 |
| - exit 1 |
| -fi |
| -rest="" |
| -for p in $all; do |
| - case " $split_paths " in |
| - *" $p "*) ;; |
| - *) rest="$rest $p" ;; |
| - esac |
| -done |
| -# With no packages left, go test would test the current directory instead. |
| -if [ -n "$rest" ]; then |
| - # shellcheck disable=SC2086 # one word per package, on purpose |
| - start rest go test -count=1 -timeout 15m $rest |
| +if [ -z "$race" ]; then |
| + # Everything not split runs as one ordinary `go test`. Packages are named |
| + # by import path, so match TEST_SPLIT's directories through `go list`. |
| + split_paths="" |
| + for spec in $TEST_SPLIT; do |
| + discover go list "${spec%=*}" >"$out/go-list" |
| + split_paths="$split_paths $(cat "$out/go-list")" |
| + done |
| + # go list runs on its own, not in a pipeline: a pipeline's status is its |
| + # last command's, and a go list that failed halfway would hand on a short |
| + # package list with a zero status. Each go list goes through discover, and |
| + # set -e stops the gate on its status. |
| + discover go list ./... >"$out/go-list" |
| + all=$(cat "$out/go-list") |
| + if [ -z "$all" ]; then |
| + echo "go list ./... found no packages" >&2 |
| + exit 1 |
| + fi |
| + rest="" |
| + for p in $all; do |
| + case " $split_paths " in |
| + *" $p "*) ;; |
| + *) rest="$rest $p" ;; |
| + esac |
| + done |
| + # With no packages left, go test would test the current directory instead. |
| + if [ -n "$rest" ]; then |
| + # shellcheck disable=SC2086 # one word per package, on purpose |
| + start rest go test -count=1 -timeout 15m $rest |
| + fi |
| + # The fleet-run cutover witnesses (rootfs apps Plan 6 Task 16): the real CLI |
| + # against a fleet run queued across a lifetimes cutover. They and the console |
| + # controls they need are built only with this tag, which no other job and no |
| + # production build sets. |
| + start cutover-witness go test -count=1 -timeout 15m -tags carlos_cutover_witness -run '^TestQueuedFleetRunAtACutoverExpires' . |
| fi |
| -# The fleet-run cutover witnesses (rootfs apps Plan 6 Task 16): the real CLI |
| -# against a fleet run queued across a lifetimes cutover. They and the console |
| -# controls they need are built only with this tag, which no other job and no |
| -# production build sets. |
| -start cutover-witness go test -count=1 -timeout 15m -tags carlos_cutover_witness -run '^TestQueuedFleetRunAtACutoverExpires' . |
| # The split shards' -json, in weights mode only (see WEIGHTS above). |
| shard_json="" |
| @@ -264,6 +301,16 @@ deal_split() { |
| return |
| fi |
| grep -E '^(Test|Example|Fuzz)' "$out/list-$tag.raw" | sort -u >"$out/list-$tag" || true |
| + # RACE_ONLY's regex for this package, if it names one: only the tests |
| + # it matches are dealt. A regex that matches none is a failure below. |
| + set -f # a regex is not a glob |
| + for only in ${race:+${RACE_ONLY:-}}; do |
| + if [ "${only%%=*}" = "$dir" ]; then |
| + grep -E "${only#*=}" "$out/list-$tag" >"$out/list-$tag.only" || true |
| + mv "$out/list-$tag.only" "$out/list-$tag" |
| + fi |
| + done |
| + set +f |
| listed=$(wc -l <"$out/list-$tag") |
| if [ "$listed" -eq 0 ]; then |
| fail_job "$tag" "go test -list found no tests in $pkg, which is not believable" |
| @@ -296,7 +343,7 @@ deal_split() { |
| while [ "$i" -lt "$shards" ]; do |
| pattern=$(awk -v i="$i" -F '\t' '$1 == i { printf "%s%s", sep, $2; sep = "|" }' "$out/deal-$tag") |
| if [ -n "$pattern" ]; then |
| - start "$tag@$i" go test $shard_json -count=1 -timeout 15m -run "^($pattern)\$" "$dir" |
| + start "$tag@$i" go test $race $shard_json -count=1 -timeout 15m -run "^($pattern)\$" "$dir" |
| launched=$((launched + $(awk -v i="$i" -F '\t' '$1 == i' "$out/deal-$tag" | wc -l))) |
| fi |
| i=$((i + 1)) |
diff --git a/.gitleaks.toml b/.gitleaks.toml| new file mode 100644 |
| index 000000000..8f0f55e77 |
| --- /dev/null |
| +++ b/.gitleaks.toml |
| @@ -0,0 +1,142 @@ |
| +# 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. 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 |
| +# (internal/provision's *_census_test.go layers) and of the source files a |
| +# design checklist was written against. A hash of code that is itself in |
| +# this repository; generic-api-key matches it because the word before it |
| +# is "RecordKey", "recordKey" or a file name. Shorter than 64 too: |
| +# gitleaks reads a big file in chunks, and a digest a chunk boundary cuts |
| +# is reported as the part before the cut. |
| +[[allowlists]] |
| +description = "census and checklist source digests" |
| +targetRules = ["generic-api-key"] |
| +condition = "AND" |
| +paths = [ |
| + '''^internal/provision/[^/]+_census_test\.go$''', |
| + '''^implementation/always-awake-consumers\.json$''', |
| +] |
| +regexes = ['''^[0-9a-f]{10,64}$'''] |
| + |
| +# 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 digests the tests derive: 9f86d081... |
| +# is sha256("test"), fd61a03a... a second 64-hex 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 b2f7d5299..6c33b0680 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -295,6 +295,20 @@ anything. |
| anything. Imported-only and required-only findings are printed, not |
| fatal. It needs `vuln.go.dev` and the module proxy; `.amadan/README.md` |
| has the details. |
| +- `70-race` runs `make race`: every test in `internal/edge`, |
| + `internal/activator`, `internal/rootaws` and `internal/systemd`, and |
| + `internal/host`'s tests named for a loop or a lease, under `-race`, |
| + sharded by `.amadan/test-gate.sh` (`GATE_RACE=1`, `RACE_SPLIT`, |
| + `RACE_ONLY`). It needs cgo and a C compiler. A test |
| + in those packages that reads the standard log uses its package's |
| + `captureLog` (one locked buffer per package; host also has |
| + `captureLogBuffer`), never a plain `bytes.Buffer`, and a goroutine a |
| + test starts ends before the test does. `internal/lease` is out until |
| + litestream is at v0.5.18 or later (`.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; 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 5eda80ea5..d26949523 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 census-card census-propose code-health code-health-record console-mockup-kit parity-doc |
| +.PHONY: test build build-console fmt staticcheck govulncheck gitleaks 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,6 +99,39 @@ 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 |
| +# those packages (internal/host's loop and lease tests only), dealt onto |
| +# shards and fenced by .amadan/test-gate.sh exactly as `make test` deals |
| +# its own (GATE_RACE=1; RACE_SPLIT names the packages and shard counts, |
| +# RACE_ONLY narrows one). Needs cgo and a C compiler. |
| +race: |
| + GATE_RACE=1 .amadan/test-gate.sh |
| + |
| # Regenerates docs/console-mockup-kit/shell.html: a signed-in console page |
| # from the real templates with every stylesheet inlined and an empty |
| # <main> to draw a mockup in (docs/console-mockup-kit/README.md). |