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

Vector doesn't support special characters in proxy credentials #17125

Closed
konstantin-kornienko opened this issue Apr 12, 2023 · 2 comments · Fixed by #20868
Closed

Vector doesn't support special characters in proxy credentials #17125

konstantin-kornienko opened this issue Apr 12, 2023 · 2 comments · Fixed by #20868
Labels
domain: core Anything related to core crates i.e. vector-core, core-common, etc type: bug A code related bug.

Comments

@konstantin-kornienko
Copy link

konstantin-kornienko commented Apr 12, 2023

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

When HTTP proxy's credentials contain special characters (like !@#$% etc) they should be url-encoded in http_proxy or https_proxy env vars, like

export https_proxy=http://user:P%40ssw0rd@myproxy:3128

Vector incorrectly parses this, so http sink fails to authenticate in proxy.

Suggested test:

let config = ProxyConfig {
    http: Some("http://user:P%40ssw0rd@1.2.3.4:5678".into()),
    https: Some("https://user:P%40ssw0rd@2.3.4.5:9876".into()),
    ..Default::default()
};
let first = config
    .http_proxy()
    .expect("should not be an error")
    .expect("should not be None");
let encoded_header = format!("Basic {}", BASE64_STANDARD.encode("user:P@ssw0rd"));
let expected_header_value = HeaderValue::from_str(encoded_header.as_str());

assert_eq!(
    first.headers().get("authorization"),
    expected_header_value.as_ref().ok()
);

Configuration

No response

Version

0.28.1

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

@konstantin-kornienko konstantin-kornienko added the type: bug A code related bug. label Apr 12, 2023
@konstantin-kornienko konstantin-kornienko changed the title http_proxy and https_proxy not support special characters in password http_proxy and https_proxy doesn;t support special characters in password Apr 12, 2023
@konstantin-kornienko konstantin-kornienko changed the title http_proxy and https_proxy doesn;t support special characters in password Vector doesn't support special characters in proxy credentials Apr 12, 2023
@neuronull
Copy link
Contributor

Thanks for the report.
Reproduced with that unit test.

@neuronull neuronull added the domain: core Anything related to core crates i.e. vector-core, core-common, etc label Apr 12, 2023
@konstantin-kornienko
Copy link
Author

konstantin-kornienko commented Apr 13, 2023

Thanks @neuronull , the problem is that proxy passwords highly likely contain special characters in the wild )
Hope it can be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: core Anything related to core crates i.e. vector-core, core-common, etc type: bug A code related bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants