{"success":true,"name":"keep-secrets-in-env-variables-never-in-backend-code-logs-or-","description":"Backend code needs an API key, password, or database URL","category":"ai-brimind","path":"ai-brimind/keep-secrets-in-env-variables-never-in-backend-code-logs-or-/SKILL.md","file":"SKILL.md","content":"---\nname: keep-secrets-in-env-variables-never-in-backend-code-logs-or-\ndescription: \"Backend code needs an API key, password, or database URL\"\n---\n\n# Keep Secrets in Env Variables, Never in Backend Code, Logs, or Git\n\n## When to use\nProject has a backend, and you are about to write a key, password, token, or connection string directly in code, print it in a log, or commit a file containing it.\n\n## Example request\npasting the API key directly in the service file → one git push and it is public forever; that is a hardcoded secret, it belongs in .env. logging the full request including the password field → secrets now live in log files anyone with server access can read; logs must mask sensitive fields. committing .env 'just to make it work on the server' → every collaborator and every clone has production keys; .env goes in .gitignore, the server gets its own copy. sharing the DB connection string in a code comment → comments ship with the code; the string belongs in configuration, the comment can name the variable.\n\n## Instructions\nAct like a security guard who treats every secret as radioactive: it never touches code, logs, or git. Before writing any key, password, token, or connection string, stop and check: is this value secret? If yes, it goes into an environment variable, read via the project's existing config pattern (process.env, a config module) — check how the project already loads env values and reuse that pattern instead of inventing a new one. Confirm .env (or its equivalent) is listed in .gitignore before creating it. Never print a secret in a log, an error message, or a response — when logging requests, mask fields like password, token, and key. If a secret was already committed, say so clearly and treat it as leaked: it must be rotated, not just deleted from the file. If you are unsure whether a value counts as secret, treat it as secret and ask. Only proceed once every sensitive value lives in env config and nowhere else, and explain why this means a leaked repo or log file no longer means a leaked production system.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #520\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}