SuperAPI AI Directory

spillscan

spillscan is a command-line tool for scanning the session record files of local AI coding assistants (such as Claude Code, Codex, Cursor, Gemini CLI, and OpenCode) to find sensitive information such as keys and tokens that were accidentally leaked, and to redact it in place after making a backup. It supports fingerprint allowlists, path allowlists, and provides a PreToolUse guard hook for Claude Code that blocks commands that could leak environment variables.

Open website

About this tool

spillscan is a command-line tool written in Go, designed to solve the problem of keys being accidentally leaked in AI coding assistant session records. When a user runs commands such as env, printenv, or cat .env in an AI agent's Bash invocation, live credentials are written into plain-text session JSONL files (for example, ~/.claude/projects//*.jsonl, ~/.codex/sessions//*.jsonl, etc.). spillscan can scan these files, find leaked keys, and redact them in place after making a backup.

Main capabilities:

  • Scan local AI agent session records, supporting agents such as claude-code, codex, cursor, gemini-cli, and opencode.
  • Identify and redact leaked keys, including copies that Claude Code keeps alongside a session: large tool outputs that overflow into <session>/tool-results/ and set-aside *.jsonl.superseded-<timestamp> records.
  • Provide a fingerprint allowlist mechanism: use a short fingerprint of a value (the first 8-64 hexadecimal characters of a domain-separated SHA-256) rather than the real value to mark known-harmless fake keys (such as documentation example keys, test fixtures, and tutorial JWTs). The allowlist file is located at ~/.config/spillscan/allow.txt or $XDG_CONFIG_HOME/spillscan/allow.txt, and additional lists can be added via --allow FILE (repeatable); --no-allow ignores all allowlists.
  • Support path allowlists: use globs to match absolute record paths, where * does not cross segments, ** crosses segments, ~/ means the home directory, and a glob without / matches file names. Rule errors are reported with the file and line number.
  • Provide a Claude Code PreToolUse guard hook: install it into .claude/settings.json (project or user level) to reject commands such as env, printenv, cat .env*, and /proc/*/environ, even when they appear in cmd1; env; cmd2 or bash -c '…'.
  • Output is colored in the terminal and can be turned off with NO_COLOR=1 or --no-color; paths are displayed as ~/… to avoid leaking usernames.

Usage:

  • Installation: requires Go 1.24+, run go install github.com/Blackman99/spillscan/cmd/spillscan@latest.
  • Without a Go environment (macOS / Linux): a static binary can be downloaded.
  • Windows: download spillscan_<version>_windows_amd64.zip from Releases and verify it with checksums.txt.
  • Scanning and redaction: run the corresponding commands to scan and redact (the specific command parameters are not fully provided in the material).

Use cases:

  • Developers using AI coding assistants are concerned that environment variables or .env file contents may be written into session records.
  • Need to clean up already-leaked session records while keeping backups.
  • Need to add protection for Claude Code to block commands that could leak environment variables.

Limitations and notes:

  • Redacting records does not revoke credentials; after discovering a key, you should first rotate the key with the provider, then redact.
  • The tool mainly targets local AI agent session records and does not cover network transmission or other leak channels.
  • The specific command-line parameters and complete usage are not described in detail in the material, and some features (such as the MCP scan_report) are mentioned by name only.
  • The reasons for comparison with Stroq / gitleaks are not elaborated in the material; only documentation links are provided.