feat(security): require current password for password updates #2215
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