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

Making requests_client.py's Authenticator URL matches() port-tolerant #384

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

myselfhimself
Copy link

Authenticator::matches()'s documentation advertises full host, scheme and port match, when it just checks for hosts. However when checking hosts, it cannot compare well a configured self.host:withPort (eg. localhost:8080) with the outgoing request full URL's host.
Such a corner case can happen with this piece of code:
http_client.set_basic_auth(
'localhost:8080',
BASIC_AUTH_LOGIN, BASIC_AUTH_PASSWORD
)

Authenticator::matches()'s documentation advertises full host, scheme and port match, when it just checks for hosts. However when checking hosts, it cannot compare well a configured self.host:withPort (eg. localhost:8080) with the outgoing request full URL's host.
Such a corner case can happen with this piece of code:
http_client.set_basic_auth(
        'localhost:8080',
        BASIC_AUTH_LOGIN, BASIC_AUTH_PASSWORD
    )
@myselfhimself
Copy link
Author

Same issue with the set_api_key() method. This makes authenticated bravado requests fail when unit testing on a local server hosted at localhost:8080..

@coveralls
Copy link

coveralls commented Jul 19, 2018

Coverage Status

Coverage remained the same at 98.499% when pulling 16cf8ea on myselfhimself:myselfhimself-non-port-tolerant-authenticator-matches into d30b9bd on Yelp:master.

@axsapronov
Copy link

⬆️

@myselfhimself
Copy link
Author

myselfhimself commented Nov 26, 2019 via email

@sjaensch
Copy link
Contributor

sjaensch commented Feb 6, 2020

This has been reworked in the meantime (in #444), and now compares host and port (correctly). Are you able to test with the latest master and confirm that it fixes the issue for you @myselfhimself ? I could then make a release that includes the change.

@myselfhimself
Copy link
Author

myselfhimself commented Feb 7, 2020 via email

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 this pull request may close these issues.

4 participants