返回行业内容

GitHub:每3个 PR 就有1个有 agent 参与、每2秒漏一个密钥——"防护必须随软件一起规模化"

Secret protection must scale with software

评分 52

导读

GitHub 安全产品负责人基于九个季度的内部数据论证:AI 时代代码生成在提速(1/3 的 PR 已有 AI agent 参与、一年前不足1/10;公开代码约每2秒出现一个新泄漏密钥、三年内逐年翻倍),但开发者并不更粗心(Q2 2024-Q2 2026 被筛 push 量 2.84 倍、带凭证 push 2.59 倍、单 push 含密率无统计显著趋势、越拦截比例从6.63%降到3.93%)。瓶颈在善后:撤销一个已泄密钥平均约40天、1/5超过90天。GitHub 同步发布与 Microsoft Applied Sciences 共建的微调分类器(覆盖非结构化秘密、判断<2毫秒、预计可预防量翻倍以上)与约150家伙伴的 secret scanning 计划(2026Q2 公共扫描平均每秒上报26次命中)。

推荐理由

数据密度罕见的"AI 时代安全"一手披露(机构自有九季度指标+分类器发布),与本包"模型安全事故(1128251)"构成风险面的一体两面。但它本质是产品负责人论述文/公司博客,不是第三方可核验事件报道,且主题(密钥泄漏治理)与 AI 主线的距离较远;按 T1=60 给 50/54、落在理解写作档而不入选。

主体与标签

GitHubMicrosoft#安全/对齐#开发者#数据/训练

正文

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&rsquo;t becoming more careless; they&rsquo;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.

Outpaced, not careless

A new secret appears in publicly visible code about once every two seconds, doubling yearly for the past three years. Public discourse is quick to jump to the idea that AI made developers careless.

Between Q2 2024 and Q2 2026, screened pushes grew 2.84 times while pushes carrying credentials grew 2.59 times . Across nine complete quarters of data, we found no statistically detectable trend regarding per-push prevalence. At the same time, we found data suggesting that, more than ever, developers understand the risk of accidental exposures and are less willing to accept that risk. Over the same period, the share of push-path blocks overridden by developers fell linearly from 6.63% to 3.93% . These figures challenge the common claim that agents are causing developers to become more careless.

At a fixed rate, doubling activity doubles expected exposures. If each exposure requires the same human response, the workload doubles too. The mean time to manually revoke a secret hovers around 40 days ; roughly one in five took more than 90 days . We&rsquo;re accelerating the creation of software while exposed credentials can remain usable for weeks or months, because human remediation can&rsquo;t scale at the same pace as development.

Telling developers to be more careful cannot, on its own, solve that problem. As the amount of code grows, we must prevent more exposures and reduce human effort required by those that remain, if software development is to remain sustainable.

Prevention scales with compute

I&rsquo;ve spent the past few years working on secret scanning at GitHub and the past year as product lead for the area. Our greatest impact has come from connecting the dots between detection to systems that can act.

GitHub&rsquo;s catalog covers more than 150 technical partners through our secret scanning partnership program. Through our partner program, we work with participating secret issuers to build out detectors and report public exposures so they can respond. In Q2 2026, public scanning successfully reported an average of 26 credential matches a second, including repeat observations. Once notified, a large number of these partners immediately revoke the token: OpenAI API keys, Google Cloud account credentials, Slack webhooks, Hugging Face user tokens, SendGrid keys, etc. The owner may still need to replace the token, but revocation can happen without waiting for a developer to find and process a GitHub alert.

Push protection intervenes earlier. It stops recognizable credentials before it enters repository history, giving the developer or agent a chance to correct the change before there&rsquo;s an exposure to investigate. We work with our technical partners to increase precision rates of their detectors as much as possible, until we&rsquo;re confident enough to push-protect these secrets for the developer community by default.

Thanks to the efforts of our partners, in the past month, a secret was blocked by push protection at least once every second. When it comes to issuer-bound credentials, GitHub blocks more secrets than those which slip. I&rsquo;m proud of how ordinary we&rsquo;ve made that feel for developers.

Remediation scales with people

When including additional secret types, push protection stops about 30% of newly detected secrets before they enter repository history. We find the remaining 70% after the credential is, unfortunately, already lost. And:

  1. Prevention scales with compute, but remediation still scales with people.
  2. Refusing a push costs compute; cleaning up a secret already lost to visible history costs a developer&rsquo;s time and attention.
  3. As the amount of code grows, we must prevent more exposures and reduce the human effort required by those that remain, or else the volume of vulnerabilities introduced will become untenable.

Telling developers to be more careful cannot solve this imbalance. Recognizing more of these secrets, earlier in development flows, is work the platform must take on.

Solving the four-body problem

Before a secret crosses the push boundary, the cost of stopping it is small, and the decision is binary: block or allow. After it crosses, the same string can authenticate to a real system, and the cost is unbounded.

In many cases, our only detection clue may be the surrounding code and world context. A provider-issued token may have a recognizable prefix. An internal database password may be completely unstructured, with no identifying pattern at all. We were already using context to find these secrets post-push; the problem was balancing that context-aware judgement with other factors.

We refer to this as the &ldquo;four-body problem&rdquo; for secret protection: precision, latency, throughput, and cost are coupled constraints. Prevention must be worth a developer&rsquo;s time. A finding suitable for later review may not justify blocking a push. A false positive interrupts a developer and makes the next block harder to trust. A check that is too slow, expensive, or difficult to scale limits how often it can run.

Protection at the push in under 2 ms

Our new ModernBERT classifier assess candidate secrets in context, without generating code or prose. It&rsquo;s not only more precise than existing LLM-based pipelines, but it&rsquo;s incredibly fast, evaluating candidate batches in under two milliseconds. It&rsquo;s also extremely cost efficient, enough to run at scale in the critical path.

The inclusion of our model in push protection makes it possible for us to more than double the number of secrets that we&rsquo;re able to prevent. The feature is currently in private preview. Later this month, the feature will be available to organizations with GitHub Secret Protection across Enterprise Cloud and GitHub Teams. It will consume AI credits.

We&rsquo;re also bringing the model to developer surfaces beyond the push.

  • Starting today, any organization with AI secret detection will be automatically updated to the new model. Alerts opened from these post-push scans remain included with an organization&rsquo;s purchase of secret scanning at no additional cost.
  • The model will also ship with GitHub Enterprise Server 3.23 in public preview , bringing AI-detected alerts to Secret Protection customers even in air-gapped environments.
  • We&rsquo;re adding the classifier to the /security-review command for the Copilot CLI and Copilot App , so Copilot users can address secrets before a push even without needing an organization&rsquo;s GitHub Secret Protection plan. AI credit usage will be attributed to GitHub Secret Protection in your AI usage insights.

Looking forward

The future we want is one where developers can entrust more work to agents without supervising every request, and one where the number of people that an organization needs to keep its credentials safe no longer scales with the amount of code it writes. We owe the developer community the same progress in protecting software that we are delivering in producing it.

We want people to build more software. Our capacity to protect it should grow with our capacity to create it.

The post Secret protection must scale with software appeared first on The GitHub Blog .

打开原文 ↗