Don't accept decode(..., algorithm=...) #446
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
api_jws.decode()
function was accepting **kwargs but not using it. From my point of view, it's a lie: you can calldecode
with a typo in a parameter without any warning.The bad thing is one could do:
without noticing the
algorithm
is ignored, thus opening a vulnerabiliy.By not accepting the **kwargs, we're enforing all parameters are "eaten" by the previous class, leading to a nice explicit:
error being raised.
Tried to run tox but I was having:
before my patch, so it looks like my patch introduced no new errors.
I had to move
**kwargs
out of_validate_claims
, it should not really change its signature, except that know it does no longer accept verify_expiration directly (but as it's a "private" method, I think it's OK).I also had to move kwargs poping before calling
super().decode(
, so it won't get unexpected parameters.