[CRE-1848] Don't output hashed passwords.#21601
Conversation
|
I see you updated files related to
|
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
Risk Rating: MEDIUM (touches authentication/user credential handling paths)
This PR updates the sessions.User model so hashed passwords are stored as a redacted secret type, reducing the risk of leaking password hashes via serialization/logging, and updates call sites/tests accordingly.
Changes:
- Change
sessions.User.HashedPasswordfromstringtoconfig.SecretString. - Update password verification to unwrap
SecretStringwhen callingutils.CheckPasswordHash. - Update tests/SQL inserts to account for the new
SecretStringtype.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| core/web/user_controller.go | Unwrap SecretString when checking old password on password update. |
| core/web/resolver/mutation.go | Unwrap SecretString when checking old password in GraphQL mutation. |
| core/web/resolver/user_test.go | Update tests to set HashedPassword as SecretString (one case still needs updating). |
| core/web/resolver/api_token_test.go | Update tests to set HashedPassword as SecretString. |
| core/sessions/user.go | Change HashedPassword to config.SecretString and wrap on user creation. |
| core/sessions/oidcauth/oidc.go | Unwrap SecretString for local fallback password verification. |
| core/sessions/oidcauth/oidc_test.go | Ensure DB inserts use the underlying string value of SecretString. |
| core/sessions/localauth/orm.go | Unwrap SecretString when inserting a user row; unwrap for login password verification. |
| core/sessions/ldapauth/ldap.go | Unwrap SecretString for local fallback password verification. |
Areas requiring scrupulous human review:
- All
string(user.HashedPassword)usages in authentication flows (UpdatePassword, local login fallbacks) to ensure they only occur where the raw hash is strictly needed and cannot be logged/serialized accidentally. - DB write paths that now pass
string(user.HashedPassword)to SQL to ensure the stored value is the real hash (and not a redacted placeholder).
Suggested reviewers (per CODEOWNERS):
@smartcontractkit/foundations,@smartcontractkit/core(root +/core/web/resolverownership)
You can also share your feedback on Copilot code review. Take the survey.
|




No description provided.