Skip to content

Commit

Permalink
www.dashboard: only accept valid UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Dec 18, 2024
1 parent e828102 commit 267fc58
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions itou/www/dashboard/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import uuid

from allauth.account.views import PasswordChangeView
from django.conf import settings
from django.contrib import auth, messages
Expand Down Expand Up @@ -286,8 +288,10 @@ def edit_job_seeker_info(request, job_seeker_public_id, template_name="dashboard
User.objects.filter(kind=UserKind.JOB_SEEKER).select_related("jobseeker_profile"),
public_id=job_seeker_public_id,
)
from_application_uuid = request.GET.get("from_application")
tally_form_query = from_application_uuid and f"jobapplication={from_application_uuid}"
try:
from_application_uuid = uuid.UUID(request.GET.get("from_application"))
except (TypeError, ValueError):
from_application_uuid = None
if not request.user.can_edit_personal_information(job_seeker):
raise PermissionDenied

Expand All @@ -297,7 +301,7 @@ def edit_job_seeker_info(request, job_seeker_public_id, template_name="dashboard
instance=job_seeker,
editor=request.user,
data=request.POST or None,
tally_form_query=tally_form_query,
tally_form_query=f"jobapplication={from_application_uuid}" if from_application_uuid else None,
)

if request.method == "POST" and form.is_valid():
Expand Down

0 comments on commit 267fc58

Please sign in to comment.