T09 · Insecure Skill Coding Practices
- Location
references/components/assistance_password_comparation.txt:18- Finding
Plaintext Password Disclosure in Client-Side Reference Component
- Content
View full analysis
, ) => { if ( confirmPassword.length >= password.length && e.target.value.length > confirmPassword.length ) { setShake(true) } else { setConfirmPassword(e.target.value) } } useEffect(() => { if (shake) { const timer = setTimeout(() => setShake(false), 500) return () => clearTimeout(timer) } }, [shake]) const getLetterStatus = (letter: string, index: number) => { if (!confirmPassword[index]) return '' return confirmPassword[index] === letter ? 'bg-green-500/20' : 'bg-red-500/20' } const passwordsMatch = password === confirmPassword ``` The original password is then rendered directly: ```tsx → {password} ``` ### Technical Analysis The component accepts the authoritative password as a client-side React prop, uses it for character-by-character comparison, and explicitly renders it as visible text. Consequently, a real password supplied to this component would be available in the page DOM, React component state or props, browser developer tools, memory snapshots, screenshots, and screen recordings. Using `type="password"` only masks the confirmation input. It does not protect the original password passed through the `password` prop or the plaintext value rendered by the `` element. The Skill primarily creates public institutional websites. A password-confirmation component is not required for that fun ...[truncated 1203 chars]- Remediation
View remediation
Confirm your password ``` 4. For registration or password-change forms, collect the new password and confirmation value from two masked inputs and compare only those two user-entered values. 5. Send passwords only over TLS to a trusted backend. 6. On the backend, process passwords using a dedicated password-hashing algorithm such as Argon2id, scrypt, or bcrypt with appropriate parameters and unique salts. 7. Never log passwords or expose them through diagnostics, analytics, component props, error messages, or telemetry. 8. Clear password-related client state when the form is submitted, cancelled, or unmounted. 9. Add automated tests that fail if password values are rendered into visible DOM text. ]]>
