Body-borne pac4jCsrfToken fails the CSRF check when Content-Type carries a charset parameter #56
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/support#56
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Noticed while working SUPP-53 (see #53), independent of that defect.
A body-borne
pac4jCsrfTokensent withContent-Type: application/x-www-form-urlencoded; charset=UTF-8fails the CSRF check.Http4sWebContext.scala:55compares the wholeContent-Typecase class, so thecharset parameter makes the comparison fail, pac4j does not parse the body, and it
falls back to query parameters.
Not live for plain HTML forms or htmx, which send no charset parameter — which is why
it has not been observed. It would bite any client that adds one.
Fix direction: compare media type only, not the full
Content-Typeincludingparameters.