Skip to content
  • Sponsor
  • Notifications You must be signed in to change notification settings
  • Fork 137

HttpProvider does not handle header parameters properly #234

Closed
@stojan-jovic

Description

@stojan-jovic

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.')

Activity

p1c2u

p1c2u commented on Apr 11, 2020

@p1c2u
Collaborator

@stojan-jovic thank you for reporting the issue.

stojan-jovic

stojan-jovic commented on Apr 11, 2020

@stojan-jovic
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      HttpProvider does not handle header parameters properly · Issue #234 · python-openapi/openapi-core