Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions changelog.d/1149-no-factor-pending-ends-no-sessions.security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- **A pending session on an account with no second factor no longer ends sessions.** Under
`[security].require_mfa`, such a session is MFA-pending, and it is now treated like any other
pending session: it reaches at least enrolment and sign-out, and the self-service terminate routes
(`DELETE /me/sessions`, `DELETE /me/sessions/{session_id}` and their console twins) refuse it.
No password re-proof mints it a `session_terminate`, `save_ends_own_sessions` or
`revoke_all_sessions` grant, so none can be carried through its first enrolment. The terminate
routes used to answer such a session `403` + `X-Step-Up-Required` until it re-proved its password;
they now answer `403` + `X-MFA-Required` whatever it proves, with a detail that names enrolment,
and the access gate's own refusal names enrolment to it too. A client that prompts for a code on
`X-MFA-Required` will prompt for one this session does not have. The console sends the session to
`/ui/account?m=enroll_first`, from the terminate POSTs and from `/ui/reauth`. The enrolment that
binds the first factor satisfies the session, and ending sessions then works as before, so for a
local account a password holder can still enrol a factor of its own and then end sessions: this
adds a step, not a bar. (`BACKLOG #1149`)
2 changes: 1 addition & 1 deletion docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3586,7 +3586,7 @@ and a PHI weakening under **strict enforcement** (`enforcement = enforce`, the d
| `external_link_interstitial` | bool | `true` | **`[BUILT]` (ASVS 3.7.3):** show the "you are leaving this site" page at all. Setting it `false` means the console navigates off-site with **no notification and no cancel** — that is the control itself, so this is a posture decision rather than a convenience one, and `serve` prints a warning naming it at every start. The federated sign-in leg is affected: with the interstitial on and the IdP outside `organization_domains`, `GET /ui/oidc/start` renders the page and the flow is minted only on confirm (`POST`), which also closes the standing hole where any external page could begin a sign-in by linking to the start leg. Env: `MEFOR_SECURITY_EXTERNAL_LINK_INTERSTITIAL` |
| `external_link_allowlist` | list[str] | `[]` | **`[BUILT]` (ASVS 3.7.3) — WARNING: THE AUDITED ESCAPE, AND IT LOWERS SECURITY.** Destinations listed here are navigated to with **no notification and no cancel**, which is precisely what the requirement asks for. It exists for legitimate high-volume external destinations an operator does not want to declare as their own domain. Same entry rule as `organization_domains`, the IPv4 exception included, and the same label-boundary matching. Non-empty makes `serve` print a warning **naming every entry individually** — never a count, because "3 destinations exempted" is the shape of message that lets an entry nobody intended sit in a list for a year. **Prefer `organization_domains`**: declaring a domain you control is a statement about scope; allowlisting one you do not is a waiver. Env: `MEFOR_SECURITY_EXTERNAL_LINK_ALLOWLIST` |
| `require_sign_in` | | | **→ REMOVED** (vault BACKLOG #2719). Sign-in is always required, on every bind. Setting this key is refused at load, from the file or as `MEFOR_SECURITY_REQUIRE_SIGN_IN`, whatever its value. The loopback mode it used to allow named no person in the audit trail and could not repair an account. If every Administrator signs in through an outside service, keep a local Administrator ([SECURITY.md](SECURITY.md#keep-a-local-administrator)). |
| `require_mfa` | bool | `true` | second factor (native TOTP or a WebAuthn passkey), enforced as an **access gate** since ASVS 6.3.3 — an MFA-pending session is refused on *every* authorized route with `403` + `X-MFA-Required: 1`, and a browser session is redirected to `/ui/mfa`. **The enrolment path is a deliberate exemption, not a re-route:** `/ui/mfa` itself and the account/enrolment routes (`GET /ui/account`, the password and factor-enrolment routes) are declared `allow_mfa_pending=True` ([`messagefoundry_webconsole/_auth.py`](../messagefoundry_webconsole/_auth.py), `routes/account.py`), so a user with **no** factor enrolled is not stranded — send them to **`/ui/account`** to enrol. A local account that `require_mfa` and `require_mfa_scope` cover enrols **TOTP or a discoverable passkey first**, a factor with a way past the sign-in lock (ADR 0197 Amendment A, wave 2). Until it holds one, `POST /me/password` refuses with `enrol an authenticator app first` (403; a pending session that holds a passkey gets `X-MFA-Required` first), the console's password page redirects to `/ui/account?m=enroll_first`, and a passkey registration whose client reports it is not discoverable is refused. A directory account may enrol TOTP or a passkey. Say "redirected to", not "confined to": `/ui/mfa` renders a code field only once TOTP is enrolled and a passkey button only once WebAuthn is, so a zero-factor user who is told they cannot leave that page is looking at a page with no form. |
| `require_mfa` | bool | `true` | second factor (native TOTP or a WebAuthn passkey), enforced as an **access gate** since ASVS 6.3.3 — an MFA-pending session is refused on *every* authorized route with `403` + `X-MFA-Required: 1`, and a browser session is redirected to `/ui/mfa`. **The enrolment path is a deliberate exemption, not a re-route:** `/ui/mfa` itself and the account/enrolment routes (`GET /ui/account`, the password and factor-enrolment routes) are declared `allow_mfa_pending=True` ([`messagefoundry_webconsole/_auth.py`](../messagefoundry_webconsole/_auth.py), `routes/account.py`), so a user with **no** factor enrolled is not stranded — send them to **`/ui/account`** to enrol. Such a user is MFA-pending too, so it cannot end sessions before it enrols (BACKLOG #1149); [SECURITY.md](SECURITY.md), under the self-service session routes, says what it is told. A local account that `require_mfa` and `require_mfa_scope` cover enrols **TOTP or a discoverable passkey first**, a factor with a way past the sign-in lock (ADR 0197 Amendment A, wave 2). Until it holds one, `POST /me/password` refuses with `enrol an authenticator app first` (403; a pending session that holds a passkey gets `X-MFA-Required` first), the console's password page redirects to `/ui/account?m=enroll_first`, and a passkey registration whose client reports it is not discoverable is refused. A directory account may enrol TOTP or a passkey. Say "redirected to", not "confined to": `/ui/mfa` renders a code field only once TOTP is enrolled and a passkey button only once WebAuthn is, so a zero-factor user who is told they cannot leave that page is looking at a page with no form. |
| `require_mfa_scope` | `"administrators"` \| `"every_local_account"` | `"every_local_account"` | **Which accounts must ENROL a factor** when `require_mfa` is on (ASVS 6.3.3). An account that has already enrolled one must satisfy it while it keeps one, under either value (an OIDC sign-in meets it while `[auth].oidc_require_mfa_claim` is on, the default) — this dial only decides who is required to enrol in the first place. `administrators` restores the pre-6.3.3 posture and is reported as a **loosening** on `GET /security/posture` (advisory, not a refusal: refusing to boot on it would break every existing deployment on upgrade). **The `every_local_account` value is wider than its name** (BACKLOG #1144): directory (AD/Kerberos) identities used to be out of scope under either value, and they are not any more — the directory legs assert no strength the engine can read, so a Kerberos session mints MFA-pending and its holder enrols an engine factor. The value's spelling is stale; renaming a `Literal` reaches the settings model, this table and the tests that pin both, which is its own coherent change rather than a rider on a security fix. **Operator note:** under the default a non-interactive **bearer-token service account** becomes MFA-pending and cannot enrol unattended. Two settings answer it, each with a limit. **Set this to `administrators`**, which frees only a **local** account that does not hold the Administrator role: the Administrator role stays in scope under either value, and a directory session that proved no factor stays MFA-pending under both. Or **set `require_mfa = false`**, which frees any account that has not enrolled a factor, whatever its role; on an exposed instance under `enforcement = enforce`, `serve` then refuses to start unless `allow_single_factor_admin_when_exposed` is set (see that row). An account that has enrolled a factor still owes it either way while it keeps one, with the same OIDC exception. With `require_mfa` off, or for an account `require_mfa_scope` leaves out (under `administrators`, any account without the Administrator role, directory ones included), the holder may remove its last factor. Under `administrators` with `require_mfa` on, a directory account that does so is still not single-factor: its next Kerberos session stays MFA-pending until it enrols again. Making it an AD principal is **no longer** an escape, and mTLS is not one either: a cert-identity is exempt from the MFA gate but is admitted on exactly one route (`GET /service/identity`), so it cannot carry a working service account (see the [`[api]`](#api) `tls_client_cert_identities` row). Env: `MEFOR_SECURITY_REQUIRE_MFA_SCOPE` |
| `sign_out_after_idle_minutes` | int | `30` | session idle timeout; `1` to `525600` (a year), refused at load outside that (BACKLOG #5772) |
| `max_session_hours` | int | `12` | session absolute lifetime; `1` to `8760` (a year), refused at load outside that (BACKLOG #5772) |
Expand Down
Loading
Loading