Skip to content

fix(api): preserve OTP enforcement during force_otp migration#120

Merged
markwylde merged 1 commit intomainfrom
codex/fix-otp-enforcement-migration-issue
Mar 10, 2026
Merged

fix(api): preserve OTP enforcement during force_otp migration#120
markwylde merged 1 commit intomainfrom
codex/fix-otp-enforcement-migration-issue

Conversation

@markwylde
Copy link
Copy Markdown
Member

Motivation

  • The migration 0015_org_force_otp.sql added organizations.force_otp defaulting to false and removed the legacy otp_required role without migrating existing enforcement, which would silently disable OTP for orgs after upgrade.
  • This change restores the original MFA enforcement semantics so organizations that previously required OTP continue to do so after the migration.

Description

  • Updated packages/api/drizzle/0015_org_force_otp.sql to backfill organizations.force_otp = true for any organization that had a member assigned the legacy otp_required role.
  • Left the existing cleanup steps that delete organization_member_roles, role_permissions, and the roles entry for otp_required unchanged.
  • The change is a minimal migration-only fix intended to preserve behavior without altering runtime OTP logic.

Testing

  • Ran npm run tidy which completed successfully (repo-wide Biome warnings/info remain but no errors).
  • Ran npm run build which completed successfully for the workspaces though the brochureware prebuild logged a missing system library for Puppeteer PDF generation but did not fail the overall build.
  • Attempted npm --workspace @DarkAuth/api test -- src/controllers/user/opaqueLoginFinish.test.ts, but tests could not be executed in this environment because Node v20 cannot run .ts test files directly and reported ERR_UNKNOWN_FILE_EXTENSION.

Codex Task

@markwylde markwylde merged commit ec07423 into main Mar 10, 2026
17 checks passed
@markwylde markwylde deleted the codex/fix-otp-enforcement-migration-issue branch March 10, 2026 18:35
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