Skip to content

ci: sweep leftover dead trufflehog job from consumer workflows - #525

Merged
hyperpolymath merged 2 commits into
mainfrom
fix/issue-507-remove-trufflehog
Jul 26, 2026
Merged

ci: sweep leftover dead trufflehog job from consumer workflows#525
hyperpolymath merged 2 commits into
mainfrom
fix/issue-507-remove-trufflehog

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Resolves #507

@hyperpolymath
hyperpolymath merged commit e8b2f4b into main Jul 26, 2026
15 of 17 checks passed
@hyperpolymath
hyperpolymath deleted the fix/issue-507-remove-trufflehog branch July 26, 2026 17:27
@sonarqubecloud

Copy link
Copy Markdown

hyperpolymath added a commit that referenced this pull request Jul 27, 2026
The a2ml/S4 secret-scanning scorecard required BOTH trufflesecurity/trufflehog
AND gitleaks in a2ml/.github/workflows/secret-scanner.yml. #525 deliberately
removed the redundant TruffleHog job estate-wide, so the check trufflehog grep
started failing — surfacing as "a2ml/S4: claimed PASS but check exited 1" in
build-scorecards --verify. That is the second, previously-masked failure in the
"Registry + topology in sync" job (masked on main because the registry-drift
step failed first). Updated S4 check/evidence/system to the post-#525 reality:
gitleaks + rust/shell secret jobs. Verified the new check holds and the
dashboard is current.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Jul 27, 2026
…e-TruffleHog a2ml/S4 scorecard (#525 fallout) (#531)

Greens the required **`Registry + topology in sync`** check, which has
been red on main and blocking every PR. That job had **two** failures —
the first masking the second:

**1. Registry drift (step 4).** `build-registry.sh --check` reported
`REGISTRY.a2ml is stale`. Regenerated from a clean clone of `main`: only
7 `source_hash` values updated to match the tree, no entries
added/removed, `TOPOLOGY.md` unchanged. This is the recurrence #381's
pre-commit guard is meant to prevent (it reached main without the hook).

**2. Stale scorecard `a2ml/S4` (step 6, previously masked).** Once the
registry step passes, `build-scorecards.sh --verify` runs and fails:
`a2ml/S4: claimed PASS but check exited 1`. The check still required
`trufflesecurity/trufflehog` in
`a2ml/.github/workflows/secret-scanner.yml`, but **#525 deliberately
removed TruffleHog estate-wide**. Updated S4's
`check`/`evidence`/`system` to the post-#525 reality (gitleaks +
rust/shell secret jobs).

Verified locally: `build-registry.sh --check` passes, the new S4 check
holds (gitleaks present), dashboard is current. (`--verify`'s full run
needs ripgrep/xmllint/jq — the env-preflight guard correctly declines to
judge without them; CI has them.)

Follow-up (#381 option 2): a CI job that auto-regenerates + commits the
registry on drift would stop this reaching main again.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Jul 27, 2026
Phase 3 (preventive) of the secret-scanner programme. Two gaps, **one
shape**.

## 1. The secret scanner had no canary

Every defect found in the 201-repo sweep was invisible in CI, because
**a gate that cannot fail is indistinguishable from a gate that
passes**:

| Defect | Consequence |
|---|---|
| `continue-on-error: true` on gitleaks | scan found a **live Cloudflare
Global API Key in a PUBLIC repo** and reported success anyway — for
months, across ~200 repos |
| `rust-secrets` grepped `./src` only | Cargo workspaces keep code in
`crates/*/src`; `grep` exits 2 on a missing dir and the `if` read that
as *clean*. **8 of 64 Rust repos (12.5%) never scanned at all** |
| `const.*KEY.*=` missed `static AUTH_KEY` | found **only** because a
canary planted 5 secrets and the job reported 4 |

`tests/test_secret_scanner_canary.sh` plants known secrets and asserts
the scanner still trips — **9 assertions**:

```
PASS  5 planted secrets in ./src -> BLOCKS
PASS  all 5 planted secrets reported (not just the first)
PASS  secret in crates/*/src -> BLOCKS after cutoff (no root ./src)
PASS  secret in crates/*/src -> advisory before cutoff
PASS  advisory run reports the finding and never claims a clean pass
PASS  env::var / URL / lookup / path / comment / pragma -> ALLOWED
PASS  literal secret + later env::var mention -> STILL BLOCKS
PASS  malformed cutoff -> REFUSES TO RUN
PASS  no Cargo.toml -> skips cleanly
```

Note assertion 2 counts findings rather than checking the exit code.
**The `static AUTH_KEY` defect passed an exit-code assertion** — exit 1
only proves ≥1 was found, not that all were.

It **extracts the step body from `secret-scanner-reusable.yml` at run
time** and executes it. Not a copy: a copy silently drifts from what
ships, which is how these defects survived review.

### Mutation tested

A canary that cannot fail would be the very thing it guards against.
Reintroducing each historical defect **kills** it:

| Mutant | Result |
|---|---|
| `./src`-only scan | ✓ killed |
| drop `static` from the KEY pattern | ✓ killed |
| make the job unable to fail | ✓ killed |
| over-broad `env::var` exemption | ✓ killed |
| disarm the date guard | ✓ killed |

**5/5.**

## 2. `tests/` was wired into no workflow

`tests/test_check_trusted_base.sh` has existed for some time and **never
executed in CI** — the same shape a third time: a test that never runs
looks exactly like a test that passes.

`self-test.yml` runs every `tests/*.sh`, so adding a test is now
sufficient to have it enforced. **Fail-closed**: empty discovery fails
the job rather than reporting a vacuous pass.

## Also: registry regeneration

7 stale `source_hash` entries accumulated from #522/#525 plus these new
files.

⚠️ **This is the fourth registry-drift repair today.** The drift keeps
reaching `main` because `Registry + topology in sync` is **not a
required status check**, while a phantom `Dependabot` context forces
`--admin` on every merge — which bypasses all protection including the
check that correctly failed on the PR. That ruleset fix is owner-only
and tracked separately; **without it this repair will be needed again.**

## Verified

- both test files pass locally (2/2)
- canary 9/9 against the shipping reusable
- 5/5 mutants killed
- `scripts/build-registry.sh --check` exits 0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

secret-scanner: sweep leftover dead trufflehog: job from consumer workflows (post-#500 remainder)

1 participant