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

.netrc not honored if auth-type is used #852

Closed
pszlazak opened this issue Feb 14, 2020 · 6 comments
Closed

.netrc not honored if auth-type is used #852

pszlazak opened this issue Feb 14, 2020 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@pszlazak
Copy link

Once --auth-type switch is used, .netrc is not honored. Authentication details must be provided via --auth switch.

Details:

# http --debug --auth-type=basic example.org
HTTPie 0.9.8
Requests 2.19.1
Pygments 2.2.0
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516]
/usr/bin/python
Linux 4.9.0-9-amd64

<Environment {
    "colors": 8,
    "config": {
        "__meta__": {
            "about": "u'HTTPie configuration file'",
            "help": "u'https://httpie.org/docs#config'",
            "httpie": "u'0.9.8'"
        },
        "default_options": "[]"
    },
    "config_dir": "/root/.httpie",
    "is_windows": false,
    "stderr": "<open file '<stderr>', mode 'w' at 0x7fd6490091e0>",
    "stderr_isatty": true,
    "stdin": "<open file '<stdin>', mode 'r' at 0x7fd6490090c0>",
    "stdin_encoding": "UTF-8",
    "stdin_isatty": true,
    "stdout": "<open file '<stdout>', mode 'w' at 0x7fd649009150>",
    "stdout_encoding": "UTF-8",
    "stdout_isatty": true
}>
usage: http [--json] [--form] [--pretty {all,colors,format,none}]
            [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose]
            [--all] [--history-print WHAT] [--stream] [--output FILE]
            [--download] [--continue]
            [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH]
            [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow]
            [--max-redirects MAX_REDIRECTS] [--timeout SECONDS]
            [--check-status] [--verify VERIFY]
            [--ssl {ssl2.3,tls1,tls1.1,tls1.2}] [--cert CERT]
            [--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version]
            [--traceback] [--default-scheme DEFAULT_SCHEME] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: --auth required
@jkbrzt jkbrzt added the bug Something isn't working label May 12, 2020
@jkbrzt jkbrzt added the help wanted Extra attention is needed label Jun 8, 2020
@velezbeltran
Copy link
Contributor

I'd like to tackle this if that's ok!

@jkbrzt
Copy link
Member

jkbrzt commented Jun 9, 2020

@nb2838 Sure, but maybe after or instead of #926 (which you also expressed interest in)? So things don’t get blocked. Btw, do you happen to be from @MLH-Fellowship?

@velezbeltran
Copy link
Contributor

Hey! No, I am not a part of MLH-Fellowship. I am working with a group of friends on tackling small projects. I asked for both so that my friend and I could work on these two issues together. I am sorry, I should have been more clear about it. Would it be ok for us to work on them?

@jkbrzt
Copy link
Member

jkbrzt commented Jun 9, 2020

Sounds good 👍

@velezbeltran
Copy link
Contributor

velezbeltran commented Jun 13, 2020

I think I have to change the way the program deals with the reading of the .netrc file. Currently, it does by delegating the task to the requests library. However, the way in which this is done doesn't allow for Digest authentication which is why we would need to do it on our own and change that. When I was doing this I came with an issue/doubt. For security reasons, the python function in the standard library doesn't allow to read the .netrc file if the permissions are not strict enough. I was wondering if httpie should do the same thing and if I should implement this functionality?(Perhaps by ignoring the .netrc file if too many permissions are used)

@jkbrzt
Copy link
Member

jkbrzt commented Jun 16, 2020

This is now addressed in current master via b865988. Feedback would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants