GitHub push protection blocks a push: `GH013: Repository rule violations found ... Push cannot contain secrets` for a revoked key
BeginnerTroubleshootingSAST, SCA and secrets scanning in CI
Answer
Likely causes → Push protection pattern-matches known provider token formats; it does not know the key is revoked.
Diagnose → The push output links to the blocked secret and commit SHA.
Fix → Remove the secret from the commits (git rebase -i, amend, push again). Only use the "allow secret" link if it is truly a test value and justify it; bypasses are audited.
Prevent → Keep tokens out of code entirely; load from env or a secrets manager even in tests.
More on SAST, SCA and secrets scanning in CI
gitleaks fails the PR on `tests/fixtures/fake_rsa.pem` and `testdata/aws_creds.json`, which only contain dummy valuesBeginnergitleaks passes locally but the CI job reports 40 old leaks nobody touched in this PRIntermediate`fatal: ambiguous argument 'origin/main..HEAD': unknown revision` in the secrets-scan stepBeginnerSemgrep flags `subprocess.run(cmd, shell=True)` in a script where `cmd` is a hard-coded constantBeginnerSemgrep in CI reports findings in `node_modules/`, `vendor/` and minified `dist/*.js`BeginnerSemgrep job takes 35 minutes and gets killed with `exit code 137`Intermediate