secret-scanning
Guide for configuring and managing GitHub secret scanning, push protection, custom patterns, and secret alert remediation. For pre-commit secret scanning in AI coding agents via the GitHub MCP Server, this skill references the Advanced Security plugin (`advanced-security@copilot-plugins`). Use this skill when enabling secret scanning, setting up push protection, defining custom patterns, triaging alerts, resolving blocked pushes, or when an agent needs to scan code for secrets before committing.
What this skill does
# 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 Type | Availability | |---|---| | Public repos | Automatic, free | | Private/internal (org-owned) | Requires GitHub Secret Protection on Team/Enterprise Cloud | | User-owned | Enterprise Cloud with Enterprise Managed Users | ## Core Workflow — Enable Secret Scanning ### Step 1: Enable Secret Protection 1. Navigate to repository **Settings** → **Advanced 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 **Settings** → **Advanced 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: ```yaml 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:** ```bash # Remove the secret from the file # Then amend the commit git commit --amend --all git push ``` **If the secret is in an earlier commit:** ```bash # 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 | Type | Description | Visibility | |---|---|---| | **User alerts** | Secrets found in repository | Security tab | | **Push protection alerts** | Secrets pushed via bypass | Security tab (filter: `bypassed: true`) | | **Partner alerts** | Secrets reported to provider | Not 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:** ```bash /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](https://github.com/github/copilot-plugins/blob/main/plugins/advanced-security/skills/secret-scanning/SKILL.md) > Announced in
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.