Search the site
Find pages, case studies and writing
Skip to content
All writing

Stop your coding agent printing your API keys

Coding agents love to open a .env file or echo a key to check it is set. I built nopeek so agents can use credentials without printing them. What it does, and what it does not.

I got tired of coding agents doxxing my secrets.

Ask an agent to call an API and, sooner or later, it’ll open the .env file to find the key, or echo it to check it’s set. Everything the agent prints can end up in the model’s context, and from there with the model provider.

LLMs love using tools. So I made them a tool: nopeek. It lets an agent use a credential without printing it.

How it works

Tell the agent to run the command through nopeek, naming only the keys it needs:

Bash
npx nopeek run .env --only DATABASE_URL -- sh -c 'psql "$DATABASE_URL" -c "SELECT count(*) FROM users"'

nopeek reads the file locally and hands the selected values to that one child process. Its own output reports key names and whether they loaded, never the values.

You don’t need to spell the command out every time. Mention nopeek in the session and the agent can work out the rest.

What it doesn’t do

It reduces accidental disclosure. It doesn’t make credentials inaccessible. The child command gets the real value and can still print it, so pick commands that don’t dump their environment or verbose authentication output.

In my own agent setup I add a second layer: best-effort redaction of tool output before it reaches the model. It isn’t 100%, but it’s a lot better than what was there before.

How I use it

It’s part of how I work every day, on client projects and my own. Testing a third-party API key, running a production data job, validating credentials before work starts on a new machine: the agent does the work, and the credential doesn’t pass through the conversation.

What a team gets from this

If your team uses coding agents on anything with credentials, handling them is part of the rollout, not an afterthought. A small, boring default like this closes one of the most common ways credentials leak from agent sessions.

Rolling out coding agents and worried about what they can see? Let’s talk.