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
option to disable .netrc #2773
Comments
|
@jwilk This is certainly a thing we could do. However, it's a bizarrely application specific fix that will not actually help in a lot of cases because applications that use requests will need to opt-in to that functionality. This means they need to know enough to do that, which is not likely. Really from a security perspective we should switch to disable netrc auth by default (a change that would need to wait until a 3.0.0 release because it's backwards incompatible, though potentially something worth doing). In the short term, you will get more security either by not using @sigmavirus24 For the longer term, I'm open to swapping our default here, which is arguably somewhat insecure, though I also just think people shouldn't be writing their passwords down anywhere at all, at least not in plaintext. |
|
@Lukasa isn't there already an open issue for turning auto-loading of netrc off by default for 3.0.0? I thought we were in agreement on this already. I've never once thought this was a good idea but we haven't had opportunity to break this behaviour previously. I'd also be okay moving |
|
Quite possibly. Moving |
|
|
|
Then we can leave the function in utils and have the auth handler do the hard work |
|
Suits me. Do we need the ability to have multiple auth handlers? |
|
to work around this, i added a way to disable authentication: class NullAuth(requests.auth.AuthBase):
'''force requests to ignore the ``.netrc``
Some sites do not support regular authentication, but we still
want to store credentials in the ``.netrc`` file and submit them
as form elements. Without this, requests would otherwise use the
.netrc which leads, on some sites, to a 401 error.
Use with::
requests.get(url, auth=NullAuth())
'''
def __call__(self, r):
return rCould that be added in an earlier release? It won't break API... |
|
@anarcat That works fine as a user-specific workaround, but we won't ship it in requests itself. |
|
FWIW, you can disable this functionality today with The idea was that Setting |
|
On 2016-01-31 04:05:17, Kenneth Reitz wrote:
The problem with trust_env is that it works too broadly. For example, it And I think it's fine that requests support .netrc by default, it makes A. La démocratie réelle se définit d'abord et avant tout par la |
|
i got the same problem, Is there way to solve it |
|
|
i will use proxy info, whether not it will influence it |
|
If you set the proxies from environment variables then yes. |
|
so , finally, I detele the .netrc |
|
I'm not sure why this was closed. The only rationale I had so far was that or should I send a PR to document my NullAuth workaround? |
I don't want my applications to read
.netrcfiles, because they are inherently insecure.I know there's (undocumented)
trust_env=False, but it also turns off support for*_proxyenvironment variables.Please add a separate option to disable
.netrcsupport.The text was updated successfully, but these errors were encountered: