Skip to content

Commit

Permalink
Fix Silently Discarding Data
Browse files Browse the repository at this point in the history
This patch catches a problem where the API would silently discard
additional data passed to the event modification endpoint instead of
returning a bad request.
  • Loading branch information
lkiesow committed Mar 7, 2022
1 parent 0050805 commit 6db6bfe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyca/ui/jsonapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ def modify_event(db, uid):
of the scheduler cache cannot be modified.
'''
try:
data = request.get_json()['data'][0]
data = request.get_json()['data']
if len(data) != 1:
return make_error_response('Invalid data', 400)
data = data[0]
if data['type'] != 'event' or data['id'] != uid:
return make_error_response('Invalid data', 400)
# Check attributes
Expand Down

0 comments on commit 6db6bfe

Please sign in to comment.