skills/password-based-authentication-pattern/SKILL.md
Security pattern for implementing password-based authentication. Use when designing login systems with username/password, implementing password storage, hashing, salting, peppering, password policies, or password reset flows. Specialization of the Authentication pattern.
npx skillsauth add igbuend/grimbard password-based-authentication-patternInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A subject proves identity by providing a correct identifier (username/email) and corresponding password. Relies on the assumption that only the actual owner knows the correct password.
| Role | Type | Responsibility | |------|------|----------------| | Subject | Entity | Provides identifier and password | | Enforcer | Enforcement Point | Ensures authentication before action processing | | Verification Manager | Entity | Collects inputs for password verification | | Comparator | Decision Point | Compares hash values | | Hasher | Cryptographic Primitive | Calculates hash values | | Password Store | Storage | Keeps hash values for registered identities | | Registrar | Entity | Handles subject registration | | Resetter | Entity | Handles credential reset | | Password Policy | Information Point | Rules passwords must satisfy | | SRNG | Cryptographic Primitive | Secure random number generator |
Three approaches for credential determination:
Upon completion:
Enforce policies including:
development
Security anti-pattern for Cross-Site Scripting vulnerabilities (CWE-79). Use when generating or reviewing code that renders HTML, handles user input in web pages, uses innerHTML/document.write, or builds dynamic web content. Covers Reflected, Stored, and DOM-based XSS. AI code has 86% XSS failure rate.
development
Security anti-pattern for XPath injection vulnerabilities (CWE-643). Use when generating or reviewing code that queries XML documents, constructs XPath expressions, or handles user input in XML operations. Detects unescaped quotes and special characters in XPath queries.
development
Security anti-pattern for weak password hashing (CWE-327, CWE-759). Use when generating or reviewing code that stores or verifies user passwords. Detects use of MD5, SHA1, SHA256 without salt, or missing password hashing entirely. Recommends bcrypt, Argon2, or scrypt.
development
Security anti-pattern for weak encryption (CWE-326, CWE-327). Use when generating or reviewing code that encrypts data, handles encryption keys, or uses cryptographic modes. Detects DES, ECB mode, static IVs, and custom crypto implementations.