Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security issue with email link authentication: Should not pass the user’s email in the redirect URL parameters #74

Open
martinblostein opened this issue Nov 13, 2021 · 1 comment

Comments

@martinblostein
Copy link

martinblostein commented Nov 13, 2021

From here:
https://firebase.google.com/docs/auth/web/email-link-auth#security_concerns

To prevent a sign-in link from being used to sign in as an unintended user or on an unintended device, Firebase Auth requires the user's email address to be provided when completing the sign-in flow. For sign-in to succeed, this email address must match the address to which the sign-in link was originally sent.

You can streamline this flow for users who open the sign-in link on the same device they request the link, by storing their email address locally - for instance using localStorage or cookies - when you send the sign-in email. Then, use this address to complete the flow. Do not pass the user’s email in the redirect URL parameters and re-use it as this may enable session injections.

This library does exactly this in the sendOobCode method. You can verify the issue by initiating sign in on one device and then completing it on another. This should not work--the user should be required to re-enter their email address in that case.

@samuelgozi
Copy link
Owner

The problem is that when visiting the mail from a different device (which is very common) the cookie will not be present and the mail will need to be provided by the user itself again.

it feels awkward to ask for the mail right after asking it a second ago but I understand the importance of this.

I’ll try to find some time to fix 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

No branches or pull requests

2 participants