Skip to content

HttpProvider does not handle header parameters properly #234

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

Closed
stojan-jovic opened this issue Apr 10, 2020 · 2 comments · Fixed by #236
Closed

HttpProvider does not handle header parameters properly #234

stojan-jovic opened this issue Apr 10, 2020 · 2 comments · Fixed by #236
Labels
area/security Indicates an issue on security area. kind/bug/confirmed

Comments

@stojan-jovic
Copy link

My API working with Bearer JWT token and when I tried to enable security validation I found few issues. One is already reported in #223 and I'm glad to see that it's already fixed (thank you for that). Second issue is in the same HttpProvider class and refers to the handling of header parameters, specifically Authorization header - it's not case insensitive, but it should be, according to the RFC 2616 and RFC 7230.
And indeed, in my server logic this header field is upper-cased so current HTTP provider implementation raising error for my valid JWT token.

Fix should be pretty simple:

headers = {k.lower(): v for k, v in request.parameters.header.items()}
auth_header = headers.get('authorization')
if auth_header is None:
    raise SecurityError('Missing authorization header.')
@p1c2u p1c2u added area/security Indicates an issue on security area. kind/bug/confirmed labels Apr 11, 2020
@p1c2u
Copy link
Collaborator

p1c2u commented Apr 11, 2020

@stojan-jovic thank you for reporting the issue.

@stojan-jovic
Copy link
Author

Thank you very much for quick fix, respect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security Indicates an issue on security area. kind/bug/confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants