Secret leak guards

Cloak keeps secret values out of the model context. These guards stop the other ways an agent can move a secret: to a file, to a host, to a public registry, or out of a token store that Cloak does not manage.

They are on by default after prismor cloak install (the hook guards) and with the default policy (the rules). You do not configure them.

GuardWhat it stopsResult
Vault flowA vaulted .env sent anywhere other than the scrubbed tool outputdeny
Raw values in tool inputA real vaulted value in a Write, Edit or MCP calldeny
MCP output scrubA key in the result of an MCP toolkey is replaced
Token storesShell reads of CLI token files and browser cookie storesdeny
Credential commandsCommands that print, mint or copy a credentialask
Production secretsReading env, secrets or databases on a production hostask
Publish gateA build, push or upload that would ship a secretdeny

"Ask" means the user approves the call. "Deny" means the call does not run, and the message tells the agent what to do instead.

Vault flow

After prismor cloak add --env-file .env, every value in .env is in the vault. The Bash output scrub replaces those values in what the model sees. But the scrub sees only the tool output. A command that sends the file somewhere else would send the real values.

So when a .env file is fully vaulted, a Bash command can show it, but cannot send it anywhere else:

grep -c KEY .env                         # allowed: output is scrubbed
sed 's/=.*/=<set>/' .env                 # allowed
ls -la .env* | awk '{print $9}'          # allowed: names only
cat .env | curl -d @- https://...        # denied: piped into a sender
cat .env > copy.txt                      # denied: copied to a file
python3 -c "print(open('.env').read())"  # denied: a script reads it

These also pass: heredocs that only contain the text .env, loops that only print, prismor cloak ..., vercel env pull, a copy into another env file, and git commit.

To use a value in a command, use its placeholder. Decloak puts the real value in at run time:

curl -H "Authorization: Bearer @@SECRET:OPENAI_API_KEY@@" https://api.openai.com/v1/models

To start your app with its env file, run it yourself or load the env in the app. node --env-file=.env from the agent is denied, because the process gets the real values.

Raw values in tool input

Decloak runs only for Bash. If the agent writes a real vaulted value into a file, an edit or an MCP call, nothing replaces it. secret-guard denies that call. Use the placeholder in Bash, or read the value from the environment in code:

KEY = os.environ["OPENAI_API_KEY"]   # good
KEY = "sk-proj-..."                  # denied when the value is in the vault

MCP output scrub

When an MCP tool returns a string that matches a key pattern, recloak-mcp puts it in the vault and replaces it with its placeholder before the model sees it. The agent can still use the key through the placeholder.

Token stores and credential commands

CLI tools keep tokens in files that Cloak does not manage. These rules cover them.

RuleExampleResult
credential-store-shell-readcat ~/.kube/config, cat ~/.config/gh/hosts.yml, a query on a browser cookie DB, a tar of ~/.awsdeny
secret-accessThe Read tool on the same filesdeny
credential-printgh auth token, aws configure get aws_secret_access_key, gcloud auth print-access-token, kubectl config view --rawask
credential-mintaws iam create-access-key, kubectl create tokenask
clipboard-readpbpaste into the outputask

The usual commands still work: kubectl --kubeconfig ~/.kube/config get pods, gh auth status, aws sts get-caller-identity, pbpaste > file, and TOKEN="$(gh auth token)" npx server (the token goes to the process, not the output). Writing .env.example is allowed.

Production secrets

prod-secret-read asks before the agent reads live production credentials:

ssh deploy@prod-api 'cat /srv/app/.env'       # ask
kubectl get secret app -n dev -o yaml         # ask, in any namespace
kubectl exec -n prod deploy/api -- printenv   # ask
psql "postgres://admin@prod-db/app" -c "..."  # ask
scp deploy@prod-api:/srv/app/.env ./          # ask

Usual production work does not ask: tail logs, systemctl restart, kubectl get pods, kubectl describe secret and scp of a release to the host. Prismor knows a production host or namespace from its name (prod, production, prd).

Publish gate

A build, push or upload ships files, not context, so the scrub cannot help. Before one of these commands runs, the publish gate lists the files the command would ship and looks in them, and in archives inside them, for an env file with values, a vaulted value, or a string that looks like a key.

CommandWhat it checks
docker build, podman build, buildah budthe build context, minus .dockerignore
docker compose build, up, create, run (and docker-compose)the build context of every service with a build:, minus its .dockerignore
npm publish / pack (and pnpm, yarn, bun), cargo publishthe files the package would contain
git addthe files it would stage
git pushthe commits that are not on any remote yet
gh release upload/create, gh gist create, twine upload, gem pushthe files named, and an archive built earlier in the same command
curl -F/-T/--data-binary @file, wget --post-filethe file named
aws s3 cp / gsutil cp with a public ACLthe file named

Example message:

`docker build` would ship the env file '.env'

To fix it, add the file to .dockerignore or .gitignore, remove the value from the file, or use a placeholder. scp and rsync to a host, and private bucket copies, are not checked: they go to storage you control.

When a guard is wrong

The block message has the steps. The user runs them in their own terminal:

prismor approvals approve <id>                                  # this call, once
prismor allow credential-print --pattern 'gh auth token' --expires 2h
prismor allow prod-secret-read --observe                        # report, do not ask

To leave out a hook guard when you install Cloak:

prismor cloak install --no-env-guard      # no vault-flow or unimported-.env check
prismor cloak install --no-secret-guard   # no raw-value check on tool input

Limits

  • The guards look at the tool call. Code that the agent runs (a script or a package) can open files and connect to hosts in ways a command line does not show. Use the sandbox and egress control for that.
  • A file name built at run time is not seen as a .env file.
  • The publish gate reads at most 20,000 files and skips files over 5 MB.

See also