You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: badly formed hexadecimal UUID string
(23 additional frame(s) were not displayed)
...
File "kolibri_public/views.py", line 65, in wrapper_func
response = some_func(*args, **kwargs)
File "kolibri_public/views.py", line 700, in retrieve
queryset = self.get_tree_queryset(request, pk)
File "kolibri_public/views.py", line 646, in get_tree_queryset
if pk and self.filter_queryset(self.get_queryset()).filter(id=pk).exists()
File "kolibri_content/fields.py", line 159, in get_db_prep_value
value = uuid.UUID(value)
Expected behavior
This error is caused by 'bad input', which we still don't want to accept. Although, since the error causes a 500 response, it would be better for us to validate any request input matches what we expect, which in this case the request parameter looks like a UUID, and return a 'Bad Request' response instead. We should do this for all the public APIs.
The text was updated successfully, but these errors were encountered:
bjester
changed the title
ValueError: badly formed hexadecimal UUID string
Add defensive checks against URI parameters in the public API
Oct 16, 2024
Observed behavior
Requests to the public APIs, such as
/api/public/v2/contentnode_tree/8f0a5b9d89795/
, that have an invalid UUID cause a 500 error.Sentry Issue: STUDIO-HH7
Expected behavior
This error is caused by 'bad input', which we still don't want to accept. Although, since the error causes a 500 response, it would be better for us to validate any request input matches what we expect, which in this case the request parameter looks like a UUID, and return a 'Bad Request' response instead. We should do this for all the public APIs.
The text was updated successfully, but these errors were encountered: