Skip to content

Conversation

@fhammerl
Copy link
Contributor

@fhammerl fhammerl commented Jan 25, 2023

The behaviour of no_proxy is in no way standardised, and it is handled differently by the runner app vs in github actions (see actions/toolkit PR below). The behaviour in this PR is consistent with

no_proxy='*' will now bypass any proxy for any host.

@fhammerl fhammerl requested a review from a team as a code owner January 25, 2023 13:29
Assert.False(proxy.IsBypassed(new Uri("http://192.168.0.123:123")));
Assert.False(proxy.IsBypassed(new Uri("http://192.168.1.123/home")));

Assert.True(proxy.IsBypassed(new Uri("https://google.com")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"actions.com" is not listed in the no_proxy ENV Var, so it will not be bypassed.
.google.com is present in no_proxy, and this change will make it so that such a format in no_proxy also bypasses the top level domain.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh right, I should've checked the whole file. Thank you! 🍫

Choose a reason for hiding this comment

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

porque no revisalo

// Strip leading '.' fron noproxy host
if (noProxyInfo.Host.StartsWith("."))
{
noProxyInfo.Host = noProxyInfo.Host[1..];
Copy link
Contributor

Choose a reason for hiding this comment

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

What by mistake someone set the host to sth like "cs."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like no_proxy="example.com, cs."?
I don't think any valid Hostnames end with cs., end with a .. So, cs. would match nothing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aha this is a range operation, so if the host will be equal to cs. this logic will set noProxyInfo.Host to just .
It's definitely not a valid host but it could be added by mistake. :)

@fhammerl
Copy link
Contributor Author

fhammerl commented Feb 9, 2023

Closing this to keep current behaviour which is consistent with wget

@fhammerl fhammerl closed this Feb 9, 2023
@fhammerl fhammerl reopened this Feb 23, 2023
@fhammerl fhammerl changed the title Bypass proxy for a top level domain even if no_proxy specified it with leading '.'. Make '*' match all. Bypass all proxies for all hosts if no_proxy='*' is set Feb 23, 2023
Assert.False(proxy.IsBypassed(new Uri("https://ggithub.com")));
Assert.False(proxy.IsBypassed(new Uri("https://github.comm")));
Assert.False(proxy.IsBypassed(new Uri("https://google.com")));
Assert.False(proxy.IsBypassed(new Uri("https://google.com"))); // no_proxy has '.google.com', specifying only subdomains bypass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a change in behaviour in this PR. It's an additional test clarifying existing behaviour.

rentziass
rentziass previously approved these changes Feb 28, 2023
Copy link
Member

@rentziass rentziass left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@fhammerl fhammerl merged commit 8ef4820 into main Mar 6, 2023
@fhammerl fhammerl deleted the fhammerl/no-proxy-match-top-level-domain branch March 6, 2023 10:01
nikola-jokic pushed a commit to nikola-jokic/runner that referenced this pull request May 12, 2023
* Bypass top level domain even if no_proxy specified it with leading '.'

E.g. no_proxy='.github.com' will now bypass github.com.

* Bypass proxy on all hosts when no_proxy is * (wildcard)

* Undo '.' stripping

* Simplify unit tests

* Respect wildcard even if it's one of many no_proxy items
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

Successfully merging this pull request may close these issues.

5 participants