Repository navigation
[repo-assist] Fix NO_PROXY wildcard bypass entries not matching subdomains - #4392
Merged
dsyme merged 1 commit intoAug 29, 2026
Merged
Conversation
Root cause: envProxies() built the bypass regex by first calling
Regex.Escape on the entire NO_PROXY string, then attempting to
replace literal '*' with '.*'. But Regex.Escape had already turned
'*' into the literal sequence '\*', so the later .Replace("*", ".*")
matched nothing and wildcard entries like '*.internal.company.com'
were passed through as a useless escaped literal pattern that could
never match any host, causing the proxy to always be used even when
it should have been bypassed.
Fix: split each NO_PROXY entry on '*', Regex.Escape only the literal
segments, and rejoin with '.*', producing a valid regex consistent
with WebProxy.BypassList semantics.
Closes #3548
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme
marked this pull request as ready for review
August 29, 2026 10:18
dsyme
approved these changes
Aug 29, 2026
17 tasks
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated fix from Repo Assist, an AI assistant.
Closes #3548
Root cause
envProxies()insrc/Paket.Core/Common/NetUtils.fsbuilt theNO_PROXYbypass regex by:Regex.Escapeon the entireNO_PROXYstring..Replace("*", ".*")to turn wildcard entries into a valid regex wildcard.But step 1 already turns a literal
*into the escaped sequence\*, so step 2'sReplace("*", ".*")never finds a bare*to replace — it silently no-ops. The result is that aNO_PROXYentry like*.internal.company.comwas compiled into the bypass list as the literal (non-wildcard) pattern\*\.internal\.company\.com, which will essentially never match a real hostname. This meant users with wildcard/domain-suffix entries inNO_PROXY/no_proxyhad their proxy bypass silently ignored — exactly the symptom reported in #3548.Fix
Split each comma-separated
NO_PROXYentry on*first,Regex.Escapeonly the literal segments, then rejoin with.*. This produces a proper regex (e.g..*\.internal\.company\.com) consistent with howSystem.Net.WebProxy.BypassListsemantics are documented and how the existing non-wildcard test cases already expected escaping to behave.Trade-offs
UtilsSpecs.fs) whose expected value encoded the buggy output ("(redacted)*\\.asdf\\.com"→".*\\.asdf\\.com").WebProxy.IsBypassedactually returnstruefor a host matching a wildcardNO_PROXYentry, andfalsefor a non-matching host.Test Status
Ran targeted tests:
dotnet test tests/Paket.Tests/Paket.Tests.fsproj --filter "FullyQualifiedName~env proxy|FullyQualifiedName~no_proxy".no_proxy wildcard bypass entry actually bypasses matching subdomainpasses.get http env proxy with bypass list containing wildcardspasses with corrected expectation.get http/https env proxy with port and credentials,no env proxy without http/https_proxy env var) were confirmed viagit stashto already fail identically onmasterbefore this change — they are caused by test-parallelism/env-var pollution across proxy tests, unrelated to this fix. No new failures were introduced.As always, please review before merging — happy to adjust if maintainers see edge cases I've missed (e.g. Mono/
CUSTOM_WEBPROXYbuild path bypass matching, which is a separate code path not touched here).Add this agentic workflow to your repo
To install this agentic workflow, run