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

+3 -3
View File
@@ -186,7 +186,7 @@ function createTeamSpeakError(code: WebSpeakErrorCode, cause: unknown, diagnosti
*/
export function teamSpeakServerErrorCode(id: unknown): WebSpeakErrorCode | null {
if (id === undefined || id === null) return null;
const text = String(id).trim().toLocaleLowerCase();
const text = String(id).trim().toLowerCase();
if (/^\d{1,6}$/.test(text)) return TEAMSPEAK_SERVER_ERROR_IDS[String(Number(text))] ?? null;
const hexMatch = /^(?:0x)?([0-9a-f]{4,6})$/.exec(text);
if (hexMatch) return TEAMSPEAK_SERVER_ERROR_IDS[String(parseInt(hexMatch[1], 16))] ?? null;
@@ -199,7 +199,7 @@ export function normalizeTeamSpeakError(error: unknown): WebSpeakError {
if (error instanceof WebSpeakError) return error;
const diagnostics = collectDiagnostics(error);
const text = diagnosticText(error).toLocaleLowerCase();
const text = diagnosticText(error).toLowerCase();
// 1) A TeamSpeak server error id names the exact reason, so it outranks every
// keyword heuristic below. The inline scan keeps the `id=515` shape
@@ -258,7 +258,7 @@ export function normalizeTeamSpeakError(error: unknown): WebSpeakError {
// 3) SDK handshake/crypto error classes carry no numeric id at all, so match
// the class name before falling back to the message text.
const errorName = (diagnostics.name ?? "").toLocaleLowerCase();
const errorName = (diagnostics.name ?? "").toLowerCase();
if (/eaxtagmismatch|fakesignaturemismatch|cryptoinit|invalididentity|license/.test(errorName)) {
return createTeamSpeakError("protocol_negotiation_failed", error, diagnostics);
}