egrix 0.2.1

Find leaked credentials and suspicious network destinations in AI agent transcripts. Local, offline, redacted by default.
egrix-0.2.1 is not a library.

Coding agents keep a transcript of everything: the .env you pasted, the token a command printed, every URL they fetched or uploaded to. Those files sit in your home directory in plain text, for months.

egrix reads them and answers two questions:

  1. Which credentials are sitting in my agent history?
  2. Which outside hosts did my agents talk to, and do any look wrong?

Then it helps you clean up. It runs on your machine, reads your transcripts without sending them anywhere, and redacts every value it prints unless you pass --reveal. The only network use is the update check: it asks GitHub for the latest release once a day and, unless turned off, installs it after verifying its SHA-256.

Updates

egrix checks GitHub releases once a day in a background process and installs a newer release, verified against sha256sums.txt. The result is announced on the next run. Control it with:

egrix update                 # check and install now
egrix update --check         # only report
egrix update --disable-auto  # keep checking, never install on its own

Environment: EGRIX_AUTO_UPDATE=0|notify|1 and EGRIX_NO_UPDATE=1 (no checks at all).

Install

cargo install egrix

Needs Rust 1.85 or newer. For a build without the dashboard, add --no-default-features.

Prebuilt binaries for Linux (x86_64, aarch64), macOS (Apple silicon) and Windows are attached to each release, with checksums and build provenance:

gh attestation verify egrix-linux-x86_64 --repo juninmd/egrix

Quick start

egrix            # dashboard in a terminal, plain summary when piped
egrix scan       # summary: secrets and hosts, grouped by repository
egrix secrets    # the credentials, with where and when each one leaked
egrix egress     # the hosts, worst first

A leaked credential takes two steps to fix, and egrix tracks both:

# 1. Rotate it at the provider. Only you can do that. Then record it:
egrix mark 3fa9c2d1 --rotated

# 2. Mask it in the transcripts, so it stops sitting on disk:
egrix fix --id 3fa9c2d1

A secret is resolved only when it is rotated and masked. Masking alone revokes nothing.

The dashboard

Run egrix in a terminal. Three screens, one key each.

Key Where What it does
1 2 3 everywhere Summary, Secrets, Egress
enter Summary open that repository's secrets
enter Secrets, Egress show the transcript around the finding (n / p step through sightings)
/ Secrets, Egress filter; esc clears it
s everywhere period: all time, 30 days, 7 days
u Summary repository name or its remote (github.com/owner/name)
t Secrets mark the credential as rotated
m / M Secrets mask this one / everything in the list
u / U Secrets undo the mask on this one / on everything in the list
i Secrets mark a false positive
r Secrets reveal the value, after a confirmation
g Secrets group by repository, remote, rule or agent
a / d Egress allow or deny the host, for this and later scans
b everywhere accept everything listed as the baseline
? q everywhere help, quit

M respects the active filter and period, and says how many secrets and files it will touch before doing anything.

Scripts, CI and agents

The dashboard opens only when both stdin and stdout are a terminal. Everywhere else egrix prints plain text, so it is safe to call from a hook, a pipeline or an agent.

egrix scan --json                 # machine-readable, values never included
egrix scan --sarif > egrix.sarif  # for code-scanning dashboards
egrix scan --since 7d --repo shop-api --agent claude
egrix baseline                    # accept what is there; fail only on new findings
Exit code Meaning
0 no new findings
1 new findings
2 something went wrong

What it reads

Agent Location
Claude Code ~/.claude/projects
Codex CLI ~/.codex/sessions
Gemini CLI ~/.gemini/tmp, ~/.gemini/history
GitHub Copilot CLI ~/.copilot/session-state, ~/.copilot/logs
Antigravity ~/.gemini/antigravity

Each finding is attributed to a repository through the working directory the transcript recorded. The remote comes from reading .git/config: no git process is started and nothing is fetched.

Not covered yet: Copilot Chat in VS Code, which stores history in a database rather than text files.

How masking works

egrix fix replaces each value in place with [REDACTED:<id>] and keeps a private copy of the original file under ~/.local/share/egrix/backup. egrix fix --undo puts the values back.

  • It asks before writing. Without a terminal it refuses, unless you pass --yes.
  • Private keys are masked through the END line, not just the header.
  • Close your agents first: one that is running may rewrite its transcript.
  • The backup holds the original values. Delete it once the credential is rotated.

Hosts

Every host gets one of three verdicts.

Verdict Meaning
✗ flagged paste sites, file drops, tunnels, request catchers, raw IP addresses, or anything on your deny list
? unknown no rule matches; yours to judge
✓ allowed well-known developer hosts, or anything on your allow list
egrix hosts allow cdn.mycompany.com
egrix hosts deny  suspicious.example
egrix egress --show transfer.sh     # what was sent or fetched

allow and deny take a bare host, a host:port, or a full URL; egrix stores the bare host and matches it with its subdomains. IPv6 literals are accepted with or without brackets.

A flagged host means "look at this", not "you were breached". egrix reads what the agent wrote down; it does not watch the network.

Rules

63 rules ship in the binary, covering cloud providers, source hosts, payment and messaging services, private keys and common connection strings.

egrix rules list
egrix rules test some-file.txt

Add your own as *.toml in ~/.config/egrix/rules/. A rule with a built-in id replaces it.

[[rules]]
id = "acme-internal-token"
pattern = '''acme_[A-Za-z0-9]{32}'''
severity = "high"

Rules are read only from your own configuration directory, never from the repository being scanned, so a cloned project cannot switch detection off.

Files

Path Holds
~/.config/egrix/hosts.toml your allow and deny lists
~/.config/egrix/rules/*.toml your rules
~/.config/egrix/state.json baseline, and what you rotated, masked or ignored
~/.local/share/egrix/backup/ originals of masked files

XDG_CONFIG_HOME and XDG_DATA_HOME are honored. State stores fingerprints and previews, never values.

Design

src/
  main.rs       entry: dashboard in a terminal, summary otherwise
  cli.rs        arguments only
  commands.rs   one function per command
  scan.rs       transcripts in, Report out
  sources.rs    where each agent keeps its history
  rules.rs      secret rules and matching
  hosts.rs      host extraction and verdicts
  git.rs        working directory to repository, without running git
  fix.rs        masking and undo
  context.rs    readable transcript excerpts, redacted
  state.rs      what you already know and did
  model.rs      the data everything else shares
  report/       text, JSON, SARIF
  tui/          app (state), ui (drawing), mod (keys)

The scan is a pure function from files to a Report. Every output, the dashboard included, renders that same report.

Limits

  • Pattern matching finds known credential shapes. It misses secrets with no recognizable format and it can flag look-alikes; i or egrix mark <id> --ignored handles those.
  • It only sees what an agent wrote to disk.
  • Transcripts larger than 50 MB are skipped.

Development

cargo test
cargo clippy --all-targets -- -D warnings
cargo fmt --check

Releasing

Merging to main releases automatically when the commits since the last tag follow Conventional Commits: fix: and perf: bump the patch, feat: the minor, ! or BREAKING CHANGE: the major. The pipeline runs the checks, writes the version, builds the binaries, creates the GitHub release and publishes to crates.io through Trusted Publishing.

License

MIT