Skip to content

Commit 5b56fad

Browse files
Fix code scanning alert no. 51: Reflected server-side cross-site scripting
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent ecf9c11 commit 5b56fad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from oauthlib.oauth2.rfc6749.errors import InvalidClientError, InvalidGrantError
2424
from rest_framework import status
2525
from urllib.parse import urlparse, parse_qs
26-
26+
import html
2727
from apps.dot_ext.scopes import CapabilitiesScopes
2828
import apps.logging.request_logger as bb2logging
2929

@@ -374,7 +374,8 @@ def post(self, request, *args, **kwargs):
374374
try:
375375
token = at_model.objects.get(token=tkn)
376376
except at_model.DoesNotExist:
377-
return HttpResponse(f"Token {tkn} was Not Found. Please check the value and try again.",
377+
escaped_tkn = html.escape(tkn)
378+
return HttpResponse(f"Token {escaped_tkn} was Not Found. Please check the value and try again.",
378379
status=status.HTTP_404_NOT_FOUND)
379380

380381
try:

0 commit comments

Comments
 (0)