npx skills add ...
npx skills add github/copilot-plugins --skill secret-scanning
npx skills add github/copilot-plugins --skill secret-scanning
Scan files, content, or recent changes for secrets such as API keys, passwords, tokens, and credentials using the GitHub MCP Server's run_secret_scanning tool.
This skill uses the GitHub MCP Server's run_secret_scanning tool to detect secrets in content, files, or git changes. It helps identify sensitive material like API keys, passwords, and credentials that could pose a security risk if exposed.
In this context, values that grant access, impersonate a user or service, sign requests, or decrypt protected data are generally treated as secrets.
Treat these as high-confidence secret material:
Prefer context, not just regex:
password, token, secret, client_secret, private_key, or authorization are higher riskNot everything that looks random is a secret. Example placeholders such as YOUR_API_KEY_HERE, obvious test stubs, and documented sample values can be false positives.
This skill scans for secrets that could compromise security if leaked. A committed secret can persist in git history, trigger incident response, and block deployment at push protection checks.
Important: Only use this skill when a user explicitly asks to scan content or check for secrets. Do not run secret scanning unprompted or as part of general workflows.
| User goal | How to respond | Tools needed |
|---|---|---|
| Check a config snippet or code paste | Scan as content | MCP |
| Check a specific file in the repo | Read file, then scan | Read + MCP |
| Check all staged changes before commit | Get diff, then scan | Bash(git:*) + MCP |
GitHub MCP Server: The skill requires the GitHub MCP Server with the secret_protection toolset enabled. This repository includes a default .mcp.json configured for the GitHub MCP Server, allowing the skill to communicate with it out of the box.
Configure in your MCP settings:
Note: Cursor uses
serversinstead ofmcpServersas the top-level key.
Required information for scanning:
git remote get-url origin or ask the usergit remote get-url origin or ask the userRead tool), or git diff output (from git diff)If the user doesn't provide repository owner and repository name, ask for them before running the scan.
What NOT to scan: By default, avoid scanning large generated or vendor content (for example: node_modules/, build artifacts, compiled assets, or other machine-generated files) for performance and noise reduction. Files listed in .gitignore may still contain secrets (such as .env or local config), so only skip them if the user agrees; if the user explicitly asks to scan them, include them in the scan.
When to use: The user provides text or code snippets they want checked for secrets.
How: Use the run_secret_scanning tool with the content as input (as a single-item array).
Example
When to use: The user asks to check specific files in the repository for secrets.
How: Use the Read tool to get file contents, then pass them to run_secret_scanning.
Example (secrets found)
Example (no secrets found)
When to use: The user wants to check git staged changes for secrets before committing.
How: Use git diff --cached to get staged content, then pass it to run_secret_scanning.
Example (clean)
Example (secrets detected)
When you call run_secret_scanning:
The tool works on content you provide. It doesn't need push access or special GitHub permissions.
When you request a scan, file contents are sent to GitHub's secret detection infrastructure. The scanning happens server-side against GitHub's known secret patterns. Scan results are returned without retaining the content on GitHub servers beyond the scan request.
If secrets are found:
.env filesexample.env or documentation exists that shows the expected structureIf no secrets are found:
For more details on secret scanning, credential management, and GitHub security features:
You: Check if config.py has secrets
Agent: I'll read and scan that file.
⚠️ Found 1 potential secret:
- Line 10: database_password value looks like a password
Suggestion: Move to environment variable or .env file.You: Check if utils.js has any secrets
Agent: I'll read and scan that file.
✅ No secrets detected in utils.jsYou: Check my staged changes for secrets before I commit
Agent: I'll scan your staged changes.
✅ No secrets found in staged changes. Safe to commit.You: Scan my staged changes
Agent: I'll check your staged changes.
⚠️ Found 1 potential secret in staged changes:
- database.js line 5: password value looks like a credential
Suggestion: Unstage that change, move the credential to env vars, and restage.