1
0
Fork 0

Add flaw 1: Broken Access Control

This commit is contained in:
Vili Sinervä 2024-11-25 16:33:17 +02:00
parent 9e55b0a1ed
commit 05fec8a837
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
2 changed files with 18 additions and 4 deletions

View file

@ -36,10 +36,12 @@ def add(request):
@login_required()
def remove(request, note_id):
if request.method == 'POST':
user = request.user
note = Note.objects.get(pk=note_id)
if user == note.owner:
note.delete()
# FLAW 1:
# Adding an ownership check would fix the problem
# user = request.user
# if user == note.owner:
note.delete()
return HttpResponseRedirect(request.META.get('HTTP_REFERER', 'index'))