Skip to content

Let the store end every sign-in of an account on sign-out - #1115

Merged
KrzysztofPajak merged 6 commits into
developfrom
fix/logout-ends-cookie
Nov 24, 2026
Merged

KrzysztofPajak merged 6 commits into
developfrom
fix/logout-ends-cookie

Conversation

@KrzysztofPajak

@KrzysztofPajak KrzysztofPajak commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

A copied cookie outlived the sign-out. The sign-in cookie is a ticket the server keeps no record of. Signing out deleted it from the browser, but a copy taken before (shared computer, malware, a proxy log) kept working until it expired (a year on the storefront) or until the password changed. The server checks only the PasswordToken the ticket carries, and sign-out left that token unchanged.

Changes

  • New setting "Sign out on all devices" (CustomerSettings.SignOutOnAllDevices, under Settings → Customer settings → security tab, in the Admin and Store panels).
    • Off by default: signing out ends this device's sign-in only, as before.
    • On: signing out replaces the account's PasswordToken, as a password change does. That ends every sign-in of the account, on other devices too, including the panels and the frontend API tokens (JwtBearerCustomerAuthenticationService checks the same token).
    • A cookie carrying an older, already replaced token changes nothing, so it cannot end sign-ins made after it.
  • Resource Admin.Settings.Customer.SignOutOnAllDevices in DefaultLanguage.xml and Upgrade/en_250.xml.

Notes

  • Signing out stays a GET. The sign-in cookie is SameSite=Lax, so an image or frame on another site sends no cookie. A cross-site link can only sign a visitor out, and making sign-out a POST would break every theme's sign-out link and bookmarked /logout URLs.
  • Ending an impersonation does not sign out, so it never replaces the token.
  • The setting is read in the store of the request, so a store owner can set it for their store's customers.

Tests

  • CookieAuthenticationServiceTests:
    • setting on: sign-out replaces the token;
    • setting on, but an old cookie or a request without a sign-in: the token stays;
    • setting off (default): the token is kept.
  • These test projects pass: Grand.Web.Common.Tests (784), Grand.Web.Tests (686), Grand.Web.Admin.Tests (2137), Grand.Web.Store.Tests (245), Grand.Web.Vendor.Tests (53), Grand.Mapping.Tests (243, customer settings snapshots now include the new field).
  • Not clicked through in a browser.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 17:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@KrzysztofPajak KrzysztofPajak changed the title Replace the sign-in token on sign-out, so a copied cookie stops working Sign out only by POST, and let the store end the sign-ins on other devices too Nov 23, 2026
@KrzysztofPajak KrzysztofPajak changed the title Sign out only by POST, and let the store end the sign-ins on other devices too Let the store end every sign-in of an account on sign-out Nov 24, 2026
@KrzysztofPajak
KrzysztofPajak merged commit 8bfe458 into develop Nov 24, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/logout-ends-cookie branch November 24, 2026 18:03
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