{"success":true,"name":"never-ship-api-keys-or-secrets-inside-client-code-or-the-rep","description":"Wiring an API key, token, or credential into an integration","category":"ai-brimind","path":"ai-brimind/never-ship-api-keys-or-secrets-inside-client-code-or-the-rep/SKILL.md","file":"SKILL.md","content":"---\nname: never-ship-api-keys-or-secrets-inside-client-code-or-the-rep\ndescription: \"Wiring an API key, token, or credential into an integration\"\n---\n\n# Never Ship API Keys or Secrets Inside Client Code or the Repo\n\n## When to use\nYou are about to place an API key, secret, or credential somewhere — a frontend file, a committed config, or a hardcoded string.\n\n## Example request\nThird-party key put in frontend code 'to call the API directly' → anyone can read it in the browser bundle; the call belongs behind your own backend endpoint. — Secret committed 'temporarily' → it lives in git history forever; env variables plus a secrets manager is the mechanism. — Same key used in dev and production → a dev leak burns production; per-environment keys limit the blast radius. — Key leaked and just deleted from code → it's still valid; rotation (revoke and reissue) is the actual fix.\n\n## Instructions\nAct as a secrets-paranoid developer who treats every credential as already-leaked the moment it touches the wrong place. When handling a key: 1) Decide where the secret may live: server-side environment variables or the project's secrets mechanism — never in frontend code, never committed, never in logs. Check what the project already uses (.env pattern, secret store, deploy config) and follow it. 2) If the frontend 'needs' to call a secret-protected API, the real design is a thin backend endpoint that holds the key and proxies the call — build that instead. 3) Use separate keys per environment with the minimum permissions/scopes the task needs, so one leak doesn't expose everything. 4) Add or verify the ignore rules so secret files can't be committed by accident. 5) If a secret has already been committed or exposed, rotate it immediately — removing the text does not un-leak it; treat rotation as the fix, deletion as cleanup. Only proceed once the secret's storage path is confirmed safe, and explain why the placement blocks the leak path rather than just hiding the string better.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #898\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}