mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
python: require local protection to be absent
for CSRF to be likely
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, JsonResponse, HttpResponseNotFound
|
||||
from django.views.generic import RedirectView
|
||||
from django.views.decorators.csrf import csrf_protect
|
||||
import django.shortcuts
|
||||
import json
|
||||
|
||||
@@ -117,6 +118,7 @@ class CustomJsonResponse(JsonResponse):
|
||||
def __init__(self, banner, content, *args, **kwargs):
|
||||
super().__init__(content, *args, content_type="text/html", **kwargs)
|
||||
|
||||
@csrf_protect
|
||||
def safe__custom_json_response(request):
|
||||
return CustomJsonResponse("ACME Responses", {"foo": request.GET.get("foo")}) # $HttpResponse mimetype=application/json MISSING: responseBody=Dict SPURIOUS: responseBody="ACME Responses"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user