Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(api): improve API key verification and error handling

Andrej Acevski88bf481e7e60
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 2c67abf0c..52d92bdf2 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -128,8 +128,14 @@ api.use("*", async (c, next) => {
c.set("session", null);
return next();
}
+
+ throw new HTTPException(401, { message: "Invalid API key" });
} catch (error) {
+ if (error instanceof HTTPException) {
+ throw error;
+ }
console.error("API key verification failed:", error);
+ throw new HTTPException(401, { message: "API key verification failed" });
}
}
diff --git a/apps/api/src/search/index.ts b/apps/api/src/search/index.ts
index 1f99d3dec..4e6ddd931 100644
--- a/apps/api/src/search/index.ts
+++ b/apps/api/src/search/index.ts
@@ -67,6 +67,7 @@ const search = new Hono<{
v.string(),
v.transform(Number),
v.minValue(1, "Limit must be at least 1"),
+ v.maxValue(50, "Limit must not exceed 50"),
),
"20",
),