
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 分