Skip to content

fix(sync): send an upper-case http(s) scheme through the egress proxy - #905

Merged
ThomasK33 merged 2 commits into
mainfrom
sync-egress-scheme-case
Nov 17, 2026
Merged

ThomasK33 merged 2 commits into
mainfrom
sync-egress-scheme-case

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

The pull and push lanes started the sync egress proxy only for an upstream URL that began with a lower-case http:// or https://. A link stored with any other letter case (HTTPS://, Https://, HTTP://) skipped the proxy, so the guard that refuses private and metadata destinations never saw its dial.

No link with an upper-case scheme gets past the guard today. The worker pins GIT_ALLOW_PROTOCOL=http:https, and git compares transport names case-sensitively, so it refuses such a link before any dial (fatal: transport 'HTTPS' not allowed, git 2.55.0, fetch and push). This PR removes the guard's dependence on that. POST /repos refuses an upper-case scheme since #903, so only a link stored before that can hold one.

Changes

  • viaEgressProxy(url) (internal/sync/egress.go): true when the scheme is http or https in any letter case. URL schemes are case-insensitive (RFC 3986), and curl dials HTTPS:// as https. The pull lane (transfer) and the push lane use it in place of the two lower-case prefix checks.
  • The lane-schedule model covers both call sites, so its fingerprints are re-recorded.

Evidence

  • Tests: TestViaEgressProxy covers mixed letter cases and the schemes that need no proxy (file, ssh, httpx, xhttps, ext::). TestWorkerUpperCaseSchemeUpstreamDialsThroughProxy and TestPushRunUpperCaseSchemeUpstreamDialsThroughProxy store HTTP://127.0.0.1:<port> under the strict egress policy. They emulate a git that takes the transport: HTTP in GIT_ALLOW_PROTOCOL, and a git-remote-HTTP on PATH that is the real git-remote-http, as a case-insensitive file system would find it. Both expect repository configuration error and no request at the upstream.
  • Red on main: with main's two call sites, both lane tests fail because git dialed the upstream directly (the HTTP:// upstream was dialed around the egress proxy). Without the emulation they fail too (failed to clone repository and failed to push to upstream: git refused the transport), so only the proxy's refusal passes them. Mutants: main's prefix check inside the helper (three tests fail), and a lower-cased http prefix check (the table fails on httpx://).
  • Lanes: go test -race -tags=openstorage_viewcheck ./internal/sync/... passes at 9c7da84 (90 s). lint, vet (linux and darwin), gofmt, the docs gate and both fingerprint gates pass.

Reviews

  • Round 1 (7dbf6db): the Codex review and the Codex security review found nothing. A fresh read-only review: PASS. Under the worker's environment, git 2.55.0 refused HTTP://, HTTPS://, Https:// and hTtP:// on fetch and push with no request at the upstream, and protocol.allow settings do not override GIT_ALLOW_PROTOCOL. The three upstream dials (the fetch, the default-branch ls-remote and the push) all use the proxied environment. Its mutants (each lane alone reverted, https only, main's prefix check) all failed the tests. Left open (P3):
    • Older than this PR: git's http::<url> form passes GIT_ALLOW_PROTOCOL and skips the proxy (viaEgressProxy reads its scheme as http::http). No stored link can hold it: POST /repos has refused it since before v0.1.0, and the follow-up that checks each stored host at run time refuses it too.
    • strings.EqualFold folds Unicode, so httpſ:// also starts the proxy; git refuses that protocol, so this is harmless.
    • The lane tests emulate HTTP:// only. The review probed the HTTPS:// path (CONNECT): the emulated git used the proxy, because proxyEnv sets every proxy variable.
    • internal/sync/README.md could say that the proxy starts per http(s) transfer.

Found by the reviews of #903 (desk follow-up).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

The pull and push lanes started the egress proxy only for a URL that
began with a lower-case `http://` or `https://`. A link stored with an
upper-case scheme (`HTTPS://`, `Https://`) skipped the proxy. Today git
refuses such a link before any dial, because GIT_ALLOW_PROTOCOL compares
transport names case-sensitively ("transport 'HTTPS' not allowed"), but
the egress guard should not depend on that.

viaEgressProxy matches the scheme case-insensitively, as RFC 3986 and
curl read it, and both lanes use it. The new tests emulate a git that
takes the transport (HTTP in GIT_ALLOW_PROTOCOL, git-remote-HTTP on
PATH): on main both lanes dial the loopback upstream directly; now the
strict policy refuses it in the proxy.

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: I8b9f6c8ebc7db122c3b4a82e18a3024b11049cd3
Signed-off-by: Thomas Kosiewski <tk@coder.com>
worker.go and worker_push.go are covered code: both lanes now decide on
the egress proxy with viaEgressProxy.

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: I73f2e3e60cd0db8ed443b9ddb01710e8aedc6300
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T01:48:02.113870Z 7dbf6db Manual request
🔒 Security Review ✅ Completed 2026-11-17T01:48:37.683762Z 7dbf6db Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 7dbf6db209

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 7dbf6db209

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 0d1f65e Nov 17, 2026
16 checks passed
@ThomasK33
ThomasK33 deleted the sync-egress-scheme-case branch November 17, 2026 02:40
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
Main gained #905 (both sync lanes decide on the egress proxy with
viaEgressProxy). The only conflict is the sync commit of the
lane-schedule model; the next commit re-records it on the merged tree.

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: I5ea59ebc10ff4e97ca9afa654c28d07ddf66d87d
Signed-off-by: Thomas Kosiewski <tk@coder.com>
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
The merge brought #905's worker.go and worker_push.go fingerprints; TLC
passes on the merged tree, so the sync commit moves to it. No
fingerprint changes.

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: If8b8572d273d3071d1ccc2f0470d5881b0066b2d
Signed-off-by: Thomas Kosiewski <tk@coder.com>
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
Main gained #905 (both sync lanes decide on the egress proxy with
viaEgressProxy). The only conflict is the sync commit of the
lane-schedule model; it is re-recorded on the merged tree.

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: I592ce6e29585d166e4b341c338bb234bdc0d0255
Signed-off-by: Thomas Kosiewski <tk@coder.com>
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
With the run's host check, #905's lane tests no longer reach the egress
proxy: the run refuses an `HTTP://` host before git starts. The tests
still pass only while one of the two guards holds, so they now say so in
their names and comments. TestViaEgressProxy pins the proxy decision by
itself.

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: I9b3211586de1bf4cb092471eb629f0e63e886072
Signed-off-by: Thomas Kosiewski <tk@coder.com>
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
The merges brought #905's and #906's fingerprints; TLC passes on the
merged tree, so the sync commit moves to it. No fingerprint changes.

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: I1e93add5a92183dda736b91f90b89090e7e46ff4
Signed-off-by: Thomas Kosiewski <tk@coder.com>
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.

1 participant