Files
coder/coderd
Bobby Ho 6372f67f7d fix(coderd/httpmw): normalize repeated slashes before CSRF exemption check (#29798)
The CSRF middleware decides whether to protect a request based on the
raw URL path, but the router collapses repeated slashes before matching.
A path like `/oauth2//authorize` or `//api/v2/...` reaches the real
handler while skipping CSRF checks.

- Normalize the path before the exemption check, the same way `cors.go`
already does.
- Add test cases for respelled `/api` and `/oauth2/authorize` paths.

Fixes
https://linear.app/codercom/issue/PLAT-672/csrf-exemption-bypass-via-path-respelling-post-oauth2authorize-forges
2026-09-23 12:50:35 -07:00
..