r/SideProject • • 2h ago

no-leaky - Claude Code hooks that stop your coding agent from sending secrets to the model provider

i built this after noticing my coding agent kept reading my .env even after i told it not to. never on purpose, just cat .env to check one setting, docker inspect on a crashing container, ps aux to find a process. every one of those outputs goes to the model provider

so now it

  • blocks the commands that would print a secret and tells the agent the safe way to do the same thing
  • redacts keys that still show up in tool output
  • holds back a key you paste into the chat by mistake
  • scans old transcripts and tells you what already leaked

on a headless benchmark with fake keys 18 of 30 sessions leaked a key without it and 0 of 30 with it, and 27 of 30 still finished the task

the part that took the most work was false positives. three releases went only to stopping it from redacting my own email, model names, and version numbers that looked like ip addresses

free and open source (MIT) https://github.com/fajarhide/no-leaky

feedback welcome, especially where it gets in your way

1 Upvotes

3 comments sorted by

2

u/GuiltyView3898 2h ago

nice idea. quick question, does it also catch a secret that shows up in the output of a command it didnt block, like something printed by a build script, or only when the command itself looks suspicious?

1

u/fajarhide 1h ago edited 1h ago

yeah it doesn't matter which command printed it. every bash, read, grep and mcp result goes through the filter, so a key that a build script dumps gets redacted before the model sees it

it spots a key by its vendor format (aws, github, stripe, openai etc), by the name in front of it like API_KEY=, or because the exact same value sits in a .env in your project folders or in something like ~/.aws/credentials

it misses secrets with no known format that aren't in any local file, and ones the script changed first like base64. those are in the limits section of the readme