Skip to content

Auth: a pending session with no factor ends no sessions under require_mfa (BACKLOG #1149) - #3258

Open
wshallwshall wants to merge 5 commits into
mainfrom
w12-1149
Open

wshallwshall wants to merge 5 commits into
mainfrom
w12-1149

Conversation

@wshallwshall

Copy link
Copy Markdown
Collaborator

BACKLOG #1149, ground 2. From Manager runbook-batch-manager-fa3030 (account 9).

Merge danger

  • Reversible: yes, by a revert.
  • Blast radius: auth step-up and session termination under require_mfa:
    • api/security.py and the auth core;
    • the web console's /ui/reauth and its terminate actions;
    • SECURITY.md, plus dated amendments to ADR 0077 and ADR 0207;
    • a changelog fragment.
  • Behaviour change: under require_mfa, a pending session with no factor (MFA-pending) gets no session-ending grant.
    • The terminate routes refuse it, with wording that names enrolment.
    • On a terminate action, /ui/reauth sends it to /ui/account?m=enroll_first. This holds on the password and IdP legs, and runs before the rate limiter.
    • A local password holder can still enrol a factor and then terminate. This adds a step; it does not block terminating.
  • Ruling behind it: decided under the owner's standing instruction of 2026-11-23. A no-factor session under require_mfa is MFA-pending, the stricter of the two options.

Evidence

  • Fail before, pass at head. These fail at db3d07dec86 and pass at head:
    • tests/test_mfa_access_gate.py::test_a_store_fault_on_the_wording_read_keeps_the_mfa_refusal[transit] and [cipher];
    • packaging/messagefoundry-webconsole/tests/test_webui_bulk.py::test_revoke_reauth_sends_a_no_factor_pending_session_to_enrol.
  • Controls: the [store] case and test_revoke_reauth_stays_password_only_when_no_factor_is_owed pass on both.
  • Locally: the console suite and related engine tests (2,380 passed, 76 skipped); ruff and mypy are clean. The full suite was not run.

QA

  • code-review skill at xhigh, across several rounds. The last is round-641e2405 on db3d07dec86..768ba1f7e71, after an earlier round, round-80ac4419, whose findings 1 to 5 are fixed.
  • Tag: xhigh effort → 10 inline angles → dedup (no verify) → sweep → ≤15 findings. review_tag.py exited 0.
  • Head 7e91397ce27 changes text and docstrings only, and no review round has covered it.

Banner

#1149 PARTIAL. The engine closes ground 2: under require_mfa, a pending session with no factor is given no session-ending grant. The terminate routes refuse it with wording that names enrolment, and the console and /ui/reauth send it to enrol.

Left:

  • the open findings below;
  • a decision on #3941 item 2;
  • the 7.5.2 re-score, which is vault record work.

Open findings (one R2 row)

  1. Behaviour. A TransitSealUnverifiableError on the MFA wording read still turns the 403 into a 500. The catch covers the sealed-read set and TransitSealUnavailableError only.
  2. Behaviour, already on main, not a regression. _step_up_refusal's wording read catches store faults only, so a Transit or cipher fault there gives a 500.
  3. Prose that is false about a control. The SECURITY.md route-map rows for the terminate routes, around lines 1656-1657 and 1991-1992, still say only "password-only step-up". They are left because open PR 3248 edits those lines, and the ADR 0207 amendment notes this. Fix them after 3248 merges.
  4. The enrol detail does not mention a directory account's enrolment code.
  5. The POST /ui/reauth and IdP-leg redirects have no test.
  6. Kept from an earlier round:
    • "holds a factor" is inferred from another check;
    • the action set is private to the console;
    • the route makes extra reads.

…_mfa

Under [security].require_mfa a session on an account with no enrolled
factor is MFA-pending. It is now confined like any other pending
session: it reaches enrolment and sign-out, and is refused elsewhere,
the session-terminate routes included, with a refusal naming enrolment.

- AuthService: session_terminate, save_ends_own_sessions and
  revoke_all_sessions are refused to every pending session, the
  account's factors aside, so no re-proof (password or IdP) mints them.
  The enrolment actions keep the first-enrolment carve-out.
- JSON: the MFA refusal keeps 403 + X-MFA-Required and its leading text;
  for a pending session with no factor the detail names enrolment.
- Console: the reauth-only action gate sends such a session to
  /ui/account?m=enroll_first instead of /ui/reauth.
- Docs: SECURITY.md and CONFIGURATION.md; changelog fragment.
- Seam: the console gate body moved the seam digest; re-derived
  with --write and the console accepted seam set by hand.
- Tests: two old tests that pinned the no-factor terminate inverted.

Every other path keeps main's result: a session that owes no factor
(require_mfa off, or out of scope) and one with a factor are unchanged.
Not built: #3941 item 2 (the route-set / revoke-set race).

BACKLOG #1149 (ASVS 7.5.2)

Proposed PR title: Auth: a pending session with no factor ends no
sessions under require_mfa (BACKLOG #1149)
Proposed banner: PARTIAL -- engine closes ground 2 (no-factor pending
session refused session-ending grants and terminates, refusal names
enrolment). Left: #3941 item 2 decision; 7.5.2 re-score (vault record
work).
- The JSON refusal's wording read keeps the 403 on a store fault
  (verify wording), as _step_up_refusal's does; a test pins it.
- The enrol-first detail says each enrolment step has its own step-up.
- _PENDING_REFUSED_ACTIONS is built from _PENDING_SESSION_ENDING_ACTIONS.
- Stale comments beside the terminate gates, on both planes, and the
  SECURITY.md gate-table and decision-table cells now state the rule.
- CONFIGURATION.md links to SECURITY.md rather than restating it.

BACKLOG #1149
- Three console tests that used a no-factor pending session to reach
  /ui/reauth for another purpose run with require_mfa off.
- The console asks the factor read again only on a session-ending action.
- SECURITY.md: the IdP step-up grant refusal states the new rule.
- Comment fixes: the refused-actions set, the wording helper's return.
- Console CHANGELOG entry; the seam digest re-derived again.

BACKLOG #1149

Proposed PR title: Auth: a pending session with no factor ends no
sessions under require_mfa (BACKLOG #1149)
- The wording read also catches the sealed-read set and
  TransitSealUnavailableError, so a seal or Transit fault keeps the 403.
- /ui/reauth sends a pending session with no factor to enrol for a
  session-ending action instead of a password form that mints nothing.
- SECURITY.md: the password-only routes paragraph, the incident-response
  revoke note and the session-termination paragraph state the new rule,
  "at least" where the list is open, and that a local password holder can
  enrol first: the refusal adds a step, not a bar.
- ADR 0077 and ADR 0207: dated amendment notes, accepted text kept.
- Changelog: the terminate routes used to send X-Step-Up-Required to this
  session and now send X-MFA-Required.

BACKLOG #1149

Proposed PR title: Auth: a pending session with no factor ends no
sessions under require_mfa (BACKLOG #1149)
…refusal

The pending-session reach names the mfa_gate=False routes too; the
Kerberos revoke note splits the factor and no-factor cases; the ADR 0077
note states the wording per case; the wording-read docstring names the
faults it catches.

BACKLOG #1149
@wshallwshall wshallwshall added the qa Builder QA record posted; not a merge gate label Nov 24, 2026
@wshallwshall

Copy link
Copy Markdown
Collaborator Author

Lander hold on head 7e91397.

The QA rounds cover the code, and the head is text only. The change only tightens. Finding 1, TransitSealUnverifiableError turning the 403 into a 500, still refuses, so I rule it ORDINARY under decision d20261123T150929936-d70a0b. The behaviour rests on decision d20261124T135653947-cef4f7, the strictly safer reading of #1149 under the owner's standing instruction of 2026-10-22. I accept it as tightening only.

Held on finding 3, a false control claim. docs/SECURITY.md lines 1656 and 1657, and the matching rows near 1991-1992, still describe the terminate routes as "password-only step-up". Under require_mfa, a pending session with no factor is now refused there and sent to enrol. Fix those rows in this PR. PR 3248, which edits the same lines, is itself held, so do not wait for it; whichever lands second resolves the conflict.

CI gate and the test legs are pending. I enqueue once they are green; a text-only fix needs no new review round.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa Builder QA record posted; not a merge gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant