feat(auth): add optional authentication boundary

- Add account, JWT session, revocation, cookie and bearer handling.
- Protect server surfaces while preserving public health, manifest and disabled mode.
- Add SQLite migration and focused server regression coverage.
This commit is contained in:
agent committed 2026-11-04 15:43:33 -05:00
1 parent d4bb274982
commit de41571b5c
33 files changed
+1083 -20

No files matched your search

+20 -1
View File
@@ -8,6 +8,22 @@ import type { Request, Response } from "express";
import { Observable, tap } from "rxjs";
import { TraceLogger } from "../common/trace-logger";
export function redactAuthRequestBody(path: string, body: unknown): unknown {
if (
!/^(?:\/api\/v1)?\/auth\/login$/.test(path) ||
!body ||
typeof body !== "object" ||
Array.isArray(body)
) {
return body;
}
const requestBody = body as Record<string, unknown>;
return {
...requestBody,
password: requestBody.password ? "[REDACTED]" : requestBody.password,
};
}
@Injectable()
export class LoggingInterceptor implements NestInterceptor {
private readonly logger = new TraceLogger(LoggingInterceptor.name);
@@ -18,8 +34,11 @@ export class LoggingInterceptor implements NestInterceptor {
const res = http.getResponse<Response>();
const { method, url, body } = req;
const start = Date.now();
const safeBody = redactAuthRequestBody(req.path, body);
const bodyStr =
body && Object.keys(body).length ? ` ${JSON.stringify(body)}` : "";
safeBody && Object.keys(safeBody).length
? ` ${JSON.stringify(safeBody)}`
: "";
this.logger.debug(`→ ${method} ${url}${bodyStr}`);