Skip to content

Harness hardening: guards, upgrade protocol, and reproducible secret scan#69

Merged
joyzoursky merged 10 commits intomainfrom
harness/hardening-guards
Apr 17, 2026
Merged

Harness hardening: guards, upgrade protocol, and reproducible secret scan#69
joyzoursky merged 10 commits intomainfrom
harness/hardening-guards

Conversation

@joyzoursky
Copy link
Copy Markdown
Collaborator

Summary

  • Add new verify-time guards: hotspot LOC creep warning, lockfile CVE floor, overrides drift between root and apps/web, and a verify:explain failure attribution helper.
  • Document the dependency upgrade protocol and shared agent session rules, and link them from CLAUDE.md.
  • Make gitleaks reproducible locally: .gitleaks.toml excludes node_modules/build artifacts (local scan: ~12 min → ~1 s), .gitleaks-version pins the version for CI + Makefile, and make scan-secrets is wired into make verify and make bootstrap.
  • Fix the current Secret Scan CI failure by allowlisting a test-fixture key (sk-valid12345) with an inline // gitleaks:allow.

Test plan

  • CI Secret Scan job passes on this branch.
  • npm run verify and make verify both pass locally.
  • make bootstrap on a clean machine installs gitleaks (brew path).
  • make scan-secrets exits 0 with the new .gitleaks.toml.

🤖 Generated with Claude Code

joyzoursky and others added 10 commits April 17, 2026 19:10
Parses verify output and prints VERIFY_FAILURE block naming the
failing checker (e.g. quality:check-hotspots) so agents cannot
misattribute a failure to the wrong subsystem.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds a soft-warning band at 95% of the maxLines cap (855/900 default)
that compares each file's line count to origin/main and warns when
a PR adds lines to a file already in the band.

Upgrade to hard failure via --strict-creep flag or STRICT_HOTSPOT_CREEP=1.
Defaults stay warning-only so local dev is not blocked.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Parses package-lock.json and asserts minimum versions for packages
with known advisories (js-yaml >= 4.1.1, @modelcontextprotocol/sdk
>= 1.26.0) at every node_modules path, including nested transitive
copies.

Wired into verify after audit. Catches regressions that audit-ci's
advisory allowlist would otherwise mask.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Compares the overrides blocks in root and apps/web package.json.
Fails on value mismatches or on keys present in only one location
(unless allowlisted). Shared keys must agree; workspace-only or
root-only keys need explicit allowlist entries.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Documents reproducer-first npm override workflow, preferred override
shapes, and the lockfile CVE floor verification path. Codifies
anti-patterns from recent incidents (shotgun override editing,
lockfile surgery, verify failure dismissal).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Seven rules covering verify attribution, hotspot awareness, override
workflow, commit hygiene on broken base, force-push protocol,
destructive git operations, and minimal-diff completion. Each rule
cites the incident that created it.

Linked from CLAUDE.md; Codex should load this file before tasks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds task-routing rows for dependency security regressions and
verify failure attribution, lists agent-session-rules.md and
dependency-upgrade-protocol.md under Docs To Read First, and
documents verify:explain in Commands.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…o verify

- Add .gitleaks.toml excluding node_modules/build artifacts so local scans
  match CI (12min → ~1s on full checkout).
- Pin gitleaks version in .gitleaks-version, read by both CI and Makefile.
- Add `make scan-secrets` (+ `scan-secrets-ensure`) using the same flags
  as CI; fold into `make verify` and `make bootstrap`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- check-hotspot-loc: auto-fetch origin/main when absent (handles CI
  fetch-depth:1); warn loudly and stop creep detection if still missing.
  Also flag birth-creep for new files born in the creep band.
- check-overrides-drift: fail on stale allowlist entries (webOnly /
  rootOnly / valueDriftAllowed keys that no longer correspond to an
  override) so the allowlist doesn't rot silently.
- explain-verify-failure: raise spawnSync maxBuffer to 50MB so full tsc
  dumps don't truncate the last script header and break attribution;
  derive KNOWN_CHECKERS from apps/web/package.json scripts.verify so
  new checkers can't be forgotten; fall through to the raw script name
  when no friendly label is registered.
- Makefile scan-secrets-ensure: download the .gitleaks-version tarball
  (verified against the release checksum) and refuse to run when the
  installed gitleaks doesn't match the pin, so local scans no longer
  drift from CI via an unpinned brew install.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@joyzoursky joyzoursky merged commit f085c7a into main Apr 17, 2026
5 checks passed
@joyzoursky joyzoursky deleted the harness/hardening-guards branch April 17, 2026 11:37
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