You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f643025
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-auth): refuse only turning require_mfa on, and say when the settings remedy works
Contract review follow-ups:
- The guard judges the change, not the payload: an update is refused only
for a row whose stored value (the engine's `previous`, bound on the by-id
and the per-row multi-row paths) is off. Re-sending `require_mfa: true`
for a row that already stores it passes, so a whole-row update, an import
re-run or a save with no change no longer blocks the row's other edits.
A multi-row update is judged row by row; a context with no `previous` is
judged as a change.
- The refusal and the gate's warning offer the `auth.mfa_required` remedy
only where it can work: the OS_AUTH_TWO_FACTOR env var outranks it.
- AuthManager.isTwoFactorEnabled is marked @internal.
- The organization-declared held-session block turns two-factor on itself
instead of inheriting it from the held state that ran before.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CYRZxPEjGeTbGfW4YC
Copy file name to clipboardExpand all lines: .changeset/30201-org-mfa-needs-enrollment.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
fix(plugin-auth)!: an organization cannot require multi-factor authentication while two-factor enrollment is off, and the MFA gate never holds a user who has no way to enroll (#30201)
6
6
7
-
Clause-②: no (narrowing) — a write that turns `sys_organization.require_mfa` on is refused `400 VALIDATION_FAILED` while the two-factor feature is off, a value an administrator could save before. Nothing is widened.
7
+
Clause-②: no (narrowing) — while the two-factor feature is off, a write that turns `sys_organization.require_mfa` on (an insert with it on, or an update of a row that stores it off) is refused `400 VALIDATION_FAILED`, a value an administrator could save before; re-saving a row that already stores it on passes. No published export, error code or settings key is added; nothing is widened.
8
8
Metadata-protocol: none
9
9
Skills-docs: follow-up owed — content/docs/permissions/authentication.mdx (the `mfa_required` row says `require_mfa` is settable per organization with no condition; it needs two-factor on)
10
10
@@ -13,9 +13,9 @@ Skills-docs: follow-up owed — content/docs/permissions/authentication.mdx (the
13
13
**BREAKING** accept-set narrowing on `sys_organization.require_mfa` writes, served by every data door (the organization's edit form, REST, MCP), on a deployment where two-factor is off.
14
14
15
15
-**Before.** An administrator could tick Require Multi-Factor Auth on an organization while two-factor was off (the default, `features.twoFactor: false`), and it saved. Once the grace period ended, every member, the owner included, was held `403 MFA_REQUIRED` and sent to enroll, and the enrollment endpoint (`POST /api/v1/auth/two-factor/enable`) answered 404: the twoFactor plugin that serves it was never turned on. Nobody could undo it from inside the product, because Setup sits behind the same gate. The global switch never had this hole: the `auth.mfa_required` setting turns the requirement and the plugin on as one piece.
16
-
-**Now.**A write whose payload turns `require_mfa` on is refused while two-factor is off, with one `fields[]` entry on `require_mfa` (`invalid_value`) saying why, who would have been locked out, and the two ways forward. It applies to every write context, the system's included, on the by-id door, a multi-row update and an insert. Clearing the column and writing other columns pass as before, and every write passes once two-factor is on (read per write, so no restart is needed).
16
+
-**Now.**While two-factor is off, a write that turns `require_mfa` on is refused: an insert with it on, or an update of a row whose stored value is off. The refusal carries one `fields[]` entry on `require_mfa` (`invalid_value`) saying why, who would have been locked out, and the ways forward. It applies to every write context, the system's included, on the by-id door, an insert, and a multi-row update, which is judged row by row (one row turning it on refuses the whole write, with nothing written). Re-sending `require_mfa: true` for a row that already stores it (a whole-row update, an import re-run, a save with no change) passes, so other edits of that row are not blocked. Clearing the column and writing other columns pass as before, and every write passes once two-factor is on (read per write, so no restart is needed).
17
17
-**The gate.** ADR-0069 D3's MFA gate holds a user only while they can enroll. With two-factor off, an MFA requirement (an organization's `require_mfa`, or `auth.mfa_required` under an `OS_AUTH_TWO_FACTOR=false` pin, or a host that sets `mfaRequired` without `plugins.twoFactor`) holds nobody and starts no grace clock, and the server says so once in a warning with the remedy. An organization row stored with `require_mfa = true` before this release therefore locks no one out; it starts holding unenrolled members once two-factor is turned on.
18
18
-**One answer.** Whether two-factor is on is decided in one place, the same `OS_AUTH_TWO_FACTOR` env, then `plugins.twoFactor`, then off, for the plugin list, `features.twoFactor` in `/api/v1/auth/config`, the gate and the write refusal.
19
19
-**Unchanged.** An enrolled user is never held. With two-factor on, the requirement and its grace period behave exactly as before. The `auth.mfa_required` setting still turns two-factor on with the requirement.
20
20
21
-
**The remedy.** To require multi-factor authentication for one organization, turn two-factor enrollment on for the deployment first, with `OS_AUTH_TWO_FACTOR=true`, and then tick the organization's box. Turning on the `auth.mfa_required` setting instead requires it for every organization and turns enrollment on with it.
21
+
**The remedy.** To require multi-factor authentication for one organization, turn two-factor enrollment on for the deployment first, with `OS_AUTH_TWO_FACTOR=true`, and then tick the organization's box. Unless `OS_AUTH_TWO_FACTOR` is set to `false` (the env var outranks the settings), turning on the `auth.mfa_required` setting instead also works: it requires multi-factor authentication for every organization and turns enrollment on with it.
0 commit comments