feat(security): require current password for password updates#2215
Closed
maxdinech wants to merge 3 commits intosupabase:masterfrom
Closed
feat(security): require current password for password updates#2215maxdinech wants to merge 3 commits intosupabase:masterfrom
maxdinech wants to merge 3 commits intosupabase:masterfrom
Conversation
…pdates Adds a new configuration option GOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_CURRENT_PASSWORD that addresses session hijacking vulnerabilities by requiring users to provide their current password when changing to a new password. When enabled, the PUT /user endpoint requires a current_password field in the request body alongside the new password. The current password is verified before allowing the password change, preventing attackers with stolen session tokens from changing passwords without knowledge of the current password. This security feature works alongside the existing UpdatePasswordRequireReauthentication option and is disabled by default for backwards compatibility. Related to discussion #32972
Contributor
|
Love this. |
Author
|
A possible issue with this implementation is that it seems to conflict with the password reset flow. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Feature - Security enhancement
What is the current behavior?
When a user's session token is compromised (e.g., via XSS, MITM, or other attacks), an attacker can change the user's password without knowing the current password using the PUT
/userendpoint.We discovered this vulnerability during a penetration test of our self-hosted Supabase instance. Our internal security requirements mandate that password changes must verify the current password to prevent session hijacking attacks.
Related: https://github.com/orgs/supabase/discussions/11412, https://github.com/orgs/supabase/discussions/5341, https://github.com/orgs/supabase/discussions/34323
What is the new behavior?
Adds a new configuration option
GOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_CURRENT_PASSWORDthat, when enabled, requires users to provide their current password when changing to a new password.Changes:
GOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_CURRENT_PASSWORDconfiguration optioncurrent_passwordfield to the PUT/userendpointInvalidLoginMessageerror on incorrect current passwordImplementation details:
UpdatePasswordRequireReauthenticationoption