secret-scanning by github/awesome-copilot
npx skills add https://github.com/github/awesome-copilot --skill secret-scanning此技能提供配置 GitHub 密钥扫描的程序性指导——检测泄露的凭据、防止密钥推送、定义自定义模式以及管理警报。
当请求涉及以下内容时使用此技能:
secret_scanning.yml 排除目录免受密钥扫描密钥扫描自动检测以下位置暴露的凭据:
| 仓库类型 | 可用性 |
|---|---|
| 公共仓库 | 自动,免费 |
| 私有/内部(组织所有) | 需要 Team/Enterprise Cloud 上的 GitHub Secret Protection |
| 用户所有 | 带有 Enterprise Managed Users 的 Enterprise Cloud |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
对于组织,使用安全配置进行大规模启用:
推送保护在推送过程中(在密钥到达仓库之前)拦截密钥。
推送保护在以下情况下拦截密钥:
创建 .github/secret_scanning.yml 以自动关闭特定目录的警报:
paths-ignore:
- "docs/**"
- "test/fixtures/**"
- "**/*.example"
限制:
paths-ignore 中最多 1,000 个条目最佳实践:
非提供商模式 — 检测私钥、连接字符串、通用 API 密钥:
AI 驱动的通用密钥检测 — 使用 Copilot 检测非结构化的密钥,如密码:
有效性检查 — 验证检测到的密钥是否仍处于活动状态:
active、inactive 或 unknown扩展元数据检查 — 关于密钥所有者的附加上下文:
当推送保护从命令行拦截推送时:
如果密钥在最近的提交中:
# 从文件中移除密钥
# 然后修改提交
git commit --amend --all
git push
如果密钥在更早的提交中:
# 找到包含密钥的最早提交
git log
# 在该提交之前开始交互式变基
git rebase -i <COMMIT-ID>~1
# 将有问题的提交的 'pick' 改为 'edit'
# 移除密钥,然后:
git add .
git commit --amend
git rebase --continue
git push
如果启用了委托绕过且您没有绕过权限:
有关详细的绕过和委托绕过工作流,请搜索
references/push-protection.md。
使用正则表达式定义组织特定的密钥模式。
自定义模式可以在以下级别定义:
使用 Copilot 密钥扫描,根据密钥类型的文本描述生成正则表达式,包括可选的示例字符串。
有关详细的自定义模式配置,请搜索
references/custom-patterns.md。
| 类型 | 描述 | 可见性 |
|---|---|---|
| 用户警报 | 在仓库中发现的密钥 | 安全选项卡 |
| 推送保护警报 | 通过绕过推送的密钥 | 安全选项卡(筛选器:bypassed: true) |
| 合作伙伴警报 | 报告给提供商的密钥 | 不在仓库中显示(仅限提供商) |
active(紧急)、inactive(较低优先级)、unknown使用记录的原因忽略警报:
有关详细的警报类型、有效性检查和 REST API,请搜索
references/alerts-and-remediation.md。
如需详细文档,请根据需要加载以下参考文件:
references/push-protection.md — 推送保护机制、绕过工作流、委托绕过、用户推送保护
bypass、delegated、bypass request、command line、REST API、user push protectionreferences/custom-patterns.md — 自定义模式创建、正则表达式语法、试运行、Copilot 正则表达式生成、作用域
custom pattern、regex、dry run、publish、organization、enterprise、Copilotreferences/alerts-and-remediation.md — 警报类型、有效性检查、扩展元数据、通用警报、密钥移除、REST API
user alert、partner alert、validity、metadata、generic、remediation、git history、REST API每周安装数
266
仓库
GitHub 星标数
26.7K
首次出现
6 天前
安全审计
安装于
gemini-cli244
codex244
opencode240
cursor238
github-copilot237
kimi-cli236
This skill provides procedural guidance for configuring GitHub secret scanning — detecting leaked credentials, preventing secret pushes, defining custom patterns, and managing alerts.
Use this skill when the request involves:
secret_scanning.ymlSecret scanning automatically detects exposed credentials across:
| 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 |
For organizations, use security configurations to enable at scale:
Push protection blocks secrets during the push process — before they reach the repository.
Push protection blocks secrets in:
Create .github/secret_scanning.yml to auto-close alerts for specific directories:
paths-ignore:
- "docs/**"
- "test/fixtures/**"
- "**/*.example"
Limits:
paths-ignoreBest practices:
Non-provider patterns — detect private keys, connection strings, generic API keys:
AI-powered generic secret detection — uses Copilot to detect unstructured secrets like passwords:
Validity checks — verify if detected secrets are still active:
active, inactive, or unknownExtended metadata checks — additional context about who owns a secret:
When push protection blocks a push from the command line:
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
If delegated bypass is enabled and you lack bypass privileges:
For detailed bypass and delegated bypass workflows, search
references/push-protection.md.
Define organization-specific secret patterns using regular expressions.
Custom patterns can be defined at:
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.
| 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) |
active (urgent), inactive (lower priority), unknownDismiss with a documented reason:
For detailed alert types, validity checks, and REST API, search
references/alerts-and-remediation.md.
For detailed documentation, load the following reference files as needed:
references/push-protection.md — Push protection mechanics, bypass workflow, delegated bypass, user push protection
bypass, delegated, bypass request, command line, REST API, user push protectionreferences/custom-patterns.md — Custom pattern creation, regex syntax, dry runs, Copilot regex generation, scopes
custom pattern, regex, , , , , Weekly Installs
266
Repository
GitHub Stars
26.7K
First Seen
6 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli244
codex244
opencode240
cursor238
github-copilot237
kimi-cli236
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
102,600 周安装
dry runpublishorganizationenterpriseCopilotreferences/alerts-and-remediation.md — Alert types, validity checks, extended metadata, generic alerts, secret removal, REST API
user alert, partner alert, validity, metadata, generic, remediation, git history, REST API