Skip to content

v0.16.0 — the realm is the floor, account changes need the account's own factor

Choose a tag to compare

@windischb windischb released this 07 Oct 13:28
· 91 commits to develop since this release
3d6b669

The first production upgrade to 0.15.0 was rolled back within minutes. A realm that had never saved a sign-in policy derived multi for everything from the built-in deployment level 1 — the administration, every App, and Modgud's own self-service portal — and every browser session from 0.14 read as one that proved nothing. An admin was stopped at "2FA setup required" on every page, shown as raw JSON. This release fixes that and the design gaps behind it (ADR 0025, Amendment 1; Sign-in levels now walks through numbered scenarios and states the model's limits).

Upgrading from 0.14 or 0.15.0. No database schema, projection or scheduled job changed, and no configuration is needed. A realm that never saved its sign-in policy runs with floor single and administration multi — what a deployment at the built-in level 1 ran with. Browser sessions signed in before sign-in factors were recorded end once; users sign in again. Native Apps are not affected: their refresh tokens keep refreshing, e-mail-code and passkey sign-ins work as before. AppSettings__AuthenticationMinimumLevel and AppSettings__TwoFactorGracePeriodDays are removed and ignored if still set. Rolling back to 0.14.0 needs no database step.

Changed

  • The realm is the floor. The realm's sign-in policy applies to the self-service portal, which every user of the realm shares, and every App starts from it. An App can only raise it — a higher minimum level, fewer methods. Saving an App below the floor is refused (SignIn.BelowRealmMinimum, SignIn.MethodNotOfferedByRealm, naming the realm setting to change); an override saved earlier that goes below it runs under the floor and is flagged on the App's Sign-in tab.
  • No deployment-wide sign-in level. AuthenticationMinimumLevel and TwoFactorGracePeriodDays are removed. A realm that never saved its policy runs with the defaults: floor single, administration multi, 14-day setup grace, password and passkey on, e-mail code on when native grants are on for the realm or any App. A test or development realm can set its administration to single; the realm settings warn about it.
  • Account changes need the account's own factor. Adding or removing a second factor or passkey, changing the password or e-mail address, and requesting account deletion need a recent proof (15 minutes) of an account factor — TOTP, or a passkey Modgud can use on the profile's page — or, for a user without one, a recent sign-in. A sign-in a minute ago is the proof; an older session is asked once (403 { RequiresReauthentication, Methods }, POST /api/account/step-up { Reauthenticate: true }). Every such change mails a notice to the account's address. Ending sessions stays frictionless.
  • The e-mail code is offered as a second factor only to users with a password. For a user who signs in by code or magic link it would prove the same mailbox twice; setup screens offer an authenticator app or a passkey instead. The profile says what the e-mail second factor protects against (a stolen password) and what it does not (a lost mailbox).
  • Browser sessions from 0.14 end once. They carry no sign-in factors and cannot say how they were signed in.
  • A usable passkey is offered first where a second factor is required.

Fixed

  • Removing a factor asked for nothing. A single-factor session — a stolen password, a magic link — could switch off TOTP or delete a passkey. It now needs the account factor.
  • Users without a password could not delete their account. The deletion required a password, so e-mail-code users had no self-service deletion. It now needs the recent proof above; a password sent along is still checked. Deletion is never blocked by a sign-in policy or the setup grace.
  • An endless reload for admins below the administration's level. The dashboard's admin calls sent the user to a step-up evaluated against the dashboard (the portal), which the session already met, and straight back. The step-up now targets the administration; a guard stops repeated redirects.
  • /connect/authorize answered with a raw 403 for a session below the portal's level, instead of redirecting to the step-up — and stopped a user whose own TOTP an App ignores from signing in to that App. The enforcement guards only Modgud's own API and hub now.
  • The page shell was enforced too, so a session below the required level saw JSON instead of the step-up or setup screen.

Contract changes (pre-1.0)

  • App sign-in overrides below the realm's policy are rejected.
  • The self-service portal's target is the realm's policy, not the modgud App's.
  • AppSettings__AuthenticationMinimumLevel / AppSettings__TwoFactorGracePeriodDays are gone; the unsaved-realm policy no longer depends on them.
  • POST /api/auth/delete-account: Password is optional. Account-change endpoints may answer 403 RequiresReauthentication.
  • /api/account/me reports HasPassword.