aa95ab2745
Step 5, the last one, of docs/calendar-auth-migration.md. Step 4 is deployed and verified, which is what this was waiting on: it removes the fallbacks that step 4 still leaned on. Gone: src/models/calendar/users/ entirely - registration, login, activation, both password-reset routes, and the session checking that the feedback and tickets admin areas used to authenticate against - along with its mount. That was the API's last unauthenticated account-creation and mail-sending endpoint. A survey confirmed nothing outside that directory imported it and nothing else touched its tables. Also gone: the two joins against the calendar users table in events.service.ts and the created_by_id / version_created_by_id columns they read, from the SQL, the row mapper, the Event interface and the swagger schema; and X-Session-Id / X-Session-Key from the CORS allowedHeaders, which nothing has read since the first cutover and nothing has sent since the second. An event's author still renders, because migration 002 snapshotted the names before this could erase them. That was brought forward from this step on purpose, and it is the reason 004 can rename the accounts aside at all. The accounts are renamed rather than dropped - they still hold e-mail addresses and password hashes, and a rename makes them unreachable without destroying anything. InnoDB rewires the sessions foreign key to the new name; verified on MariaDB 11, along with the whole 001-004 chain from the pre-cutover production schema, which lands byte-identical to a fresh dev database. Migration 004 must be applied AFTER deploying, not before - the reverse of step 4, whose migration only added things. Its own header and the runbook both say so, since getting it wrong by analogy is the obvious mistake. DEFERRED_SECURITY.md items 3 and 4 close with it: the activation and reset tokens that never expired are gone along with the code that issued them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
19 lines
695 B
TypeScript
19 lines
695 B
TypeScript
import {vi, type Mock} from 'vitest';
|
|
|
|
vi.mock('../../src/models/admin/admin.auth.js', () => ({
|
|
auth: {api: {getSession: vi.fn()}}
|
|
}));
|
|
vi.mock('../../src/models/admin/users/users.admin.service.js', () => ({
|
|
loadAccess: vi.fn()
|
|
}));
|
|
|
|
import {auth} from '../../src/models/admin/admin.auth.js';
|
|
import * as UsersService from '../../src/models/admin/users/users.admin.service.js';
|
|
import {requireAdminAuth} from '../../src/models/feedback/feedback.auth.js';
|
|
import {describeAdminBinding} from '../admin/auth-binding.js';
|
|
|
|
describeAdminBinding('feedback', 'tickets', requireAdminAuth, () => ({
|
|
getSession: auth.api.getSession as unknown as Mock,
|
|
loadAccess: UsersService.loadAccess as Mock
|
|
}));
|