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

Url with authority isn't supported and the request leak the password in plain text #715

Closed
yangby-cryptape opened this issue Nov 20, 2019 · 1 comment

Comments

@yangby-cryptape
Copy link

yangby-cryptape commented Nov 20, 2019

In latest stable version of reqwest (v0.9.22), a url with authority (contain a username, password) isn't supported and the request will leak the password in plain text.

A simple example:

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "http://username:password@localhost:12345/";
    let json = serde_json::json!({
        "id": 2,
        "jsonrpc": "2.0",
        "method": "test",
        "params": []
    });
    let req = reqwest::Client::new().post(url).json(&json);
    println!("{:#?}", req);
    Ok(())
}

The output is:

RequestBuilder {
    client: Client,
    request: Ok(
        Request {
            method: POST,
            url: "http://username:password@localhost:12345/",
            headers: {
                "content-type": "application/json",
            },
        },
    ),
}

And, if we send this request to a http server, the response will be 401 Unauthorized (test with a nginx server).

@seanmonstar
Copy link
Owner

Closed via #735

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

No branches or pull requests

2 participants