Skip to content

Harden local secret preflight before patch upload - #98

Open
Spirizeon wants to merge 1 commit into
prooflinedev:mainfrom
Spirizeon:secret-detection-hardening
Open

Spirizeon wants to merge 1 commit into
prooflinedev:mainfrom
Spirizeon:secret-detection-hardening

Conversation

@Spirizeon

Copy link
Copy Markdown

What this changes

proofline review refuses secrets in local patches before any bytes leave the checkout. The existing check covered private-key markers, a handful of credential prefixes and .env paths. This adds the families that were passing through untouched, plus a conservative rule for secrets with no distinctive prefix.

  • New prefix families: GitLab (glpat-, glrt-, glptt-), npm, PyPI, SendGrid, Mailgun, DigitalOcean and Twilio (SK + hex).
  • Structured tokens: signed JWTs and Telegram bot tokens.
  • Generic assignment rule: credential-like names (api_key, client_secret, password, AWS_SECRET_ACCESS_KEY, ...) with a long, diverse value, for example a 40-character AWS secret access key. Placeholders, ${VAR}, URLs, public keys and checksums are excluded.
  • README.md now documents what the preflight catches and how --allow-path opts out.

Why

I wrote failing tests first: a glpat-... token and a JWT in an untracked file were uploaded with exit code 0. After the change, both are refused locally with no HTTP request and without echoing the secret into stderr.

Verification

  • cargo test --locked: 160 passed, 0 failed, 1 ignored (156 passed before the new tests)
  • cargo clippy --locked --all-targets -- -D warnings: clean
  • cargo fmt --check: clean

Scope and follow-ups

  • Only local patch uploads get this preflight; pushed commits, ranges, PRs and whole-repo scans send SHAs only, so detection there remains server-side.
  • Not included here: path-name detection beyond .env (for example .npmrc, id_rsa, service-account JSON). Happy to add that in a follow-up.

Add GitLab, npm, PyPI, SendGrid, Mailgun, DigitalOcean and Twilio credential shapes, JWT and Telegram bot tokens, and a conservative credential-assignment rule for prefix-less secrets such as AWS secret access keys. Document the check and cover the new families with unit and integration tests that assert no HTTP request is made.

This branch has not been deployed

No deployments
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