Skip to content

security(repo): enable secret scanning and push protection (#485) - #640

Open
michealross wants to merge 4 commits into
Sub-Rosa-Issue:mainfrom
michealross:security/485-enable-secret-scanning-push-protection
Open

michealross wants to merge 4 commits into
Sub-Rosa-Issue:mainfrom
michealross:security/485-enable-secret-scanning-push-protection

Conversation

@michealross

Copy link
Copy Markdown

Fixes #485

michealross and others added 4 commits October 21, 2026 23:54
…Issue#485)

GitHub's secret-protection features live in the repository settings, not in
the tree, so this change adds the in-repo half of the protection plus the
tooling that makes the settings verifiable and reproducible:

- .github/workflows/secret-scan.yml: gitleaks gate on pushes to main and on
  incoming pull requests. Pinned release verified against the published
  checksum, always run with --redact, and the SARIF result is uploaded to
  code scanning so findings show up in the Security tab.
- .gitleaks.toml: default gitleaks rules with a minimal allowlist for the
  values in this repo that look like credentials but are not (Stellar
  contract IDs, account IDs and SHA-256 hashes in fixtures, mainnet
  artifacts and demo traces). The allowlist pairs file paths with value
  shapes, so a real credential in those files does not match it and still
  fails the job.
- scripts/check-secret-protection.mjs: reads, and with --enable turns on,
  secret_scanning, secret_scanning_push_protection,
  secret_scanning_non_provider_patterns and secret_scanning_validity_checks
  through the GitHub API. It reports every protection and exits non-zero
  when a required one is off or not reported at all; optional protections
  the plan does not offer are reported as not available instead of failing.
- scripts/check-secret-protection.test.mjs: unit tests against a fake API
  server (enabled, disabled, unavailable, unreadable, enable flow).
- docs/SECRET_PROTECTION.md: the settings, how to enable and verify them,
  what each one covers for main and incoming pull requests, and how to
  review alerts without posting secret values.

The settings themselves need Administration: write on the repository, which
a contributor token does not have, so a maintainer runs `pnpm secrets:enable`
and then `pnpm secrets:check` to confirm the state.

The initial scan of the full history (402 commits) with these rules found no
credential: the only matches were generic-api-key hits on public, non-secret
values, all of them allowlisted in .gitleaks.toml. No rotation and no
history rewrite are needed, and no secret value is reproduced here.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.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.

security(high/easy): enable secret scanning and push protection

1 participant