Repository navigation
Conversation
as given: a name with letters outside ASCII, a number that curl reads as an IPv4 address, a port outside 1-65535, an IPv4 literal with a zone, or a base URL with `?`, `#`, a space or an upper-case scheme. A link stored before that keeps its host, and every run handed it to git. Depending on the host, git or curl refused the URL, or curl dialed an address that the registration check never saw (2130706433 is 127.0.0.1), and the failure class varied. Each pull and push run now checks the stored host with the rule of POST /repos before git starts. A host that fails it fails the run as `repository configuration error`, and the cause is the reason that POST /repos gives, `upstream host is not a valid host`, without the host. ValidUpstreamHost and its helpers move from internal/api to internal/sync, because api imports sync and not the reverse, and InvalidUpstreamHostReason is the shared reason. A file:// host stays exempt: only the tests' fixtures store one, and GIT_ALLOW_PROTOCOL refuses it in production. The docs tell operators to link such an upstream again with the host in its ASCII form. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I4bd9c08939f72be8e5b3a5c90bda11244103b1ae Signed-off-by: Thomas Kosiewski <tk@coder.com>
worker.go and handlers_sync.go are covered code: upstreamURLFailure checks the stored host, and the host rule moves to internal/sync. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I52a372967181736ba269cb6f75dbde8513212b8b Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Since #903,
POST /reposrefuses an upstream host that a sync run cannot use as given. A link stored before that keeps such a host, and every pull and push run still handed it to git. The result depended on the host, and so did the failure class. The new test on main (allow-private egress policy, the test fixture's default) shows it:bücher.example,https://bücher.examplefailed to clone repository/failed to push to upstream: this host's curl refused the URL (URL using bad/illegal format)http://2130706433:<port>,http://0x7f.1:<port>,http://127.0.0.1:<port>?http://127.0.0.1:<port>/a b,forge.example:65536HTTP://127.0.0.1:<port>transport 'HTTP' not allowed)https://[fe80::1%25eth0]upstream repository unreachable: the egress dial failedNow each run checks the stored host with the rule of
POST /reposbefore git starts. A host that fails it fails the run asrepository configuration error. The cause in the server'sWARNline for the run is the reason thatPOST /reposgives,upstream host is not a valid host, and it does not repeat the host.A stored link that synced before can now fail every run. With the allow-private policy, a
http://2130706433:<port>link reached a git server on 127.0.0.1 and could sync from it; abücher.examplelink could sync where the server's curl and locale convert the name (I did not verify this; this host's curl refuses it). This is the intended change, and it goes into the release notes with #903's. The docs tell operators to link such an upstream again with the host in its ASCII form.Changes
ValidUpstreamHostand its helpers (dialableAuthority,dialableHostname,resolverName,curlIPv4Name,curlIPv4Part) move unchanged frominternal/api/handlers_sync.gotointernal/sync/upstreamhost.go, because api imports sync and not the reverse.InvalidUpstreamHostReason(is not a valid host) is the reason both packages give.TestValidUpstreamHostmoves with them.upstreamURLFailure, which both lanes call before git starts, checks the host before the URL length. Afile://host is exempt: only the tests' fixtures store one,POST /reposnever has, andGIT_ALLOW_PROTOCOLrefuses it in production.docs/reference/http-api.md("Upstream sync") says how such a run fails and how to link the upstream again; the READMEs ofinternal/apiandinternal/sync.worker.goandhandlers_sync.goare covered by the lane-schedule model, so the fingerprints are re-recorded. The host rule's functions leave the record withhandlers_sync.go: the model describes lanes, not hosts.Evidence
TestRunRefusesStoredInvalidHost(internal/sync) stores the nine hosts above, at least one per class thatPOST /reposrefuses, and runs each through the pull lane and the push lane. Each run must return exactlyrepository configuration error: upstream host is not a valid host, emit a failed event withrepository configuration error, send no request to the loopback upstream, and log that cause without the host.worker.go, all 18 cases fail as in the table.go test -race -tags=openstorage_viewcheckof./internal/sync/...(91 s) and./internal/api/...without pg (373 s) passes at d75a879. PostgreSQL and S3-WAL rely on CI.Found by the reviews of #903 (desk follow-up).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh