Skip to content

[M2.2e3a] Manage MFA proofs and temporary private grants - #68

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2e3a-mfa-form-state
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2e3a-mfa-form-state

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

The account MFA store now supports setup, activation, disable and recovery-code replacement with current-password/proof validation. Unknown server status cannot appear as disabled MFA or enable an action. Mutations share the account submission gate so sign-out and security changes cannot overlap from this page.

Provisioning seeds stay in private in-memory state until their expiry, capped at ten minutes. Recovery codes are displayed for at most ten minutes; hiding them does not revoke saved codes. Success, dismissal, timeout and destruction clear private inputs/grants, and store serialization is opaque. A display timeout during activation preserves the eventual confirmed recovery-code result. Session updates retain only public identity fields.

Validation: all 38 Angular tests pass, including seven MFA lifecycle tests covering required proofs, status failures, expiry, concurrent actions, late responses and grant isolation. Web lint/typecheck/build pass. No new dependency or backend API change. Plan/spec updated. Stacked on #67; presentation follows in M2.2e3b. No merge requested.

  • M2.2e3a criteria met
  • Secret lifetime and concurrency regressions
  • Plan/spec updated
  • No private state in URLs, storage or serialization

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2e2c-account-screens branch from 38b3278 to 8631889 Compare November 5, 2026 12:39
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.2e2c-account-screens to main November 5, 2026 12:39
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2e3a-mfa-form-state branch from 58c489f to 32421bb Compare November 5, 2026 12:39
@samuelmbabhazi
samuelmbabhazi merged commit c206345 into main Nov 5, 2026
9 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.2e3a-mfa-form-state branch November 5, 2026 12:39
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
The account page now supports the complete MFA workflow: current status,
manual authenticator enrollment, activation, recovery-code replacement
and disable. It explains session/API-token invalidation before the user
confirms a security change, shares the account mutation gate and focuses
one common request-error summary.

Setup keys and recovery codes can be copied only by an explicit click.
Clipboard failures offer manual selection with fixed safe text.
Provisioning URIs never become links. Code acknowledgement removes the
displayed grant, and the private lifetime controls from #68 remain in
force. Sign-out does not show a false “Signing out” state during an MFA
operation.

Validation: all 41 Angular tests pass; web lint, typecheck and
production build pass. New tests exercise the rendered
enrollment/activation/copy/acknowledgement flow and denied/late
clipboard responses. Initial production payload remains below the
warning budget (343 kB raw / 90 kB estimated transfer). No new
dependency. The first commit only enables Angular-aware template
formatting; the second contains the functional change.

Stacked on #68. This PR stays draft until real-browser acceptance and
the final desktop/mobile accessibility/design review in M2.2e4. No merge
requested.

- [x] MFA screens and explicit clipboard behavior
- [x] Web checks and regression tests
- [x] Plan/spec updated
- [ ] Real-browser and final design/accessibility review (M2.2e4)
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
…rets on a timer (#98)

## Task

Review follow-up for #64, #66 and #68 (M2.2e1b, M2.2e2b, M2.2e3a). Refs
#21

## What changed

**Session state (`session-store.ts`)**
- Sign-out on an expired or revoked session: the server answers 401,
which now clears the local session instead of keeping "Signed in as …"
with an error that every retry repeats.
- A successful login always updates the session, even if its form was
left before the response arrived. The server has already set the session
cookie, so the UI no longer claims the user is signed out while the next
reload is authenticated. Form side effects (navigation) remain guarded
by the mutation runner.
- A login that fails while it superseded a pending session check re-runs
the check, so the account page no longer stays on "Checking your
session…" until reload.

**One-time secrets (`mfa-form-store.ts`, `token-form-store.ts`)**
- Recovery codes and newly created API tokens are no longer hidden by a
fixed 10-minute timer. They stay until the user acknowledges them,
leaves the page or rotates the session.
- The provisioning seed keeps its timer, which follows the real server
expiry.
- Panel texts and SPEC updated.

## Why

- The 401 sign-out trapped users in a signed-in UI until a full reload
(#64).
- The ignored login left a live server session invisible to the user
(#66).
- The server shows recovery codes and API tokens exactly once. Hiding
them after 10 minutes, with no warning or extension, fails WCAG 2.2.1
(Timing Adjustable, level A) on a core flow. A slow or screen-reader
user copying ten 32-character codes could lose them and then need a TOTP
code to regenerate them (#68).

## How it was tested

- New and updated unit tests: 401 sign-out clears the session; a failed
login that superseded a pending check settles the state; recovery codes
and API tokens are still displayed after an hour without
acknowledgement.
- `nx run-many -t lint typecheck test build -p web` in a clean worktree:
11 files, 52 tests pass; production build passes.
- Browser acceptance could not run: GitHub Actions is blocked by the
account spending limit. CI must pass before merge.

## Security considerations

- Secrets stay in memory longer only while the account page is open and
only until acknowledgement. Departure, session rotation and
acknowledgement still clear them, and they still never serialize out of
the stores.
- The signed-out state after a 401 matches the server state.

## Checklist

- [x] Lint, typecheck, tests and build pass locally
- [x] Tests added and updated
- [x] No new shell invocation and no new secret exposure path
- [x] Audit events: not applicable (client only)
- [x] SPEC updated
- [ ] CI green (blocked by billing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant