0x1Adi

klarion

Community 0x1Adi
Updated

AI-powered secret scanner for code and git history. Finds leaked API keys, tokens and credentials with near-zero false positives by pairing Rényi entropy detection with LLM adjudication. Runs as a CLI, pre-commit hook, GitHub Action, MCP server or Claude Code hook. Single Go binary, MIT licensed.

CIGo ReferenceLicense 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:

  1. Find. Fast local checks flag anything that looks like a secret.
  2. 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 showsyou the real leaks.

$ klarion scan .

services/billing/client.py
  [critical] stripe-secret-key  39:18  sk_l****4bQx
    verdict: secret (confidence 0.96)
    | stripe.api_key = "sk_l****4bQx"

Summary: 1 finding(s) across 1 file(s), 198 suppressed [1204 files scanned in 612ms]

Install

go install github.com/0x1Adi/Klarion/cmd/klarion@latest

Or download a binary from the releases page.

Klarion needs an AI model. Pick one:

Model Setup
Anthropic (default) export ANTHROPIC_API_KEY=...
OpenAI or compatible export OPENAI_API_KEY=... and set provider = "openai"
Local model, nothing leaves your machine Run Ollama and set provider = "ollama"
Your Claude Code login Set provider = "claude-cli"

Settings go in .klarion.toml under [ai]. All options are in the reference.

Use it

What you want How
Scan a folder klarion scan .
Block commits that add a secret klarion protect
Block commits with the pre-commit framework The .pre-commit-config.yaml below
Stop Claude Code from writing a secret /plugin marketplace add 0x1Adi/Klarion then /plugin install klarion@klarion
Stop Cline, Cursor or any MCP agent from writing a secret The MCP server below
Fail pull requests that add a secret The GitHub Action below
Start on a repo that already has findings klarion baseline create, so only new secrets fail
# .github/workflows/secrets.yml
name: secret-scan
on: [push, pull_request]

jobs:
  klarion:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: 0x1Adi/[email protected]
        with:
          anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

On a pull request it scans only what the PR adds. It caches the AI answers, so unchanged codecosts 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 inthe reference.

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/0x1Adi/Klarion
    rev: v0.3.8
    hooks:
      - id: klarion
        stages: [pre-commit]

Without the stages line the hook is off and runs only when you ask for it, withpre-commit run --hook-stage manual klarion. The klarion hook builds Klarion with Go thefirst time it runs; use id: klarion-system if klarion is already installed. Everyone whocommits needs a model set up.

// ~/.cline/mcp.json, or the MCP settings of any other client
{
  "mcpServers": {
    "klarion": {
      "command": "klarion",
      "args": ["mcp"],
      "autoApprove": ["scan_text", "scan_file", "verify_finding"]
    }
  }
}

The agent calls scan_text before it writes code and scan_file before it commits. With nomodel 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 thetools 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 opensource repos where Samsung labeled the lines that hold secrets. These numbers cover codeoutside test folders.

Klarion gitleaks detect-secrets
Real secrets found 35% 21% 35%
Alerts that were real 89% 91% 34%
False alarms on flask and rails 9 33 247

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). Thelikely 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 on your machine. It looks for known key formats, password = value stylelines, credential files like .pgpass, and secrets hidden in base64 or hex. It also checkshow random a string looks.
  • Step 2 asks the model. Each candidate goes out with a few lines of code. The modelanswers 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 = false to send a maskedvalue instead. It is less accurate.

Limits

  • It needs a model. Without one, klarion scan and the commit hooks stop with an error.The Claude Code hook still blocks provider keys such as AWS, GitHub and Stripe, and the MCPserver hands the candidates and its rules to your agent to judge.
  • 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, withthe 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

MCP Server · Populars

MCP Server · New

    LeulAria

    Aria Icons

    MCP server for 340k SVG icons

    Community LeulAria
    knowall-ai

    Reverie — graph memory that dreams

    Memory management MCP server for AI agents using Neo4j knowledge graphs

    Community knowall-ai
    keploy

    Key Highlights

    Open-source platform for creating safe, isolated production sandboxes for API, integration, and E2E testing.

    Community keploy
    hermes-labs-ai

    Fidelis Memory

    Zero-LLM agent memory for Claude Code and AI agents: local-first BM25, dense-vector, and reciprocal-rank-fusion retrieval. Returns original passages verbatim by default. Available on PyPI as fidelis-memory. MIT.

    Community hermes-labs-ai
    n24q02m

    Better Code Review Graph

    Knowledge graph for token-efficient code reviews -- semantic search and call-graph resolution across your codebase.

    Community n24q02m