fix(security): address PR 48 findings with bounded concurrent authentication

Classify IPv6 subnets numerically, reserve login capacity before hashing, bind authentication to credential revisions, revoke other sessions on password rotation, reuse trusted proxy client keys and bound PCM encoding by monotonic time. Credit ph1gros for the findings and proposed regression cases.
This commit is contained in:
illusia committed 2026-10-26 10:28:45 +08:00
1 parent 8bca848c21
commit 275e27c4ac
31 files changed
+449 -84

No files matched your search

+7
View File
@@ -50,6 +50,13 @@ export class AdminSessionStore {
clear(): void {
this.sessions.clear();
}
/** A credential change retains only the authenticated session that performed it. */
revokeOthers(request: Request): void {
const token = readCookie(request.headers.cookie, COOKIE_NAME);
const keep = token ? hashToken(token) : null;
for (const key of this.sessions.keys()) if (key !== keep) this.sessions.delete(key);
}
}
export function isSecureRequest(request: Request): boolean {