fix: add fail-closed preHandler auth check
Deploy to Coolify / deploy (push) Failing after 2s
CI (SIAX Cloud) / security (push) Successful in 13s
CI (SIAX Cloud) / contracts (push) Successful in 16s
CI (SIAX Cloud) / quality (push) Successful in 49s

This commit is contained in:
2026-09-16 15:13:13 +02:00
parent 64ff90517c
commit db3509ab4f
+9
View File
@@ -11,6 +11,15 @@ async function main() {
timestamp: new Date().toISOString(),
}));
server.addHook("preHandler", async (request, reply) => {
if (request.url === "/health") return;
const auth = request.headers.authorization;
if (!auth || !auth.startsWith("Bearer ")) {
await reply.code(401).send({ error: "Unauthorized" });
return;
}
});
server.get("/", async () => ({
name: "c0py",
version: "0.1.0",