
Klarion
io.github.0x1Adi由 GitHub 帳號 0x1Adi 發布v0.4.3更新於 Oct 24, 2026
Secret scanning for AI agents: rules and entropy find candidates, a model decides which are real.
概覽
Klarion 掃描程式碼中的密鑰(API key、密碼、權杖),先用本機規則與熵檢測找出候選,再由 AI 模型判斷哪些是真的。
- 可以做什麼
- 在寫入程式碼或提交前掃描文字或檔案中的密鑰,候選由模型判定或交給呼叫它的 agent 判斷
- 辨識已知密鑰格式、password = value 式賦值、憑證檔案以及藏在 base64 或十六進位中的密鑰,並做隨機性檢查
- 回報發現項目,含嚴重等級、位置、遮蔽後的值與附信賴度的判定
- 抑制誤報並檢視被抑制的內容
- 除 MCP 伺服器外,另提供命令列掃描、提交掛鉤與 CI 用法
- 適用情境
- 適合在助理撰寫或修改程式碼時,於檔案寫入或提交之前攔截密鑰;也適合對某個被標記的字串是否為真實憑證(而非測試值或雜湊)做二次判斷。
- 執行需求
- 以本機程序(stdio)方式在使用者機器上執行,可透過 Homebrew、Go、發行版二進位檔或打包檔安裝。判定需要模型:預設使用 ANTHROPIC_API_KEY,也可在 .klarion.toml 中設定 OpenAI 相容金鑰、本機 Ollama 模型或 Claude Code 登入。未設定模型時,伺服器會把候選交給呼叫它的 agent 判斷。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Klarion,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[CI] [Go Reference] [License MIT]
Install · Use it · Results · How it works · Reference
Klarion finds secrets in your code: API keys, passwords and tokens.
It works in two steps:
- Find. Fast local checks flag anything that looks like a secret.
- Check. An AI model reads each one with the code around it and decides if it is real.
Pattern scanners stop at step 1, so they also flag test values, IDs and hashes. Klarion shows you the real leaks.
It runs where the leak happens
A Claude Code hook that blocks the write before the file exists. The agent cannot route around it, not through the file tools and not through Bash.
Install
macOS:
Anywhere else, with Go 1.25 or newer:
Or download a binary from the releases page.
Klarion needs an AI model. Pick one:
Settings go in .klarion.toml under [ai]. All options are in the reference.
Use it
On a pull request it scans only what the PR adds. It caches the AI answers, so unchanged code
costs nothing. Findings show in the job log. On a private repo without GitHub Code Security,
add upload-sarif: "false" to skip the Security tab upload. GitLab CI and every option are in
the reference.
Without the stages line the hook is off and runs only when you ask for it, with
pre-commit run --hook-stage manual klarion. The klarion hook builds Klarion with Go the
first time it runs; use id: klarion-system if klarion is already installed. Everyone who
commits needs a model set up.
The agent calls scan_text before it writes code and scan_file before it commits. Approve
each call rather than auto-approving the server: scan_file reads any path it is given. With no
model configured the server hands each candidate and its decision rules to that agent to judge,
so it needs no API key. Configure one and Klarion judges instead. Full steps, including the
tools and how to verify the install: llms-install.md.
Results
Klarion found about 1.7× more real secrets than gitleaks, and 89% of its alerts were real (gitleaks: 91%).
We tested Klarion v0.3.0 on CredData: 337 real open source repos where Samsung labeled the lines that hold secrets. These numbers cover code outside test folders.
Good to know:
- Klarion skips test fixtures and docs examples on purpose. CredData counts those as real. Counted that way, Klarion found 9% and gitleaks 46%.
- Klarion's numbers come from a sample of 612 AI checks with one model (Claude Haiku). The likely range is 30 to 40% found and 82 to 97% real.
- CredData's labels came from what other scanners found, which helps those scanners.
Full method and data: benchmark/REPORT.md.
How it works
[Step 1 runs local checks and finds candidates. Step 2 an AI model checks each one: real secrets fail the scan, the rest are hidden.]- Step 1 runs on your machine. It looks for known key formats,
password = valuestyle lines, credential files like.pgpass, and secrets hidden in base64 or hex. It also checks how random a string looks. - Step 2 asks the model. Each candidate goes out with a few lines of code. The model answers secret, false positive or uncertain. Uncertain counts as a secret.
- You can see what was hidden. Run
klarion scan . --show-suppressed. - Your code goes only to the model you pick. Set
send_secret = falseto send a masked value instead. It is less accurate.
Limits
- It needs a model. Without one,
klarion scanand the commit hooks stop with an error. The Claude Code hook still blocks provider keys such as AWS, GitHub and Stripe, and the MCP server hands the candidates and its rules to your agent to judge. - No API key? A hosted judge with no setup is coming. Join the list.
- The model can be wrong. Check what it hid with
--show-suppressed. - It finds secrets, it does not fix them. Rotate any secret it finds.
- Local hooks can be skipped with
git commit --no-verify. Run Klarion in CI too, with the Action. The pre-commit hook checks staged changes only, so in CI it has nothing to check.
More
Reference · Benchmark · Design · Changelog · Contributing · Security
MIT © The Klarion Authors
來源:README.md,提交 cb36931
工具
0版本歷史
3- v0.4.3最新Sep 21, 2026
- v0.4.1Sep 19, 2026
- v0.3.8Sep 18, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分