Skip to content

Conversation

@maxdinech
Copy link

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 /user endpoint.

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_PASSWORD that, when enabled, requires users to provide their current password when changing to a new password.

Changes:

  • Added GOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_CURRENT_PASSWORD configuration option
  • Added current_password field to the PUT /user endpoint
  • Verifies current password before allowing password changes
  • Returns standard InvalidLoginMessage error on incorrect current password

Implementation details:

  • Works alongside the existing UpdatePasswordRequireReauthentication option
  • Disabled by default
  • Uses the same authentication and error handling patterns as the login endpoint
  • No database schema changes required

…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
@maxdinech maxdinech requested a review from a team as a code owner October 17, 2025 16:57
@hf
Copy link
Contributor

hf commented Oct 20, 2025

Love this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants