Describe the bug
When passing in invalid hex encoding in the querystring (for example %%2A), a ValueError
is raised in https://github.com/oauthlib/oauthlib/blob/b69fa53fd836dc559aa7fcd78ce075bcbe361629/oauthlib/common.py#L395 and the Django application will return 500 HTTP error code.
To Reproduce
- Have an endpoint that accepts the token in a querystring
- Send an invalid querystring (in our example it was an extra % - not converted to %25) just before a hex value.
Examples:
/endpoint/?evae%%7B7%2A191%7Daith=
/endpoint/?beiy%%%%%%%%3moh=
Expected behavior
I think a 400 status would be more appropriate, it's the client that's sending invalid data.
Version
1.5.0
Additional context
- First I'd like to ask some help in triaging this issue - is it best fixed in django-oauth-toolkit, or would it be better to be fixed in oauthlib?
- More than happy to contribute to the issue with a PR
Thank you!