Skip to content

Commit

Permalink
fix security issue OWASP-BLT#1552
Browse files Browse the repository at this point in the history
  • Loading branch information
JisanAR03 committed Nov 3, 2023
1 parent 3eacb34 commit d10e675
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,10 @@ def get_score(request):


def comment_on_issue(request, issue_pk):

try:
issue_pk = int(issue_pk)
except ValueError:
raise Http404("Issue does not exist")
issue = Issue.objects.filter(pk=issue_pk).first()

if request.method == "POST" and isinstance(request.user,User):
Expand All @@ -2008,10 +2011,7 @@ def comment_on_issue(request, issue_pk):

if parent_comment == None:
messages.error(request,"Parent comment doesn't exist.")
if isinstance(issue_pk, int): # Check if issue_pk is an integer
return redirect(f"/issue2/{issue_pk}")
else:
raise Http404("Issue does not exist")
return redirect(f"/issue2/{issue_pk}")

Comment.objects.create(
parent = parent_comment,
Expand Down

0 comments on commit d10e675

Please sign in to comment.