GitHub 宣布与微软应用科学部门合作开发了一款 AI 检测器,旨在防止开发人员将密码和其他凭证上传至代码仓库。
这款基于 ModernBERT 的分类器将扩展 GitHub 的推送保护功能,该功能会检查代码中的机密信息,并能在凭证进入仓库历史之前阻止推送操作。
检测器的工作原理
现有的检查机制主要通过格式识别许多凭证。新的分类器通过检查周围的代码来识别非结构化的机密信息,例如没有可识别模式的数据库密码。
GitHub 表示,该分类器在不到两毫秒的时间内即可评估一批可能的机密信息,并可能使推送保护能够防止的机密信息数量增加一倍以上。
“推送保护介入得更早。它在可识别的凭证进入仓库历史之前将其阻止,从而让开发人员或代理有机会在发生需要调查的泄露之前纠正更改。” GitHub 产品经理 Erin Havens 写道。
误报会打断开发人员的工作,并削弱他们对未来警告的信任。GitHub 在检测机密信息时必须兼顾准确性、速度、处理能力和运营成本。
代码越多,暴露的凭证越多
GitHub 表示,大约每两秒就会在公开可见的代码中出现一个新的机密信息。从 2024 年第二季度到 2026 年第二季度,它筛选的公开代码推送数量增加了 2.84 倍。包含凭证的推送数量增加了 2.59 倍。
公开推送,2024 年第二季度至 2026 年第二季度。推送发生率是指包含已检测到的机密信息的比例。涵盖支持的提供商模式,包括 GitHub 自己的令牌。(来源:GitHub)
在这九个季度中,该公司发现包含机密信息的推送比例没有统计上可检测的趋势。
在 GitHub 检测的更广泛的机密信息类型范围内,推送保护会在这些新检测到的机密信息进入仓库历史之前阻止约 30%。剩余的 70% 是在泄露后被检测到的。
暴露的凭证可能让某人访问数据库、云服务或其他连接的系统。开发人员随后可能需要禁用该凭证、替换它,并调查其是否被滥用。
手动撤销平均需要大约 40 天,其中约有五分之一暴露的机密信息需要超过 90 天才能撤销。当 GitHub 报告泄露时,某些服务提供商会自动撤销凭证。
可用性与推广
扩展后的推送保护目前处于私有预览阶段。GitHub 计划于 10 月下旬向拥有 GitHub Enterprise Cloud 和 GitHub Team 计划的组织提供该功能。该功能将消耗 AI 积分。
该公司已开始自动将已使用 AI 机密信息检测的组织更新为新模型。推送后执行的扫描产生的警报仍包含在其机密信息扫描购买中,无需额外费用。
该模型将与 GitHub Enterprise Server 3.23 一起发布公共预览版,向 Secret Protection 客户提供 AI 检测到的警报,包括那些运行空气隔离环境的客户。
GitHub 正在将该分类器添加到 Copilot CLI 和 Copilot App 中的 /security-review 命令中。这将允许 Copilot 用户在推送代码之前检查机密信息,而无需组织拥有 GitHub Secret Protection 计划。AI 积分的使用将在 AI 使用洞察中归因于 GitHub Secret Protection。
GitHub has announced an AI detector, developed with Microsoft Applied Sciences, to help prevent developers from uploading passwords and other credentials to code repositories.
The ModernBERT-based classifier will expand GitHub’s push protection, which checks code for secrets and can block a push before a credential enters repository history.
How the detector works
Existing checks recognize many credentials by their formats. The new classifier examines surrounding code to identify unstructured secrets, such as database passwords with no recognizable pattern.
GitHub says the classifier evaluates batches of possible secrets in under two milliseconds and could more than double the number of secrets that push protection can prevent.
“Push protection intervenes earlier. It stops recognizable credentials before they enter repository history, giving the developer or agent a chance to correct the change before there’s an exposure to investigate,” Erin Havens , Product Manager at GitHub, wrote .
False alarms can interrupt developers and undermine trust in future warnings. GitHub must account for accuracy, speed, processing capacity and operating costs when detecting secrets.
More code, more exposed credentials
GitHub says a new secret appears in publicly visible code roughly every two seconds. From the second quarter of 2024 to the second quarter of 2026, the number of public code pushes it screened increased by a factor of 2.84. Pushes containing credentials increased by a factor of 2.59.
Public pushes, Q2 2024–Q2 2026. Push prevalence is the share with a detected secret. Covers supported provider patterns, including GitHub’s own tokens. (Source: GitHub)
Over those nine quarters, the company found no statistically detectable trend in the share of pushes containing secrets .
Across the broader range of secret types GitHub detects, push protection blocks about 30% of newly detected secrets before they enter repository history. The remaining 70% are detected after exposure.
An exposed credential can give someone access to a database, cloud service or other connected system. Developers may then need to disable it, replace it and investigate whether it was misused.
Manual revocation takes around 40 days on average, with roughly one in five exposed secrets taking more than 90 days. Some service providers revoke credentials automatically when GitHub reports an exposure.
Availability and rollout
The expanded push protection is in private preview. GitHub plans to make it available later in October to organizations with GitHub Secret Protection on Enterprise Cloud and GitHub Team plans. The feature will consume AI credits.
The company began automatically updating organizations already using AI secret detection to the new model. Alerts from scans performed after a push remain included in their secret scanning purchase at no additional cost.
The model will ship in public preview with GitHub Enterprise Server 3.23, providing AI-detected alerts to Secret Protection customers, including those running air-gapped environments .
GitHub is adding the classifier to the /security-review command in Copilot CLI and Copilot App. This will let Copilot users check for secrets before pushing code without requiring an organization’s GitHub Secret Protection plan. AI credit usage will be attributed to GitHub Secret Protection in AI usage insights.
首次收录 · 2026-10-09 · 7.31 分