fix(auth): end connected assistants, tokens and share links on sign-out everywhere

"Sign out everywhere" ended web sessions and device logins but left every
credential that works without signing in: a connected AI assistant kept its
OAuth connection and minted the next access token from it, a connector or
ingest token kept working, and a clinician share link kept opening the
record. A password change revoked the tokens but not the assistant's
connection or the share links. Anything a stolen session had minted
outlived the remedy.

- Sign out everywhere now ends every other sign-in, every AI-assistant
  connection, every programmatic token except the caller's own, and every
  clinician share link. Share links are revoked by default; the web offers
  a checkbox to keep them (keepShareLinks=1), and a client that sends
  nothing, such as the shipped app, gets the safe default.
- A password change and an admin password reset also end AI-assistant
  connections, share links and step-up elevations.
- Turning on the first second factor (TOTP or a security key) ends every
  other sign-in, as a password change does. Adding a further factor does
  not.

destroyOtherSessions takes an explicit reach ("sign-ins" or "everything")
so each caller says how far it goes.
This commit is contained in:
Marc-André Bombeck committed 2026-09-26 20:06:36 +02:00
1 parent 0fc83cb0a1
commit 92c5b0a60d
23 files changed
+658 -66

No files matched your search

+6
View File
@@ -52,6 +52,8 @@ interface ConfirmCopy {
pending?: boolean;
/** `data-slot` for tests and the design guards. */
slot?: string;
/** A control that belongs with the question, such as an opt-out checkbox. */
extra?: ReactNode;
}
function ConfirmBody({
@@ -61,6 +63,7 @@ function ConfirmBody({
onConfirm,
pending = false,
slot,
extra,
}: ConfirmCopy) {
const { t } = useTranslations();
@@ -70,6 +73,7 @@ function ConfirmBody({
<AlertDialogTitle>{title}</AlertDialogTitle>
<AlertDialogDescription>{body}</AlertDialogDescription>
</AlertDialogHeader>
{extra}
<AlertDialogFooter>
<AlertDialogCancel>{t("common.cancel")}</AlertDialogCancel>
<AlertDialogAction
@@ -102,6 +106,7 @@ export function ConfirmButton({
icon,
ariaLabel,
slot,
extra,
}: ConfirmCopy & {
/** The control's own label, before the dialog opens. */
label: string;
@@ -143,6 +148,7 @@ export function ConfirmButton({
onConfirm={onConfirm}
pending={pending}
slot={slot}
extra={extra}
/>
</AlertDialog>
);