Spend login, invite, and email-change links only after a confirm POST so mail scanners cannot use them up. #113

Merged
an.di merged 1 commits from adilallo/fix/CR-372-mail-scanners into main 2026-11-23 00:33:46 +00:00
Member

Overview

Login, save-progress, invitation, and email-change links were spent on the first GET. University and credit-union mail scanners open those links before the person does, so the person landed on “That link has expired.”

Opening the email now shows a confirm page with one button. Continue POSTs and that is what spends the link. A scanner’s visit changes nothing on the server.

Changes

  • GET of a login, save-progress, invitation, or email-change verify URL no longer mutates. A valid token redirects to a confirm page (/login/confirm, /invite/confirm, /email-change/confirm).
  • Continue is a native POST form. POST spends the token, starts the session (or applies the email change), and redirects with 303.
  • Invitation token hashes stay on the row after accept, so “Send a new link” on the expired screen still finds the invitation after the original link was used.
  • Opening a used invitation while still signed in as that invitee goes to the Rule instead of the expired screen.
  • Stakeholder pending vs accepted is based on acceptedAt, not a missing hash.
  • Confirm pages reuse the login card (yellow page, one heading, one button) and work with a keyboard. Focus lands on Continue when there is no email field.

Screenshots

open-this-login-link.png

How to Test

  1. Request a login (or save-progress) link. Open the URL, or curl -I it. You should get the confirm page, not a session. Press Continue — that should log you in. Fetch the URL again after a GET-only visit and Continue should still work.
  2. Repeat with an invitation link. Confirm, then Continue, should open the invited Rule. Open the same used link while still logged in as that invitee — you should land on the Rule, not “This link has expired.”
  3. After an invitation has been used, open the expired screen and send a new link to the invited address. A mail should arrive.
  4. Repeat with an email-change link. GET must not change the address or sign the account out. Continue should apply the change.
  5. Check the confirm page at 390 and 1280. Tab to Continue (or land on it) and submit with the keyboard.

Notes

  • Existing emails still point at the verify API URLs. Those GETs now redirect to confirm, so links already in inboxes are covered after deploy.
  • No database migration. prisma/schema.prisma only updates the invite-hash comment.
  • Invitations accepted before this change already had a null hash, so “Send a new link” still cannot recover those old spent tokens.
## Overview Login, save-progress, invitation, and email-change links were spent on the first GET. University and credit-union mail scanners open those links before the person does, so the person landed on “That link has expired.” Opening the email now shows a confirm page with one button. Continue POSTs and that is what spends the link. A scanner’s visit changes nothing on the server. ## Changes - GET of a login, save-progress, invitation, or email-change verify URL no longer mutates. A valid token redirects to a confirm page (`/login/confirm`, `/invite/confirm`, `/email-change/confirm`). - Continue is a native POST form. POST spends the token, starts the session (or applies the email change), and redirects with 303. - Invitation token hashes stay on the row after accept, so “Send a new link” on the expired screen still finds the invitation after the original link was used. - Opening a used invitation while still signed in as that invitee goes to the Rule instead of the expired screen. - Stakeholder pending vs accepted is based on `acceptedAt`, not a missing hash. - Confirm pages reuse the login card (yellow page, one heading, one button) and work with a keyboard. Focus lands on Continue when there is no email field. ## Screenshots ![open-this-login-link.png](attachments/b04d31ae-e079-46b2-b8c5-b057a67a1305) ## How to Test 1. Request a login (or save-progress) link. Open the URL, or `curl -I` it. You should get the confirm page, not a session. Press Continue — that should log you in. Fetch the URL again after a GET-only visit and Continue should still work. 2. Repeat with an invitation link. Confirm, then Continue, should open the invited Rule. Open the same used link while still logged in as that invitee — you should land on the Rule, not “This link has expired.” 3. After an invitation has been used, open the expired screen and send a new link to the invited address. A mail should arrive. 4. Repeat with an email-change link. GET must not change the address or sign the account out. Continue should apply the change. 5. Check the confirm page at 390 and 1280. Tab to Continue (or land on it) and submit with the keyboard. ## Notes - Existing emails still point at the verify API URLs. Those GETs now redirect to confirm, so links already in inboxes are covered after deploy. - No database migration. `prisma/schema.prisma` only updates the invite-hash comment. - Invitations accepted before this change already had a null hash, so “Send a new link” still cannot recover those old spent tokens.
an.di self-assigned this 2026-11-23 00:33:37 +00:00
an.di added 1 commit 2026-11-23 00:33:38 +00:00
GET still shows a one-button page, a used invitation can resend or reopen for the signed-in invitee, and an email-change GET no longer signs the account out.
an.di merged commit db1599123b into main 2026-11-23 00:33:46 +00:00
an.di deleted branch adilallo/fix/CR-372-mail-scanners 2026-11-23 00:33:46 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CommunityRule/community-rule#113