refactor: replace custom HMAC CSRF with hono/csrf middleware

Removes 38-line hand-rolled HMAC-SHA256 implementation in favour of
the built-in hono/csrf, which validates the Origin header natively.

- Delete src/utils/csrf.ts
- Replace custom CSRF middleware with hono/csrf (Origin-header check)
- Remove csrfToken from ContextVariableMap, layout(), forms, and JS fetch() calls
- Update admin tests: swap X-CSRF-Token for Origin header

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Julien HerrandClaude Sonnet 4.6 committed 2026-05-22 10:28:26 +02:00
1 parent 7d375693b9
commit a0415cdc41
4 files changed
+26 -116

No files matched your search

-1
View File
@@ -4,6 +4,5 @@ import { Env } from "./index";
declare module "hono" {
interface ContextVariableMap {
env: Env;
csrfToken: string;
}
}