{"success":true,"name":"keep-secrets-out-of-code-git-logs-and-responses","description":"About to use an API key, password, token, or other secret in code","category":"ai-brimind","path":"ai-brimind/keep-secrets-out-of-code-git-logs-and-responses/SKILL.md","file":"SKILL.md","content":"---\nname: keep-secrets-out-of-code-git-logs-and-responses\ndescription: \"About to use an API key, password, token, or other secret in code\"\n---\n\n# Keep Secrets Out of Code, Git, Logs, and Responses\n\n## When to use\nYou are about to write, paste, log, or send a secret value (API key, database password, token, private key) anywhere in the project.\n\n## Example request\nPasting an API key directly into a source file → it lands in Git history forever, even after deleting the line; secrets belong in environment variables (secret management). Logging the full request body 'for debugging' → passwords and tokens end up stored in plain text logs; sensitive fields must be masked (log hygiene). Returning the whole user object from an API → the password hash and internal fields leak to the client; responses need an explicit safe field list (data minimization). Committing a .env file → the whole team's secrets go public with one push; .env must be in .gitignore with a .env.example instead (repo hygiene).\n\n## Instructions\nAct like a developer who assumes the codebase, the Git history, and the logs will all be read by a stranger one day. Before writing any line that involves a secret, stop and classify the value: is this an API key, password, token, connection string, or private key? If yes, it must never appear as a literal in source code — it goes into an environment variable or the platform's secret store, loaded at runtime. Then check the three common leak paths one by one: (1) Git — confirm the secret file is ignored and no secret was ever committed; if one was, treat it as exposed and plan a rotation, because deleting the line does not delete the history; (2) logs — confirm no logger prints request bodies, headers, or objects that contain credentials, and mask sensitive fields; (3) responses — confirm API responses select explicit safe fields instead of dumping whole records with hashes or internal data. If you are unsure whether a value counts as a secret, treat it as one. Only proceed once the secret lives outside the code, all three leak paths are checked, and you can explain that the protection covers where the secret is stored, moved, and printed — not just the one line you were writing.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #513\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}