Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jwt.jws_api.PyJWS.decode_complete shouldn't accept kwargs argument #606

Closed
manuco opened this issue Jan 14, 2021 · 0 comments · Fixed by #657
Closed

jwt.jws_api.PyJWS.decode_complete shouldn't accept kwargs argument #606

manuco opened this issue Jan 14, 2021 · 0 comments · Fixed by #657

Comments

@manuco
Copy link

manuco commented Jan 14, 2021

Here we are using flask_jwt_extended. There is a call in it that calls jwt.api_jwt.PyJWT.decode with a now disapeared parameter. The problem is that jwt.api_jwt.PyJWT.decode accepts any named parameters, and forwards them to jwt.jws_api.PyJWS.decode_complete. So a call that should fail is working but doing the wrong thing.

Moreover kwargs in jwt.jws_api.PyJWS.decode_complete isn't used at all. It looks suspicious.

Expected Result

If an API caller calls a function with bad parameter, an exception is raised immediately. **kwargs shouldn't be used as garbage parameters collection.

Actual Result

An exception is raised a few line later, masking the real problem of the wrong usage of the API

Reproduction Steps

import jwt
# does not raise even if prout has never been a valid parameter.
unverified_claims = jwt.decode(
        encoded_token, verify=False, prout="bar",
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant