GitHub 用 AI 模型在推送前拦截密钥泄露
GitHub 博客称,目前平台上每三个 pull request 就有一个涉及 AI 智能体,一年前还不到十分之一;2024 年 Q2 到 2026 年 Q2,受检推送量增长 2.84 倍,携带凭据的推送增长 2.59 倍,但每次推送的泄密占比未出现可检测的上升趋势,开发者覆盖拦截的比例则从 6.63% 降至 3.93%。GitHub 与 Microsoft Applied Sciences 合作训练了一个基于 ModernBERT 的分类器,可借助周边代码上下文在 2 毫秒内评估一批候选密钥,据称有望把可拦截的密钥数量提升一倍以上。该功能目前处于私有预览,本月晚些时候面向 Enterprise Cloud 和 GitHub Teams 上购买 GitHub Secret Protection 的组织开放并消耗 AI credits,同时将通过 GitHub Enterprise Server 3.23 公开预览,并加入 Copilot CLI 与 Copilot App 的 /security-review 命令。
当智能体承担越来越多编码工作,密钥防泄露的关键正从人工补救转向能在推送前自动拦截的轻量模型。
Today, one in three pull requests on GitHub involves an AI agent. A year ago, that number was fewer than one in 10. If that pace holds, within the next two years, most of the code pushed to GitHub could be written by an agent. Much of it may never be fully read by a human.
If developers and agents move faster, we have a responsibility to ensure protection keeps up with the accelerated rate of code creation. That means preventing more leaks before they happen and making the response to exposures that remain less dependent on manual human effort.
This is a pivotal point for leaked secrets. Developers aren’t becoming more careless; they’re being outpaced. The tools that let developers create more software should also take on more of the work of protecting it.
In this essay, I share the nine quarters of data behind that claim. I also introduce the fine-tuned classifier we built with Microsoft Applied Sciences to extend push protection to unstructured secrets. The model assesses a whole set of candidate secrets in less than two milliseconds and could more than double the number of secrets that we can prevent.