fix(#411): narrow verifySession allowlist — prevent false-positive infra error classification
Replace broad "expired" and "unauthorized" substring matches with specific patterns to prevent infrastructure errors from being misclassified as auth errors: - "expired" -> "token expired", "session expired", or exact match "expired" - "unauthorized" -> exact match "unauthorized" only This prevents TLS errors like "certificate has expired" and DB auth errors like "Unauthorized: Access denied for user" from being silently swallowed as 401 responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -130,10 +130,12 @@ export class AuthService {
|
||||
const msg = error.message.toLowerCase();
|
||||
const isExpectedAuthError =
|
||||
msg.includes("invalid token") ||
|
||||
msg.includes("expired") ||
|
||||
msg.includes("token expired") ||
|
||||
msg.includes("session expired") ||
|
||||
msg.includes("session not found") ||
|
||||
msg.includes("unauthorized") ||
|
||||
msg.includes("invalid session");
|
||||
msg.includes("invalid session") ||
|
||||
msg === "unauthorized" ||
|
||||
msg === "expired";
|
||||
|
||||
if (!isExpectedAuthError) {
|
||||
// Infrastructure or unexpected — propagate as 500
|
||||
|
||||
Reference in New Issue
Block a user