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

Confirmation token can be re-used before it expires #86

Open
stevepolitodesign opened this issue Feb 25, 2022 · 0 comments
Open

Confirmation token can be re-used before it expires #86

stevepolitodesign opened this issue Feb 25, 2022 · 0 comments

Comments

@stevepolitodesign
Copy link
Owner

signed_id expires_in: CONFIRMATION_TOKEN_EXPIRATION, purpose: :confirm_email

Issues

stevepolitodesign/rails_mvp_authentication#54

@stevepolitodesign stevepolitodesign self-assigned this Feb 25, 2022
@stevepolitodesign stevepolitodesign removed their assignment Mar 17, 2023
mdchaney added a commit to mdchaney/rails-authentication-from-scratch that referenced this issue Jun 12, 2024
Closes stevepolitodesign#86.

The issue is that signed tokens have a simple payload by default that
doesn't verify anything other than the record id and the token's
purpose.  This can lead to a security challenge as the token can be used
to confirm anything that has the same "purpose" for that record.

An example would be someone changing their email address to an email
address that they don't control.  Using one account, they change the
email to an email address that they control and get the confirmation
token.  They then change the email to one that they can't access and
use the token from the first request to "confirm" the second request.
The tokens can be used any number of times as long as they're used
before expiration.

With this change, the email address is included as plain text in the
request, as well as being used as part of the "purpose" in the token.
The second request fails because the plain text email address is used to
constrain the signed lookup.  If they change the plain text email
address in the link then the message will fail to be validated as the
"purpose" won't match.  Either way, the token is usable only for
confirming the original email from the token's creation.
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

1 participant