fix(auth): generate UUID ids for BetterAuth Prisma writes #427

Merged
jason.woltje merged 2 commits from fix/authentik-betterauth-interop into develop 2026-02-19 01:07:33 +00:00
Owner

Root cause:
BetterAuth was generating opaque string IDs for DB creates, but auth tables (sessions/accounts/verifications) use UUID primary keys. This caused Prisma P2023 errors during OAuth state persistence in verifications.

Changes:

  • configure BetterAuth advanced.database.generateId = uuid
  • add regression test in auth.config.spec.ts
  • guard TelemetryInterceptor header write when response is already committed to avoid ERR_HTTP_HEADERS_SENT warning noise
  • add interceptor test coverage for committed responses

Verification:

  • pnpm --filter @mosaic/api exec vitest run src/auth/auth.config.spec.ts src/auth/auth.controller.spec.ts src/telemetry/telemetry.interceptor.spec.ts
  • pnpm --filter @mosaic/api typecheck
  • pnpm --filter @mosaic/api lint
Root cause: BetterAuth was generating opaque string IDs for DB creates, but auth tables (sessions/accounts/verifications) use UUID primary keys. This caused Prisma P2023 errors during OAuth state persistence in verifications. Changes: - configure BetterAuth advanced.database.generateId = uuid - add regression test in auth.config.spec.ts - guard TelemetryInterceptor header write when response is already committed to avoid ERR_HTTP_HEADERS_SENT warning noise - add interceptor test coverage for committed responses Verification: - pnpm --filter @mosaic/api exec vitest run src/auth/auth.config.spec.ts src/auth/auth.controller.spec.ts src/telemetry/telemetry.interceptor.spec.ts - pnpm --filter @mosaic/api typecheck - pnpm --filter @mosaic/api lint
jason.woltje added 1 commit 2026-02-19 00:50:18 +00:00
fix(auth): use UUID id generation for BetterAuth DB models
Some checks failed
ci/woodpecker/push/api Pipeline failed
f219dd71a0
jason.woltje added 1 commit 2026-02-19 00:53:34 +00:00
chore(deps): override minimatch to 10.2.1 for audit fix
All checks were successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
aeac188d40
Author
Owner

Audit update after dependency remediation:

  • Added pnpm override: minimatch >=10.2.1
  • Regenerated lockfile
  • Verified: pnpm audit --audit-level=high now exits cleanly (0 high / 0 critical)
  • Remaining: 2 moderate vulnerabilities (ajv) in transitive trees:

These are upstream dependency chains; no direct runtime code changes in this patch.

Audit update after dependency remediation: - Added pnpm override: minimatch >=10.2.1 - Regenerated lockfile - Verified: pnpm audit --audit-level=high now exits cleanly (0 high / 0 critical) - Remaining: 2 moderate vulnerabilities (ajv) in transitive trees: - eslint -> ajv@6.12.6 - @nestjs/cli -> @angular-devkit/core -> ajv@8.17.1 These are upstream dependency chains; no direct runtime code changes in this patch.
jason.woltje merged commit bd3625ae1b into develop 2026-02-19 01:07:33 +00:00
jason.woltje deleted branch fix/authentik-betterauth-interop 2026-02-19 01:07:33 +00:00
Author
Owner

Web test fix: added a localStorage shim in web vitest setup so ThemeProvider tests have a full Storage API.\n\nVerification:\n- pnpm --filter @mosaic/web test (passes locally)

Web test fix: added a localStorage shim in web vitest setup so ThemeProvider tests have a full Storage API.\n\nVerification:\n- pnpm --filter @mosaic/web test (passes locally)
Sign in to join this conversation.