Skip to content

8.1 Secrets and tokens

No token is in any file of this repository, on any command line or in a synced directory; a token is read with hidden input and reaches curl on stdin (SPEC.md Q-4, root CLAUDE.md (CLAUDE.md), "Never commit a secret" and "Rules the scripts follow"). The reason: a committed token stays in the history, the process list is readable by other users, a chat is stored, and a synced folder carries a file off the machine (setup/secrets.md).

Rules

  1. Never committed. .gitignore excludes *.env; before a commit, the diff is checked for a token value—a key's name is fine, its value never is (root CLAUDE.md). The pre-push hook runs Gitleaks and CI runs TruffleHog over each pull request's commits and weekly over the whole history (ci/checks.md, ADR 0002 (docs/adr/0002-sast-and-secret-scanning.md), proposed, its option 1 the working default).
  2. Never in the chat or on a command line. A script reads a token with hidden input (read -rs) and refuses to prompt when stdin is not a terminal, because a redirected stream would capture it (root CLAUDE.md).
  3. Validated before it is stored, because a pasted value with stray quotes or whitespace fails like a revoked token (root CLAUDE.md, "Validate pasted values").
  4. Tested before it is staged, and the old one revoked only once nothing uses it (setup/token-rotation.md, 8.7).
  5. One store per machine, no copy, which every reader reads itself: the host's token file on the Linux host, the user environment on Windows, filled from the vault where Bitwarden Secrets Manager is set up (setup/secrets.md, the store on Windows, Bitwarden as the source). The one exception is the sandboxes' Anthropic sign-in: sbx keeps that OAuth sign-in in its own store on the host and refreshes it, outside the token file, the user environment and the vault (setup/secrets.md).
  6. No token inside a sandbox. The VM holds placeholders; the sbx proxy puts the real value into the requests to the secret's hosts (setup/secrets.md); 8.3.
  7. A secret is not read into a session. The committed deny rules keep the Read tool off .env files, private keys and the token folders: a secret read into a session is in its transcript (8.3).

Where it is described

Topic How-to
The token file, its readers and the keys it excludes per reader setup/secrets.md, setup/linux-host.md
New tokens, which account, revoking the old one setup/token-rotation.md
Scanning before the push and in CI; a false positive ci/checks.md