Enforce request body size limit before CSRF middleware parses the form #90
Reference in New Issue
Block a user
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?
Tracking issue from the PR #83 review (non-blocking there — pre-existing idiom shared with the login handler).
Problem
Handlers install
http.MaxBytesReader(1 MB) inside the handler, but gorilla/csrf (v1.7.3, helpers.go:113) has already parsed the request body viar.PostFormValueby the time the handler runs. The form is therefore parsed under net/http's default 10 MB cap, and the intended 1 MB limit is never effective for form fields. Affects at least the login and password-change handlers.Definition of done
MaxBytesReadercalls that are now redundant are removed or kept consistent deliberately (documented either way).