Repository navigation
Keep a configured Kestrel endpoint unless --port is given [patch] - #141
Conversation
The host wrote Kestrel:Endpoints:Http:Url = http://*:<port> after every other configuration source, with the port defaulting to 8080, so a port or bind address set in appsettings, a --config file or Kestrel__Endpoints__Http__Url was always overwritten and the proxy listened on every interface. The endpoint is now written only when --port is given, or when configuration names no Kestrel endpoint, urls, http_ports or https_ports of its own. Fixes #140 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW6NRQ27ovPhjARcxRW
|
SonarCloud Quality Gate: "B Security Rating on New Code" I can't see which finding this is. The SonarCloud project isn't readable anonymously, and the issues API returns nothing for this PR. The only new non-test code that could plausibly lower the security rating is the endpoint string in I haven't changed it, because plain HTTP is deliberate and isn't new behaviour. It needs a maintainer's call. Either mark the finding as reviewed/safe in SonarCloud, or tell me you'd prefer a All CI test jobs (ubuntu, windows, macos) and CodeQL pass. Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5jpiuVuBRXSgitSY1
S5332 flagged the http:// endpoints ApplyListenPort writes, which failed the security rating on new code. They are the proxy's own listen addresses, the same plain-HTTP default main already uses, so suppress the rule on that one method with the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5jpiuVuBRXSgitSY1
|



Fixes #140
What changed
GitLfsCache.Tool/Program.csdefaulted--portto 8080 and then wroteKestrel:Endpoints:Http:Url = http://*:<port>after every other configuration source. So a port or bind address set in appsettings, a--configfile orKestrel__Endpoints__Http__Urlwas always overwritten, and the proxy always listened on every interface.GitLfsCache.Servicelinks the same file, so the container image was affected too.--portnow staysint?all the way intoRunAsync.Program.ApplyListenPortputs the endpoint into the flag overrides, which are layered over configuration like every other flag:--portis given,http://*:<port>, which wins over configuration;Kestrel:Endpointssection,urls,http_portsorhttps_ports, nothing, so the configured endpoint is used;http://*:8080, the same default as before.--porthelp text now says when the 8080 default applies.GitBranchStateCache#98 has the same defect. It isn't attached to this run, so it isn't changed here.
Tests
New
GitLfsCache.Tests/Tool/PortFlagTests.cscovers the issue's acceptance criteria:Kestrel:Endpoints:Http:Url→ the configured URL winsurls/http_ports/https_ports/ an HTTPS-only endpoint → no HTTP endpoint is forced--port 9000→http://*:9000, even over a configured endpointhttp://*:8080To check the tests catch the bug, I temporarily restored the old behaviour (always write
http://*:{port ?? 8080}). The two "configured endpoint" tests failed, and they pass with the fix. Full suite: 449 passed, 0 failed.Generated by Claude Code