Fix URL matching in EventQRCode (Z#23237781)

This commit is contained in:
Mira Weller
2026-06-23 14:21:44 +02:00
parent 3432e62e4f
commit ce4fd2a958
+1 -2
View File
@@ -64,7 +64,6 @@ from django.shortcuts import get_object_or_404, redirect
from django.urls import NoReverseMatch, reverse
from django.utils.functional import cached_property
from django.utils.html import conditional_escape, format_html
from django.utils.http import url_has_allowed_host_and_scheme
from django.utils.safestring import mark_safe
from django.utils.timezone import now
from django.utils.translation import gettext, gettext_lazy as _, gettext_noop
@@ -1742,7 +1741,7 @@ class EventQRCode(EventPermissionRequiredMixin, View):
url = eventreverse_absolute(request.event, 'presale:event.index')
if "url" in request.GET:
if url_has_allowed_host_and_scheme(request.GET["url"], allowed_hosts=[urlparse(url).netloc]):
if request.GET["url"].startswith(url):
url = request.GET["url"]
else:
raise PermissionDenied("Untrusted URL")