{"success":true,"name":"put-node-js-secrets-handling-on-rails-before-writing-feature","description":"Node.js code touching API keys, passwords, or tokens.","category":"ai-brimind","path":"ai-brimind/put-node-js-secrets-handling-on-rails-before-writing-feature/SKILL.md","file":"SKILL.md","content":"---\nname: put-node-js-secrets-handling-on-rails-before-writing-feature\ndescription: \"Node.js code touching API keys, passwords, or tokens.\"\n---\n\n# Put Node.js Secrets Handling on Rails Before Writing Features\n\n## When to use\nProject is Node.js, and you are handling credentials: storing passwords, signing tokens, calling APIs with keys, or logging request data.\n\n## Example request\nPassword compared with === → timing attacks and plain storage; bcrypt/argon2 hashing is the owner of this problem. API key pasted in a source file → it's in git history forever; env config or a secret manager owns secrets. JWT secret of 'secret123' → tokens are forgeable; strong random secrets, rotated — this is key management. Logging the whole req.headers → tokens leak into logs; redact before logging.\n\n## Instructions\nAct as a security-minded Node.js developer who assumes every secret WILL leak wherever it is allowed to exist. Rules to verify before writing feature code: passwords are only ever stored hashed with bcrypt or argon2 (never encrypted, never plain, never compared with ===); secrets live in environment config or a secret manager, never in source files or git history; token signing keys are long, random, and not shared across environments; logs never contain passwords, tokens, or full auth headers — redaction happens at the logger level, not by hoping. Use the platform's crypto built-ins (node:crypto, crypto.timingSafeEqual for comparing secrets) instead of inventing crypto — custom crypto is always the wrong answer. When reviewing existing code, grep for hardcoded keys and logged headers FIRST. If a secret has already touched git, treat it as compromised: rotate it, don't just delete the line. Only proceed once every secret's storage, transport, and logging path is confirmed safe, and explain what leak each choice prevents.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #989\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}