yesod/yesod-core/Yesod/Core
Evan Rutledge Borden b50ca99566 Deprecate insecure JSON body functions
`parseJsonBody` and `requireJsonBody` do not require a mime type when
parsing `JSON` content. This leaves them open to CSRF. They are now
deprecated and `insecure` versions are added in their place. Consumers
are now given a proper choice between secure and insecure functions.

There is a potential attack vector in that the browser does not trigger
CORS requests for "simple requests", which includes POST requests that
are form or text content-types. An attacker can craft a form whose body
is valid JSON, and when a user visits attacker.com and submits that
form, it can be submitted to bank.com and bypass CORS.

Checking the content-type is application/json prevents this, because if
the content-type was set to application/json, then the browser would
send a CORS request—a preflight OPTIONS request to the server asking if
the current domain (and some other values) are whitelisted to send
requests to that server. If the server doesn't say attacker.com is
whitelisted, the browser will not send the real request to the server.
2019-01-24 09:12:48 -06:00
..
Class Set X-XSS-Protection to 1; mode=block. 2018-08-03 14:17:11 -05:00
Internal Clean up some CPP 2018-07-03 18:57:23 +03:00
Content.hs Clean up some CPP 2018-07-03 18:57:23 +03:00
Dispatch.hs Drop some deps 2018-07-03 19:01:58 +03:00
Handler.hs Add functions to get and set values in the per-request caches 2019-01-21 10:47:27 -08:00
Internal.hs Add hook to apply arbitrary function to all handlers 2015-12-09 11:29:13 -08:00
Json.hs Deprecate insecure JSON body functions 2019-01-24 09:12:48 -06:00
TypeCache.hs Add functions to get and set values in the per-request caches 2019-01-21 10:47:27 -08:00
Types.hs Remove unneeded version bumps 2018-10-08 10:20:49 +03:00
Unsafe.hs Clean up some CPP 2018-07-03 18:57:23 +03:00
Widget.hs Clean up some CPP 2018-07-03 18:57:23 +03:00