GitHub Secret Scanning for SOC 2: How to Enable It and Collect Evidence
How to enable GitHub secret scanning, configure push protection, and collect the evidence auditors need to satisfy SOC 2 CC6 and CC8 controls — including the exact check SecureSpect runs automatically.
What Is GitHub Secret Scanning?
GitHub secret scanning automatically detects credentials, API keys, tokens, and other secrets that get accidentally committed to a repository. When a match is found, GitHub alerts the repository administrator and — with push protection enabled — blocks the commit before it reaches the remote.
For SOC 2 purposes, secret scanning is a direct control for CC6.1 (Logical and Physical Access Controls) and CC8.1 (Change Management). Auditors expect you to demonstrate that credentials cannot enter your codebase undetected.
How to Enable Secret Scanning in GitHub
Secret scanning is available on all GitHub Advanced Security plans and free for public repositories.
Step 1: Enable at the repository level
Step 2: Enable at the organization level (recommended)
For consistent SOC 2 coverage across all repositories, enable secret scanning organization-wide:
Step 3: Verify using the GitHub API
# Check secret scanning status for a repository
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/YOUR-ORG/YOUR-REPO/security/secret-scanning
# List all alerts (open secrets detected)
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/YOUR-ORG/YOUR-REPO/secret-scanning/alerts
What GitHub Scans For
GitHub maintains a [partner program](https://docs.github.com/en/code-security/secret-scanning/secret-scanning-patterns) of over 200 token patterns including:
- AWS access key IDs and secrets
- GitHub personal access tokens and OAuth tokens
- Google API keys and service account credentials
- Stripe, Twilio, Slack, and other SaaS API keys
- Private SSH keys, database connection strings, and JWT secrets
You can also define custom patterns using regex to catch internal tokens or secrets specific to your stack.
Push Protection: The Stronger Control
Secret scanning without push protection is a detection control — it tells you after a secret was committed. Push protection is a prevention control — it blocks the commit entirely.
For SOC 2 CC8.1 (Change Management), prevention is stronger than detection. If your auditor asks "what prevents a developer from committing a credential?", push protection gives you a concrete answer.
To enable push protection via the API:
curl -X PATCH \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/YOUR-ORG/YOUR-REPO \
-d '{"security_and_analysis": {"secret_scanning_push_protection": {"status": "enabled"}}}'
What Auditors Look For
SOC 2 auditors testing your GitHub environment will typically request:
Common audit findings:
- Secret scanning enabled on some repositories but not all
- Push protection disabled (detection-only, not prevention)
- Open secret scanning alerts with no remediation record
- Secret scanning enabled but no documented process for handling alerts
GitHub SOC 2 Compliance: The Full Picture
Secret scanning is one of several GitHub controls SOC 2 auditors test. The full GitHub control surface for SOC 2 includes:
| Control | SOC 2 Criteria | GitHub Setting |
| Secret scanning | CC6.1, CC8.1 | Security → Secret scanning |
| Push protection | CC8.1 | Security → Push protection |
| Branch protection | CC8.1 | Settings → Branches |
| Required PR reviews | CC8.1 | Branch protection rules |
| Signed commits | CC8.1 | Branch protection → Require signed commits |
| Dependency alerts | CC7.1 | Security → Dependabot alerts |
| Actions workflow approval | CC8.1 | Settings → Actions → Fork pull request approval |
Automating Secret Scanning Evidence Collection
Manual evidence collection — downloading screenshots of the secret scanning settings page every audit cycle — is error-prone and time-consuming.
SecureSpect runs a continuous check (github.actions.secret_scanning) against your connected GitHub organization. The check:
- Verifies secret scanning is enabled on every repository in scope
- Confirms push protection status
- Captures a point-in-time evidence record with timestamp and checksum
- Flags any repository where scanning is disabled or push protection is off
- Exports findings to your auditor workspace automatically
The result is a live control record your auditor can review directly — no screenshots, no manual exports, no audit scramble.