Commit Graph

8 Commits

Author SHA1 Message Date
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
Michael Snoyman
3dc2d10b30 Compile with -Wall -Werror 2017-02-05 12:09:18 +02:00
Michael Snoyman
24e8e53f64 Merge remote-tracking branch 'origin/master' into persistent2-simpler-dispatch
Conflicts:
	.gitignore
	yesod-core/yesod-core.cabal
2014-03-20 04:14:09 +02:00
Greg Weber
5c3078b51e parseJsonBody_ deprecated for requireJsonBody 2014-03-11 18:07:46 -07:00
Michael Snoyman
c19088d569 Switch yesod-core to use simpler dispatch 2014-03-04 13:46:03 +02:00
Michael Snoyman
8ab09931c4 Code cleanup and transformer instances 2013-03-22 09:17:14 +02:00
Michael Snoyman
cf77d86a6a Use new mkParseRouteInstance in yesod-core 2013-03-19 15:17:28 +02:00
Michael Snoyman
2377d70ec8 Merge branch 'master' into yesod1.2
Conflicts:
	yesod-json/yesod-json.cabal
2013-03-10 09:49:28 +02:00