security(rls): ENABLE_RLS обязателен в production (fatal без флага)

Шаг 0.1 (завершение) плана production-готовности:
- прод: ENABLE_RLS=true включён, 31 таблица ENABLE+FORCE проверена
- код: fatal при NODE_ENV=production без ENABLE_RLS
- .env.example + DOCKER.md: пометки об обязательности
This commit is contained in:
2026-09-08 10:55:58 +03:00
parent 12e797eb1a
commit 639036c87e
4 changed files with 31 additions and 1 deletions

View File

@@ -985,8 +985,15 @@ async function runStartupDataPatches() {
}
log(`Startup RLS: active — ENABLE+FORCE verified on ${rlsVerified} tables, ${policyVerified} policies`);
} else if (process.env.NODE_ENV === "production") {
// Шаг 0.1: в production RLS обязателен — без изоляции tenant'ов на уровне БД
// процесс не поднимается.
throw new Error(
"Startup RLS: ENABLE_RLS=true is REQUIRED in production. " +
"Set ENABLE_RLS=true in the environment and restart."
);
} else {
log("Startup RLS: ENABLE_RLS not set — policies exist but inactive (safe default)");
log("Startup RLS: ENABLE_RLS not set — policies exist but inactive (safe default, dev only)");
}
const seedDir = path.resolve(