Critical Security Concern: Request to Disable Automatic OAuth Identity Linking #53448
Replies: 3 comments
|
Hi, You've identified an important security concern with Supabase Auth's automatic identity linking. According to the current Supabase Auth documentation, identities with the same verified email address can be automatically linked to an existing user. A few points worth considering:
I would also recommend testing this behavior with separate test accounts before deploying any authentication changes. One important question for the Supabase team: Is there a supported configuration for Supabase Cloud that completely disables automatic OAuth identity linking while preserving normal OAuth authentication? Documentation: Hope this helps! |
|
Supabase links a new OAuth sign-in to an existing user when the email matches and the provider says it's verified. Your friend was signed in to your GitHub, which reports your Gmail, so Supabase signed them in as you. Because it's the same user, role checks (app_metadata, a roles table) pass for them too. The fix has to be a second factor or fewer providers. What helps on hosted Supabase today:
(AI-drafted, reviewed and sent by me) |
|
Update from my side: I'm gating privileged routes on AAL2 (MFA) and monitoring |
Uh oh!
There was an error while loading. Please reload this page.
Hello Supabase Support Team,
I am developing an application using Supabase and have found Supabase to be an excellent overall platform for bringing my application to life. I currently use Supabase Auth and have enabled three OAuth providers: Google, GitHub, and Discord.
However, I have encountered a serious security concern involving automatic identity linking based on matching verified email addresses.
Description of the issue
When two different OAuth providers use the same verified email address, Supabase Auth allows authentication through either provider and automatically links the identities to the same Supabase user.
I discovered the security implications of this behaviour during testing. On one occasion, a friend borrowed my GitHub account, which contained the same Gmail address associated with my existing account. Supabase allowed authentication through that GitHub account, granting access to my application with administrator-level privileges.
This creates a significant security vulnerability. Access to one OAuth account could potentially provide access to another account simply because both providers return the same verified email address.
Why the existing configuration options are insufficient
I have investigated the available Supabase Auth configuration options:
Manual Identity Linking: Enabling this feature allows users to manually link additional identity providers, but it does not disable automatic identity linking based on matching verified email addresses.
Identity Verification: I have not found a configurable pre-linking or identity verification hook that allows my backend to reject an OAuth identity before Supabase automatically links it to an existing user.
Automatic Linking Configuration: I have not found a dashboard setting or supported configuration option to completely disable automatic identity linking.
The behaviour I need
For security reasons, I want Supabase Auth to enforce the following behaviour:
If a user originally registered using Google, only that explicitly linked Google identity should be able to authenticate them.
Attempting to sign in using GitHub or Discord with the same verified email address must be rejected.
Matching email addresses must never be sufficient to merge or link two identities automatically.
Additional OAuth providers should only be linked through an explicit, authenticated manual-linking process initiated by the account owner.
This verification must happen before any automatic identity linking occurs, not after the identities have already been merged.
Ideally, I would like a supported configuration option to disable automatic identity linking entirely, or a pre-identity-linking hook that allows applications to enforce their own identity verification rules.
Impact on our project
This issue is significant enough that I have considered discontinuing the use of Supabase Auth for my application, despite being very satisfied with the rest of the Supabase platform.
I would strongly prefer to continue using Supabase rather than migrate to another authentication provider. However, I cannot compromise on account security, especially when administrator-level access is involved.
Could your team please clarify:
Is there currently a supported way to completely disable automatic identity linking based on matching verified email addresses?
Does Supabase provide any pre-linking hook or mechanism to reject an identity before automatic linking occurs?
Is there a supported GoTrue configuration that can enforce separate identity-linking domains on Supabase Cloud?
If these capabilities are not currently available, is there a recommended architecture or workaround that guarantees this behaviour without migrating away from Supabase Auth?
I would appreciate a technical explanation and, if possible, guidance from your Auth engineering team.
Thank you for your time and for building such a great platform.
Best regards,
Supabase User
All reactions