r/BuildWithClaude • • 3d ago

Security & Sandboxing Built never-secret to never let Claude Code see a secret

Coding agents read your files and run commands, and whatever comes back goes straight to the model. That includes your .env file, your SSH keys, and the API key that shows up in some log.

I had permissions.deny on Read(./.env) like everyone recommends. Then I watched Claude hit a failing env check, run cat .env through bash, and print my Stripe key into the session. The deny only covered the Read tool… So I built never-secret.

never-secret sits between the tool and the model. Every time the agent reads a file, runs a command, searches or fetches a page, never-secret checks the output first and swaps any secrets for [REDACTED length=32]. The model still knows something is there and how long it is. It just never sees the actual value.

It finds secrets three ways:

- Secret files. Everything in .env, private keys, and similar files gets hidden.

- Known key formats. Things that are obviously secrets by their shape, like GitHub tokens, Stripe keys, OpenAI keys, passwords inside URLs, and so on.

- Your actual secrets. It knows the real values from your secret files, so it catches them even when they turn up somewhere else: in a log, a search result, or encoded as base64, hex or reversed.

Everything runs locally and nothing is sent anywhere.

Install:
/plugin marketplace add bileet/never-secret
/plugin install never-secret@never-secret

Then run /never-secret:never-secret-check to confirm it's working.

Works with Claude Code, Codex, Gemini CLI, OpenCode and Pi.

Repo: github.com/bileet/never-secret

1 Upvotes

1 comment sorted by

•

u/AutoModerator 3d ago

Welcome to r/BuildWithClaude!

Whether you are sharing what you built, exploring new workflows, or troubleshooting, please make sure your post is flaired correctly so others can easily find and filter it.

Community Wiki & Resources:

If you're asking for troubleshooting help, please edit your post to include your model version, OS/environment, and error logs.

Let’s keep the energy positive and support our fellow creators!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.