Skip to content
Habits

Secrets and security AGENTS.md

Agents copy whatever is in the file they just read, including tokens in an example env. This file tells the agent to keep secrets in the environment, to add a dependency only from the registry the project trusts, and to leave authorization checks in place.

Paste, then edit

It is a habit file. Pair it with the language file so the check commands are real.

In this stack

What to tell the agent

Do

  • Name the env example file and say it is placeholders only.
  • Point at the auth helper the routes already call.
  • Say which dependency source is allowed (npm, PyPI, crates.io).
  • Ask the agent to mention auth and SQL changes at the top of the summary.

Leave alone

  • Committing .env, key files, or a pasted bearer token.
  • Turning off certificate checks with a flag such as insecure or NODE_TLS_REJECT_UNAUTHORIZED=0.
  • Logging request headers wholesale.
Starter file

AGENTS.md to copy

Save this as AGENTS.md at the root of the repository, or next to the package it covers. Replace the commands with the ones in this repo. See which agents read the file.

AGENTS.md
# Secrets and security

## Secrets
- Tokens, passwords, and connection strings come from the environment.
- Do not echo a secret in a log line, a test snapshot, a commit message, or the task summary.
- Example env files use placeholders such as "replace-me", never a real credential from the machine.

## Dependencies
- Add a package through the project's manifest. Prefer a release version over a git URL.
- Do not disable TLS verification, signature checks, or a lockfile to make an install succeed.

## Auth
- Keep authorization checks. A failing test is not a reason to skip a permission check.
- Do not add a backdoor query parameter, a default admin password, or a route that skips auth in development and also ships.

## Report
- If you touched auth, sessions, or SQL that includes user input, say so in the first line of the summary.
- If a secret may have been printed, say that too, so it can be rotated.
Commands to confirm

Checks named in the file

Confirm each command exists here before you rely on it. Delete the ones this repository does not use.

  • See tracked env files. git ls-files | grep -E '\.env|credentials|id_rsa' || true
  • GitHub CLI, read-only auth check. gh auth status
FAQ

Questions

What is the Secrets and security AGENTS.md for?

It stops an agent from committing secrets, weakening an auth check, or adding an unpinned dependency to finish a task.

What should an agent do if a task only succeeds with a real token?

Stop and say which token is missing and which env var should hold it. Pasting the token into a file or the summary copies it into git history and into the chat log.

Can an agent relax an authorization check to make a test pass?

Leave the check in place and fix the test's fixture so the caller is actually allowed. A passing suite that skips authorization is a bug.

Keep going

Related on MCPpedia