Hello Rustaceans! :waving_hand:

I built SecretGuard, an open-source terminal privacy guard in Rust that intercepts API keys and credentials at the keystroke level before commands ever touch persistent disk (~/.zsh_history, ~/.bash_history) or local AI coding agent logs (Claude Code, Cursor).

Why Rust?

To make a pre-exec line-hook imperceptible, it has to run in microseconds. SecretGuard achieves 15.68 µs (0.016 ms) average scan latency across 1,000 synthetic commands with a 1.56 MB static binary footprint (opt-level = 3, lto = true, codegen-units = 1, panic = "abort").

Architecture:

  • Tier 1 (RegexSet): Compiled in-memory matcher for known SaaS signatures (OpenAI, AWS, GitHub, Stripe, Slack, Postgres URIs).
  • Tier 2 (Contextual Shannon Entropy): Evaluates character probability distribution ($H \ge 3.6$) for raw passwords while eliminating false positives like UUIDs and Git commit hashes.

Core Capabilities (v0.1.2):

I would love to get the community's thoughts on the entropy heuristics and benchmark methodology!

2 posts - 1 participant

Read full topic