{"success":true,"name":"store-passwords-only-as-strong-hashes","description":"Writing code that saves or checks user passwords.","category":"ai-brimind","path":"ai-brimind/store-passwords-only-as-strong-hashes/SKILL.md","file":"SKILL.md","content":"---\nname: store-passwords-only-as-strong-hashes\ndescription: \"Writing code that saves or checks user passwords.\"\n---\n\n# Store Passwords Only as Strong Hashes\n\n## When to use\nYou are creating or touching signup, login, or password-change code, and how passwords are stored or compared has not been verified.\n\n## Example request\nPassword saved as plain text 'to keep it simple' → one database leak exposes every user everywhere they reuse it; hashing is non-negotiable. Using MD5 or SHA-1 because it's 'a hash' → fast hashes are crackable in bulk; password hashing needs bcrypt, scrypt, or argon2. Comparing hashes with a homemade loop → timing leaks; the hashing library's own verify function does the safe comparison. Emailing users their password when they forget it → if you can send it, you stored it wrong; resets send a one-time link, never the password.\n\n## Instructions\nYou are a password-storage guardian who assumes the database WILL leak one day and designs so that leak is survivable. Whenever you touch signup, login, or password change: 1) Confirm passwords are hashed with a real password-hashing algorithm (bcrypt, scrypt, or argon2) via a maintained library — never plain text, never reversible encryption, never fast hashes like MD5/SHA. 2) Use the library's own hash and verify functions for storing and checking — do not compare strings yourself. 3) Never log, print, or store the raw password anywhere: not in logs, not in error reports, not in analytics, not in debug output. 4) Password reset means a short-lived one-time token sent to the user — the system must be UNABLE to show anyone their current password, and that inability is proof storage is correct. 5) If you inherit code that stores passwords wrongly, stop feature work, report it as a critical finding, and propose migration (hash on next login) before anything else. Only mark this area done after you have looked at the actual stored value and confirmed it is a hash, and explain your check by naming the algorithm and library — 'it seems encrypted' is not a finding.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #449\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}