MFA-gate the template admin-revert, aligning it with routes/admin.ts

↗ view on GitHub · sloth-ninja · 2026-08-05 · 64114ca6

The independent review of #76 flagged the template admin-revert as the only
admin mutation in the product not behind requireMfaIfEnrolled, unlike the WS9
firm-library revert the card is modelled on. That was a backend change, so it
was deferred out of #76 into this follow-up.

Backend: POST /tabular-templates/:id/admin-revert gains requireMfaIfEnrolled
between requireAdmin and asyncHandler - the ordering all nine mutating routes
in routes/admin.ts use. Route test asserts an enrolled-but-unverified admin
gets 403 with code "mfa_verification_required" and never reaches the seam.

Frontend: FirmTemplatesSection wraps the whole mutation in the page's existing
useMfaGuardedAction, so it replays intact after a step-up; mfa-required is
rethrown for the guard while other failures still surface inline. Card copy
updated only after the behaviour was true.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Parents e7859510
Stats 4 files changed , +202 , -85
Part of Firm-shared tabular review templates

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-64114ca6.md from inside the repo you want the change in.

⬇ Download capture-commit-64114ca6.md