Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api): classify key-restricted endpoints case-insensitively (#5652)

tomsideguide31a0b955faf6
diff --git a/apps/api/src/lib/key-restriction.ts b/apps/api/src/lib/key-restriction.ts
index 2532afcda..7bd127040 100644
--- a/apps/api/src/lib/key-restriction.ts
+++ b/apps/api/src/lib/key-restriction.ts
@@ -153,7 +153,8 @@ type EndpointClassification =
// Classifies a request path into an allowlistable endpoint group. Returns
// null for paths outside the versioned API surface (health, admin, ...).
export function classifyEndpoint(rawUrl: string): EndpointClassification {
- const pathname = rawUrl.split("?")[0];
+ // Express routes case-insensitively, so classify the same way.
+ const pathname = rawUrl.split("?")[0].toLowerCase();
const segments = pathname.split("/").filter(s => s.length > 0);
const version = segments[0];
if (version === "v0") {