Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
github avatar

Secret Scanning

  • 4k installs
  • 37.1k repo stars
  • Updated July 28, 2026
  • github/awesome-copilot

Procedural guidance for enabling, configuring, and managing GitHub secret scanning — detecting exposed credentials, blocking pushes, defining custom patterns, and remediating alerts.

About

This skill provides procedural guidance for configuring GitHub secret scanning - automatically detecting leaked credentials across git history, issues, pull requests, and discussions. Developers use it to enable secret protection, set up push protection (blocking secrets before push), define custom regex patterns for organization-specific secrets, manage and remediate alerts, and resolve blocked pushes. The skill covers core workflows: enabling secret scanning at repository or organization scale, configuring exclusions via secret_scanning.yml, enabling validity checks and AI-powered detection, handling blocked pushes via removal or bypass, and triaging alerts. For pre-commit scanning in AI coding agents, it references the Advanced Security plugin's MCP tools. Key use cases include onboarding secret protection, preventing credential leaks, remediating exposed secrets, and integrating secret scanning into CI/CD and agent workflows. Enable secret protection and push protection at repo or org level to detect and block credentials automatically.

  • Enable secret protection and push protection at repo or org level to detect and block credentials automatically
  • Configure exclusions in `.github/secret_scanning.yml` to auto-close alerts for safe directories like test fixtures
  • Define custom regex patterns at repo, org, or enterprise scope to detect organization-specific secret formats
  • Resolve blocked pushes by removing the secret, requesting bypass, or using delegated bypass with approval workflow
  • Manage alerts with validity checks, triage by active/inactive status, and dismiss with documented reasons (false positiv

Secret Scanning by the numbers

  • 3,971 all-time installs (skills.sh)
  • +149 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #148 of 2,209 Security skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

secret-scanning capabilities & compatibility

Capabilities
enable secret scanning at repository or organiza · configure push protection to block secret pushes · define custom regex patterns for organization se · manage exclusions and bypass workflows · triage, dismiss, and remediate alerts · integrate pre commit scanning in ai agents via m
Works with
github · gitlab
Use cases
security audit · ci cd · testing
Platforms
macOS · Windows · Linux · WSL
Runs
Hosted SaaS
Pricing
Freemium
npx skills add https://github.com/github/awesome-copilot --skill secret-scanning

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4k
repo stars37.1k
Security audit3 / 3 scanners passed
Last updatedJuly 28, 2026
Repositorygithub/awesome-copilot

What it does

Configure GitHub secret scanning to detect and block exposed credentials in repositories and prevent secrets from reaching git history.

Who is it for?

DevSecOps engineers, security teams, developers onboarding secret protection, teams with custom credential formats, organizations enforcing zero-secret policies.

Skip if: Teams without git-based code storage, projects that intentionally commit test credentials, environments that cannot rotate exposed secrets.

When should I use this skill?

Enabling secret scanning, setting up push protection, defining custom patterns, resolving blocked pushes, triaging alerts, or integrating pre-commit scanning in AI agents.

What you get

Credentials are automatically detected and blocked; exposed secrets are rotated and removed; custom patterns enforce organization security policies.

  • Enabled secret scanning and push protection
  • Configured exclusions in secret_scanning.yml
  • Published custom patterns (if needed)

By the numbers

  • Secret scanning checks entire Git history on all branches, plus issue/PR/discussion text and wikis
  • Maximum 1,000 entries in paths-ignore; file must be under 1 MB
  • Generic alert limit: 5,000 per repository

Files

SKILL.mdMarkdownGitHub ↗

Secret Scanning

This skill provides procedural guidance for configuring GitHub secret scanning — detecting leaked credentials, preventing secret pushes, defining custom patterns, and managing alerts.

When to Use This Skill

Use this skill when the request involves:

  • Enabling or configuring secret scanning for a repository or organization
  • Setting up push protection to block secrets before they reach the repository
  • Defining custom secret patterns with regular expressions
  • Resolving a blocked push from the command line
  • Triaging, dismissing, or remediating secret scanning alerts
  • Configuring delegated bypass for push protection
  • Excluding directories from secret scanning via secret_scanning.yml
  • Understanding alert types (user, partner, push protection)
  • Enabling validity checks or extended metadata checks
  • Scanning local code changes for secrets before committing (via MCP / AI coding agent) — see the Pre-Commit Scanning via AI Coding Agents section below for the recommended plugin

How Secret Scanning Works

Secret scanning automatically detects exposed credentials across:

  • Entire Git history on all branches
  • Issue descriptions, comments, and titles (open and closed)
  • Pull request titles, descriptions, and comments
  • GitHub Discussions titles, descriptions, and comments
  • Wikis and secret gists

Availability

Repository TypeAvailability
Public reposAutomatic, free
Private/internal (org-owned)Requires GitHub Secret Protection on Team/Enterprise Cloud
User-ownedEnterprise Cloud with Enterprise Managed Users

Core Workflow — Enable Secret Scanning

Step 1: Enable Secret Protection

1. Navigate to repository SettingsAdvanced Security 2. Click Enable next to "Secret Protection" 3. Confirm by clicking Enable Secret Protection

For organizations, use security configurations to enable at scale:

  • Settings → Advanced Security → Global settings → Security configurations

Step 2: Enable Push Protection

Push protection blocks secrets during the push process — before they reach the repository.

1. Navigate to repository SettingsAdvanced Security 2. Enable "Push protection" under Secret Protection

Push protection blocks secrets in:

  • Command line pushes
  • GitHub UI commits
  • File uploads
  • REST API requests
  • REST API content creation endpoints

Step 3: Configure Exclusions (Optional)

Create .github/secret_scanning.yml to auto-close alerts for specific directories:

paths-ignore:
  - "docs/**"
  - "test/fixtures/**"
  - "**/*.example"

Limits:

  • Maximum 1,000 entries in paths-ignore
  • File must be under 1 MB
  • Excluded paths also skip push protection checks

Best practices:

  • Be as specific as possible with exclusion paths
  • Add comments explaining why each path is excluded
  • Review exclusions periodically — remove stale entries
  • Inform the security team about exclusions

Step 4: Enable Additional Features (Optional)

Non-provider patterns — detect private keys, connection strings, generic API keys:

  • Settings → Advanced Security → enable "Scan for non-provider patterns"

AI-powered generic secret detection — uses Copilot to detect unstructured secrets like passwords:

  • Settings → Advanced Security → enable "Use AI detection"

Validity checks — verify if detected secrets are still active:

  • Settings → Advanced Security → enable "Validity checks"
  • GitHub periodically tests detected credentials against provider APIs
  • Status shown in alert: active, inactive, or unknown

Extended metadata checks — additional context about who owns a secret:

  • Requires validity checks to be enabled first
  • Helps prioritize remediation and identify responsible teams

Core Workflow — Resolve Blocked Pushes

When push protection blocks a push from the command line:

Option A: Remove the Secret

If the secret is in the latest commit:

# Remove the secret from the file
# Then amend the commit
git commit --amend --all
git push

If the secret is in an earlier commit:

# Find the earliest commit containing the secret
git log

# Start interactive rebase before that commit
git rebase -i <COMMIT-ID>~1

# Change 'pick' to 'edit' for the offending commit
# Remove the secret, then:
git add .
git commit --amend
git rebase --continue
git push

Option B: Bypass Push Protection

1. Visit the URL returned in the push error message (as the same user) 2. Select a bypass reason:

  • It's used in tests — alert created and auto-closed
  • It's a false positive — alert created and auto-closed
  • I'll fix it later — open alert created

3. Click Allow me to push this secret 4. Re-push within 3 hours

Option C: Request Bypass Privileges

If delegated bypass is enabled and you lack bypass privileges: 1. Visit the URL from the push error 2. Add a comment explaining why the secret is safe 3. Click Submit request 4. Wait for email notification of approval/denial 5. If approved, push the commit; if denied, remove the secret

For detailed bypass and delegated bypass workflows, search references/push-protection.md.

Custom Patterns

Define organization-specific secret patterns using regular expressions.

Quick Setup

1. Settings → Advanced Security → Custom patterns → New pattern 2. Enter pattern name and regex for secret format 3. Add a sample test string 4. Click Save and dry run to test (up to 1,000 results) 5. Review results for false positives 6. Click Publish pattern 7. Optionally enable push protection for the pattern

Scopes

Custom patterns can be defined at:

  • Repository level — applies to that repo only
  • Organization level — applies to all repos with secret scanning enabled
  • Enterprise level — applies across all organizations

Copilot-Assisted Pattern Generation

Use Copilot secret scanning to generate regex from a text description of the secret type, including optional example strings.

For detailed custom pattern configuration, search references/custom-patterns.md.

Alert Management

Alert Types

TypeDescriptionVisibility
User alertsSecrets found in repositorySecurity tab
Push protection alertsSecrets pushed via bypassSecurity tab (filter: bypassed: true)
Partner alertsSecrets reported to providerNot shown in repo (provider-only)

Alert Lists

  • Default alerts — supported provider patterns and custom patterns
  • Generic alerts — non-provider patterns and AI-detected secrets (limited to 5,000 per repo)

Remediation Priority

1. Rotate the credential immediately — this is the critical action 2. Review the alert for context (location, commit, author) 3. Check validity status: active (urgent), inactive (lower priority), unknown 4. Remove from Git history if needed (time-intensive, often unnecessary after rotation)

Dismissing Alerts

Dismiss with a documented reason:

  • False positive — detected string is not a real secret
  • Revoked — credential has already been revoked
  • Used in tests — secret is only in test code
For detailed alert types, validity checks, and REST API, search references/alerts-and-remediation.md.

Pre-Commit Scanning via AI Coding Agents

For scanning code changes for secrets inside an AI coding agent before committing, install the Advanced Security plugin which provides the run_secret_scanning MCP tool and a dedicated scanning skill.

GitHub Copilot CLI:

/plugin install advanced-security@copilot-plugins

Visual Studio Code:

  • In Copilot Chat, open Chat: Plugins (or use @agentPlugins) and install the advanced-security plugin
  • Then run /secret-scanning in Copilot Chat

See: Advanced Security Plugin — Secret Scanning Skill

Announced in Secret scanning in AI coding agents via the GitHub MCP Server (March 2026)

Reference Files

For detailed documentation, load the following reference files as needed:

  • references/push-protection.md — Push protection mechanics, bypass workflow, delegated bypass, user push protection
  • Search patterns: bypass, delegated, bypass request, command line, REST API, user push protection
  • references/custom-patterns.md — Custom pattern creation, regex syntax, dry runs, Copilot regex generation, scopes
  • Search patterns: custom pattern, regex, dry run, publish, organization, enterprise, Copilot
  • references/alerts-and-remediation.md — Alert types, validity checks, extended metadata, generic alerts, secret removal, REST API
  • Search patterns: user alert, partner alert, validity, metadata, generic, remediation, git history, REST API

Related skills

FAQ

What is the difference between user alerts, partner alerts, and push protection alerts?

User alerts show secrets found in repo history (Security tab). Partner alerts are reported to providers (not shown in repo). Push protection alerts are secrets pushed via bypass (filtered in Security tab).

How do I handle a blocked push if I cannot remove the secret?

Visit the error URL and select a bypass reason (used in tests, false positive, fix later). If delegated bypass is enabled, request approval by commenting on the reason.

What are validity checks and why do they matter?

Validity checks verify if detected secrets are still active by testing against provider APIs. Status (active, inactive, unknown) helps prioritize remediation — active secrets require immediate rotation.

Is Secret Scanning safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Securitysecretscompliance

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.