Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

When a 401 response is received, raise BadAuthenticationError if credentials were present in the request URI #6928

Merged
3 commits merged into from
Apr 28, 2019

Conversation

jdliss
Copy link
Contributor

@jdliss jdliss commented Jan 23, 2019

What was the end-user problem that led to this PR?

Some gem servers respond to bad username/password request with a 401 instead of a 403.

What was your diagnosis of the problem?

When a 401 response was received, bundler would automatically assume no credentials were supplied, leading to a response of

Authentication is required for http://moto@gems.motologic.com/.
Please supply credentials for this source. You can do this by running:
 bundle config http://moto@gems.motologic.com/ username:password

even when a username and password was present in the bundler config.

What is your fix for the problem, implemented in this PR?

There already exists a check for credentials in the request URI for 403 responses. I took that pattern and implemented it for 401 responses as well.

Why did you choose this fix out of the possible options?

I chose this fix because a very similar pattern already exists in bundler, I just applied the same logic to another response code.

@welcome
Copy link

welcome bot commented Jan 23, 2019

Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #bundler channel on Slack.

For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide

Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me too! 👍

@deivid-rodriguez
Copy link
Member

No further feedback so going in!

@bundlerbot r+

ghost pushed a commit that referenced this pull request Apr 28, 2019
6928: When a 401 response is received, raise BadAuthenticationError if credentials were present in the request URI r=deivid-rodriguez a=jdliss


### What was the end-user problem that led to this PR?

Some gem servers respond to bad username/password request with a 401 instead of a 403.

### What was your diagnosis of the problem?

When a 401 response was received, bundler would automatically assume no credentials were supplied, leading to a response of

```
Authentication is required for http://moto@gems.motologic.com/.
Please supply credentials for this source. You can do this by running:
 bundle config http://moto@gems.motologic.com/ username:password
```

even when a username and password was present in the bundler config.

### What is your fix for the problem, implemented in this PR?

There already exists a check for credentials in the request URI for 403 responses.  I took that pattern and implemented it for 401 responses as well.

### Why did you choose this fix out of the possible options?

I chose this fix because a very similar pattern already exists in bundler, I just applied the same logic to another response code.

Co-authored-by: Jonathan <jonacom@lissismore.com>
@ghost
Copy link

ghost commented Apr 28, 2019

Build succeeded

@ghost ghost merged commit 74342c6 into rubygems:master Apr 28, 2019
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants