Drop the calendar's legacy authentication path
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>
This commit is contained in:
+6
-9
@@ -63,15 +63,12 @@ export const createApp = (): express.Application => {
|
||||
// the dev machine's LAN IP, never "localhost"). Dev-only, same as above.
|
||||
const lanIpRegex = /^http:\/\/(192\.168\.\d{1,3}\.\d{1,3}|10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}):\d+$/;
|
||||
app.use(cors({
|
||||
// X-Session-* are no longer read by anything on this side, and no longer
|
||||
// sent by anything either: the tickets and feedback cutover took the last
|
||||
// two readers off them, and the calendar cutover removed the last legacy
|
||||
// credential path in the API (its session used to travel in query
|
||||
// parameters - DEFERRED_SECURITY.md item 1, now closed). They stay allowed
|
||||
// only so a browser still running a pre-cutover tickets or feedback bundle
|
||||
// gets a clean 401 rather than a CORS preflight failure. Drop them once
|
||||
// those have aged out - see docs/calendar-auth-migration.md step 5.
|
||||
allowedHeaders: ['Content-Type', 'X-Session-Id', 'X-Session-Key'],
|
||||
// Content-Type alone. X-Session-Id / X-Session-Key were allowed here
|
||||
// through the two cutovers so that a browser still holding a pre-cutover
|
||||
// bundle got a clean 401 rather than a confusing CORS preflight failure.
|
||||
// Nothing has read them since the first cutover and nothing has sent them
|
||||
// since the second, so they came out with the rest of the legacy path.
|
||||
allowedHeaders: ['Content-Type'],
|
||||
// The admin session lives in a cookie, so browsers must be allowed to send
|
||||
// it cross-origin - this is what makes credentials: 'include' work.
|
||||
credentials: true,
|
||||
|
||||
Reference in New Issue
Block a user