
Leakferret
io.github.leakferrethq由 GitHub 帳號 leakferrethq 發布v0.1.13更新於 Oct 24, 2026
Context-aware secret scanner: lets an AI agent scan, verify, and rewrite secrets before committing.
概覽
本機 MCP 伺服器,讓程式設計助理掃描儲存庫中的硬編碼密鑰、確認哪些仍然有效,並提出改寫為環境變數讀取的建議。
- 可以做什麼
- 掃描儲存庫中的硬編碼密鑰,涵蓋 60 多種密鑰類型,遵循 .gitignore 並讀取 .env 等點檔案,可透過 scan_repository 工具選擇走訪提交歷史,並用 baseline_diff 工具與已存指紋比對。透過 classify_candidates 工具與 classify 提示,將候選結果判定為真實、範例或未知,可離線或借助宿主模型完成。對單一發現呼叫服務商介面做無害驗證,確認密鑰是否仍然有效。提出就地改寫,把字面值替換為環境變數讀取,並在 .env.example 追加一行。以唯讀資源形式提供可偵測密鑰類型與支援驗證方的目錄
- 適用情境
- 適合程式設計助理在撰寫或修改程式碼後、提交前自查變更中是否含密鑰,也適合讓助理整理既有發現並草擬改為環境變數讀取的修正。
- 執行需求
- 以本機程序透過 stdio 執行,可用 npx @leakferret/mcp 或原生 leakferret 二進位檔啟動。走 npm 方式需要 Node.js。未宣告需要帳號、API 金鑰或環境變數。驗證功能需要連線至密鑰服務商。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Leakferret,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[CI] [License: MIT] [VS Code Marketplace] [MCP Badge]
MCP-native secret scanner — verified findings, agent-applied rewrites.
leakferret is one fast Rust binary that is engine, CLI, and MCP server. It finds hardcoded secrets in your code, calls the provider to confirm which ones are actually live, and rewrites the leak in place to read from an environment variable. It runs in your terminal, in CI, and as a tool your coding agent calls before it commits — and the raw secret never leaves your machine.
[leakferret finds a leaked AWS key, verifies it, and rewrites it to ENV.fetch]
What it looks like
Say you accidentally commit a real key, plus the usual noise:
leakferret verify calls each provider and tells you what is real and live —
and stays quiet on the rest:
The keys above are fabricated, so the VERIFIED line illustrates what a
genuinely live key reports — on these examples both would be UNKNOWN.
The ${SENDGRID_API_KEY} reference, the changeme placeholder, and the
well-known AKIAIOSFODNN7EXAMPLE example are recognized and left out — that
precision is the point. Then leakferret rewrite --apply rewrites the
hardcoded key in your code (it leaves .env files alone — there's nothing
sensible to rewrite a secret to there):
…and appends STRIPE_API_KEY= to .env.example with a seed command for your
secret manager. Find → confirm live → fix, with almost no false alarms.
The full secret value never leaves your machine. Only a redacted
AKIA...4XYZpreview is ever written to a report, log, or network message.
Quick start
Install however you like — every package ships the same prebuilt binary.
Then scan the current directory:
scan respects .gitignore and also reads dotfiles such as .env. Add
--git to walk commit history instead of the working tree.
Every wrapper honors a
LEAKFERRET_BINenvironment variable pointing at a local binary, for offline or development use.
How it works
leakferret runs findings through a five-station pipeline. Each station only sees what it needs, and the raw secret never advances past disk.
- Scan — a fast regex pre-filter over your files, across 60+ secret
types. Respects
.gitignore, reads dotfiles like.env, and (with--git) walks history. - Catalog — every candidate is checked against a signed database of
known-public example credentials: Stripe test keys,
AKIAIOSFODNN7EXAMPLE, jwt.io samples, RFC examples. Matches are marked FIXTURE so documented examples never raise a false alarm. The catalog is bundled with the binary and can be refreshed and signature-verified. - Classify — each remaining candidate gets a verdict: REAL, FIXTURE, or UNKNOWN. This runs offline by default (path rules plus dummy-marker heuristics), or asks the host editor or agent's own language model — no extra API key, no added cost.
- Verify — makes a single harmless API call to the provider to confirm a key is LIVE. Around 25 providers are covered natively (AWS SigV4, GitHub, GitLab, Stripe, OpenAI, Anthropic, Slack, Twilio, SendGrid, Mailgun, Datadog, Heroku, npm, PyPI, DigitalOcean, Hugging Face, Groq, Replicate, Notion, Postman, Figma, Linear, Square, Shopify, Databricks), with a trufflehog binary fallback for the rest. The call goes straight from your machine to the provider — leakferret has no servers.
- Rewrite — swaps a hardcoded literal for an environment-variable lookup
(
ENV.fetch/os.environ/process.env), appends a line to.env.example, and prints seed commands for your secret manager (env, Vault, Doppler, AWS Secrets Manager, or Infisical).
A baseline stores one-way HMAC fingerprints of known findings — never the raw secret — so CI can fail only on new leaks.
Use it with AI agents (MCP)
MCP (Model Context Protocol) is the open standard for giving coding agents tools. Agents hardcode secrets too, and nobody reviews their diffs line by line — leakferret lets the agent self-check before it commits.
Start the server over JSON-RPC on stdio:
Add it to your mcpServers config (Claude Desktop, Cursor, Continue,
Claude Code):
For Claude Code, save that block as .mcp.json in your project root, or add
it with one command:
If you installed the native binary, you can point at it directly instead:
leakferret is also listed in the MCP Registry
as io.github.leakferrethq/leakferret, so registry-aware clients can discover it.
Tools exposed: scan_repository, classify_candidates, verify_finding,
propose_rewrite, and baseline_diff. A classify prompt is also provided so
an agent can classify candidates inline using the model it already has. Two
read-only resources expose the engine's catalog as context: leakferret://secret-types
(every detectable pattern) and leakferret://verifiers (the live-verification providers).
How it compares
gitleaks is the fastest pre-commit regex blocker. trufflehog set the bar for live verification. detect-secrets owns the baseline-a-legacy-repo workflow. GitGuardian is the paid platform with the broadest detectors and a dashboard. leakferret does the regex pre-filter, verifies which keys are live, rewrites the leak to an env var, and runs as an MCP server so coding agents check their own diffs. Full writeup: leakferret.com/compare.
CLI reference
Scan a whole GitHub account or org in one go (handy for finding leaks across all your public repos before someone else does):
Common flags:
Shared flags on scan / verify / rewrite: --format, --show-fixtures,
--exclude <glob>, --only <path>, --only-verified,
--fail-on <none|any|real|verified>.
--backend accepts env, vault, doppler, aws-secrets-manager,
infisical.
Block commits locally (pre-commit hook)
Catch a secret before it is ever committed. From your repo root:
--verify-mode none keeps it fully offline; --fail-on any exits non-zero on
any non-fixture finding (documented examples like AKIAIOSFODNN7EXAMPLE are
still ignored). Pair it with leakferret baseline init so the hook only blocks
on new secrets. To share the hook with a team, commit it to .githooks/ and
run git config core.hooksPath .githooks once.
The hook runs on any git client — the terminal, GitHub Desktop, the VS Code Source Control panel, JetBrains, and so on — because they all run git's pre-commit hook. A blocked commit shows the leakferret output in that client's "commit failed" dialog.
A pre-commit hook is a local convenience, not a wall. Anyone — or any AI
agent — can skip it with git commit --no-verify, and git offers no way to
forbid that locally. So treat the hook as fast feedback, and make the
GitHub Action (or the same
leakferret verify step in your CI) the enforcing gate: it runs
server-side on every push and pull request, where --no-verify can't reach it.
Output formats
Choose with --format:
- pretty — colored terminal output (default).
- json — structured findings for scripting and pipelines.
- sarif — for GitHub Code Scanning. The GitHub Action wrapper
(
leakferrethq/leakferret-action@v1) uploads it for you.
Privacy guarantee
This is the trust story, and a dedicated test enforces it:
The full secret value lives only on disk. It is never written into any report, log, network message, or model prompt. Only a redacted first-4 + last-4 preview (for example
AKIA...4XYZ) ever leaves the process.
Verification sends the key straight from your machine to the provider. leakferret has no servers and collects nothing. Baselines store one-way HMAC fingerprints, never the raw secret.
One operational caveat about verify. Verification makes a real,
authenticated request per candidate, so it lands in the key owner's own audit
log — an AWS STS GetCallerIdentity shows up in CloudTrail, a GitHub token
check shows up as token use, and so on. Point verify only at repositories
whose secrets are yours to test; running it against someone else's code means
authenticating into their accounts and leaving traces there. To scan with no
network calls at all, use leakferret scan instead of verify, or pass
--verify-mode none.
How it compares
- gitleaks is a fast regex scanner. leakferret matches that pre-filter and adds provider verification, so you act on live keys instead of triaging regex noise.
- trufflehog verifies secrets against providers. leakferret matches that too — and adds the MCP/agent layer and the agent-applied rewrite that neither competitor has. The signed fixture catalog also keeps known-public example keys from being reported as live.
Platforms
Prebuilt binaries for v0.1.6:
x86_64-unknown-linux-gnux86_64-apple-darwinaarch64-apple-darwinx86_64-pc-windows-msvcaarch64-pc-windows-msvc
Verifying the binaries
Every release tarball is signed with Sigstore /
cosign — keyless, via GitHub OIDC — and ships a matching *.cosign.bundle. You
can prove a download was built by this repository's release workflow and was
never tampered with:
Each tarball also ships a .sha256 for a basic integrity check.
Links
- Website: https://leakferret.com
- Source: https://github.com/leakferrethq/leakferret
- Catalog data: https://github.com/leakferrethq/leakferret-catalog
- Wrappers: ruby · go · npm · action · vscode
- Maintainer: Maria Khan <[email protected]>
License
MIT for the engine, CLI, MCP server, and all language wrappers. CC-BY-SA-4.0 for the fixture catalog data.
trufflehog is an optional,
user-installed AGPL-3.0 tool that leakferret invokes as a separate process for
fallback verification. It is not bundled, modified, or redistributed. See
NOTICE.
來源:README.md,提交 41b0060
工具
0版本歷史
1- v0.1.13最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分