Skip to content

Ignore gorilla.csrf.Token form field during Decode - #247

Open
AshSgDe29071999 wants to merge 1 commit into
gorilla:mainfrom
AshSgDe29071999:fix/ignore-gorilla-csrf-token
Open

Ignore gorilla.csrf.Token form field during Decode#247
AshSgDe29071999 wants to merge 1 commit into
gorilla:mainfrom
AshSgDe29071999:fix/ignore-gorilla-csrf-token

Conversation

@AshSgDe29071999

Copy link
Copy Markdown

Fixes #239

gorilla/csrf posts a hidden field named gorilla.csrf.Token. Decode splits keys on . and treats that name as a nested struct path, so a form that is otherwise valid is rejected unless IgnoreUnknownKeys(true) is set.

Skip that well-known field so schema and csrf work together by default. Other dotted unknown keys still return UnknownKeyError.

gorilla/csrf injects a hidden field whose name contains periods. Decode
split that name as a nested path and rejected the request unless
IgnoreUnknownKeys was set. Skip the well-known csrf field so the two
packages work together by default.

See gorilla#239
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Rejects gorilla.csrf.Token by default

1 participant