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

[JENKINS-73499] Add a warning if there is a risk of exposing credentials through a non-TLS proxy connection #9491

Merged
merged 6 commits into from
Aug 10, 2024

Conversation

jmdesprez
Copy link
Contributor

See JENKINS-73499.

Testing done

Here is a screenshot of my local testing:
image

For now there is no automated testing. Let me know if I need to add one (I will need some guidance).

Proposed changelog entries

  • Add a warning if there is a risk of exposing credentials through a non-TLS proxy connection

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

Before the changes are marked as ready-for-merge:

Maintainer checklist

Copy link
Contributor

@Wadeck Wadeck left a comment

Choose a reason for hiding this comment

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

Just some non-blocker comments :-)

core/src/main/java/hudson/ProxyConfiguration.java Outdated Show resolved Hide resolved
core/src/main/resources/hudson/Messages_fr.properties Outdated Show resolved Hide resolved
core/src/main/resources/hudson/Messages.properties Outdated Show resolved Hide resolved
Copy link
Contributor

@mawinter69 mawinter69 left a comment

Choose a reason for hiding this comment

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

The warning is always shown as soon as username or password are not empty. Even when I configure a https proxy url or (as in the screenshot) no url is configured.
Ideally this warning is only shown when using a http url.

@jmdesprez
Copy link
Contributor Author

The warning is always shown as soon as username or password are not empty. Even when I configure a https proxy url

My understanding is that it is not possible to configure an https proxy. When filling out the configuration, one only provides the host and the port number, like in the below screenshot:
image

And it is not possible to specify which protocol the server will use:
image

So I've come to the conclusion that the connection to the proxy is always via http (non-TLS).

But I may have missed something.

or (as in the screenshot) no url is configured. Ideally this warning is only shown when using a http url.

My example is a bit silly because If there is no URL configured, then the entire proxy configuration will be discarded anyway.
Typically, the first two fields are filled in first, then the username and password.

I can, of course, change this, but then I suppose the validation will be more complex to write because several fields will be involved.

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

I don't know how common https proxies are in the wild but maybe support for that should be added to go with this?

I've seen this:
https://www.chromium.org/developers/design-documents/secure-web-proxy/

and

https://security.stackexchange.com/a/23584

core/src/main/resources/hudson/Messages.properties Outdated Show resolved Hide resolved
@jmdesprez
Copy link
Contributor Author

I don't know how common https proxies are in the wild but maybe support for that should be added to go with this?

I've seen this: chromium.org/developers/design-documents/secure-web-proxy

and

security.stackexchange.com/a/23584

Based on (non-exhaustive) search on the Internet, https proxies are indeed not so common. On the client side, in addition to those you have mentioned, curl supports https proxies (see daniel.haxx.se/blog/2016/11/26/https-proxy-with-curl). For example, OKHttp doesn't support it (see square/okhttp#3787).

maybe support for that should be added to go with this?

Do you mean as part of this ticket or in a new ticket?

@jmdesprez
Copy link
Contributor Author

Additionally, it seems that people usually don't worry about the http connection because the proxy is usually on a private network.

@timja
Copy link
Member

timja commented Jul 31, 2024

Based on (non-exhaustive) search on the Internet, https proxies are indeed not so common. On the client side, in addition to those you have mentioned, curl supports https proxies (see daniel.haxx.se/blog/2016/11/26/https-proxy-with-curl). For example, OKHttp doesn't support it (see square/okhttp#3787).

Sounds risky to support it then as okhttp is used in a number of places we wouldn't be able to support it fully.

Additionally, it seems that people usually don't worry about the http connection because the proxy is usually on a private network.

Yes and also its only the initial CONNECT request and not e.g. every request so they've got to capture that initial request.

@jmdesprez
Copy link
Contributor Author

@timja
I resolved the conversations and I updated the branch.
Please let me know if anything is missing so it can be marked as ready for merge.

@timja
Copy link
Member

timja commented Aug 7, 2024

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Aug 7, 2024
@timja timja merged commit d176756 into jenkinsci:master Aug 10, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants