mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 03:24:54 +00:00
[WebUI] Only accept application/json content-type requests
- Protects against CSRF (Cross-site request forgery)
This commit is contained in:
parent
25150f13af
commit
318ab17986
1 changed files with 4 additions and 0 deletions
|
@ -262,6 +262,10 @@ class JSON(resource.Resource, component.Component):
|
|||
Handler to take the json data as a string and pass it on to the
|
||||
_handle_request method for further processing.
|
||||
"""
|
||||
if request.getHeader('content-type') != 'application/json':
|
||||
message = 'Invalid JSON request content-type: %s' % request.getHeader('content-type')
|
||||
raise JSONException(message)
|
||||
|
||||
log.debug("json-request: %s", request.json)
|
||||
response = {"result": None, "error": None, "id": None}
|
||||
response["id"], d, response["error"] = self._handle_request(request)
|
||||
|
|
Loading…
Add table
Reference in a new issue