---
title: "Finding leaked passwords with AI: How we built Copilot secret scanning"
description: "GitHub replaced regex-based detection of generic passwords with an LLM prompt that judges candidate secrets from their file context."
url: "https://swe.quest/articles/finding-leaked-passwords-with-ai-how-we-built-copilot-secret-scanning-26ede51a550b66b2"
canonical: "https://github.blog/engineering/platform-security/finding-leaked-passwords-with-ai-how-we-built-copilot-secret-scanning/"
source: "GitHub Engineering"
published: "2025-03-04"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["llms","evals","security","capacity-planning"]
---

# Finding leaked passwords with AI: How we built Copilot secret scanning

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2025-03-04, 8 min read, Case study. Original: [https://github.blog/engineering/platform-security/finding-leaked-passwords-with-ai-how-we-built-copilot-secret-scanning/](https://github.blog/engineering/platform-security/finding-leaked-passwords-with-ai-how-we-built-copilot-secret-scanning/)

## Summary

GitHub replaced regex-based detection of generic passwords with an LLM prompt that judges candidate secrets from their file context. The first GPT-3.5-Turbo few-shot prompt broke on unusual file types in customer repos. GitHub responded by expanding offline evals with customer reports and GPT-4-generated cases, adding GPT-4 as a confirming scanner, and adopting Microsoft's MetaReflection hybrid chain-of-thought/few-shot prompt. To scale full-history scans, they excluded low-value files and built a workload-aware rate limiter in which workloads borrow unused LLM capacity from each other. Mirror testing on preview repos showed up to a 94% drop in false positives with little recall loss.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [Security](https://swe.quest/tags/security.md) (Security)
- [Capacity planning](https://swe.quest/tags/capacity-planning.md) (Reliability & operations)

## Prerequisites

- LLM prompting basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- precision and recall

## Keywords

Copilot secret scanning, GitHub Secret Protection, GPT-3.5-Turbo, GPT-4, MetaReflection, Freno, Doorman

## Related posts

- [Detecting malicious pull requests at scale with LLMs](https://swe.quest/articles/detecting-malicious-pull-requests-at-scale-with-llms-18b7d45442154d44.md): Datadog Engineering · 2025-10-21 · Medium · 12 min read · Supply chain security, Threat detection, LLMs, Code review, Evaluation
  Datadog's SDLC Security team built BewAIre, an LLM-based reviewer that classifies the diff of every merged PR (nearly 10,000 a week) as benign or malicious, with a written rationale emitted as a security signal for real-time triage.
- [MCP Horror Stories: The GitHub Prompt Injection Data Heist](https://swe.quest/articles/mcp-horror-stories-the-github-prompt-injection-data-heist-118a1d699702a7aa.md): Docker · 2025-08-14 · Medium · 15 min read · AI agents, Application security, Identity & auth, LLMs
  A prompt injection planted in a public GitHub issue can hijack an AI agent using the official GitHub MCP server.
- [From single pull requests to full software packages: Detecting malicious code at scale](https://swe.quest/articles/from-single-pull-requests-to-full-software-packages-detecting-malicious-code-at-717a58a001a046a1.md): Datadog Engineering · 2026-06-02 · Medium · 12 min read · Supply chain security, Threat detection, AI agents, LLMs, Cost optimization
  Datadog extended BewAIre, its LLM-based malicious code detector, from pull requests to full dependency packages by stacking a cheap filter model in front of an agentic investigation model.
- [Hugging Face partners with TruffleHog to Scan for Secrets](https://swe.quest/articles/hugging-face-partners-with-trufflehog-to-scan-for-secrets-a62ad2f14f096262.md): Hugging Face · 2024-09-04 · Medium · 4 min read · Security, Supply chain security, Developer tools
  Hugging Face has integrated TruffleHog into its automated repository scanning pipeline, which runs alongside ClamAV malware scanning and picklescan.
- [Leveraging AI for efficient incident response](https://swe.quest/articles/leveraging-ai-for-efficient-incident-response-c0ed9d554ec34552.md): Meta Engineering · 2024-06-24 · Medium · 5 min read · Incidents & postmortems, LLMs, Model training, Debugging
  Meta's AI-assisted root cause analysis system narrows suspect code changes in its web monorepo by combining a heuristic retriever with a fine-tuned Llama 2 (7B) ranker.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
