Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Notes:
<meta name="htmx-config" content='{"responseHandling":[{"code":"422","swap":true},{"code":"204","swap":false},{"code":"[23]..","swap":true},{"code":"[45]..","swap":false,"error":true}]}'>
```

- CSRF: hime ships no CSRF middleware — wire your token with `hx-headers`, e.g. `<body hx-headers='{"X-CSRF-Token": "{{.Token}}"}'>`. Use per-session (not per-request) tokens, or set `hx-history="false"`, since htmx snapshots pages into localStorage.
- CSRF: set `SameSite=Lax` (or `Strict`) explicitly on your session cookie and never mutate state on GET — that alone stops classic cross-site form CSRF in modern browsers. For defense-in-depth (untrusted subdomains are still "same-site"), wrap your handler with the standard library's [`http.NewCrossOriginProtection`](https://pkg.go.dev/net/http#CrossOriginProtection): `app.Handler(cop.Handler(mux))` — hime adds nothing because it composes directly. If you use token middleware anyway, wire it with `hx-headers`, e.g. `<body hx-headers='{"X-CSRF-Token": "{{.Token}}"}'>`, and prefer per-session tokens (or set `hx-history="false"`) since htmx snapshots pages into localStorage.

## License

Expand Down
Loading