Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions PATCHES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Fork patches

`github.com/roachadam/utls` is [refraction-networking/utls](https://github.com/refraction-networking/utls) `master` plus the commits below, one patch per commit, each with a test that fails without it. The sync job drops a patch automatically if upstream ever makes the same change.

| Commit subject | Source | Reason |
|---|---|---|
| Change module path to github.com/roachadam/utls | fork | Dependents ignore `replace`, so the fork needs its own module path. Generated by `.fork/rename-module.sh`. |
| Keep a private key for every offered classical key share | bogdanfinn/utls `7de494d` | Only the first classical key was kept; a server picking another offered group (Firefox's P-256) failed the handshake. |
| Insert the HelloRetryRequest cookie among the permutable extensions | sardanioss/utls `356f21e` (HRR part) | The cookie could land before the leading GREASE, which no browser does; always did on short lists. |
| Keep GREASE signature algorithms out of the handshake state | sardanioss/utls `d737ca1` (`writeToUConn` part) | Go's handshake checks treated the GREASE codepoint as an offered algorithm. |
| Match QUICConn's NextEvent and Close in UQUICConn | MetaCubeX/utls `8853e10` | `Close` hung while the handshake waited for data; failed handshakes produced no `QUICErrorEvent`. |
| Send the QUIC stack's transport parameters with a preset | sardanioss/utls `5d6b871`, `44b5ea7` | Presets sent the spec's parameters instead of the QUIC stack's; extension 57 could not be parsed from a capture. |
| Remove the Go build workflow | fork | Upstream's workflow built and tested on every push and pull request. A tag-triggered pipeline will replace it. |

## Syncing with upstream

`.github/workflows/sync-upstream.yml` runs weekly and on demand. `.fork/sync-upstream.sh` regenerates the rename on the newest upstream `master`, cherry-picks the other fork commits, drops those upstream already contains, and ends with a merge commit that has the current `main` and the rebuilt stack as parents. After `go vet` and `go test -race` pass, the job pushes `sync/upstream` and opens a pull request. Nothing reaches `main` until you merge it.

- Review the upstream compare link and any `go.mod` changes listed in the pull request; that diff is upstream code we have not seen before.
- Merge with **Create a merge commit**. The next sync finds the stack through the `Upstream-Sync:` trailer of that merge; squash or rebase merges lose it.
- While a sync pull request is open, the job leaves it alone. Merge or close it to get a newer sync.
- Keep fork changes in ordinary commits. The sync rebuilds `main` from its non-merge commits, so a change that exists only in a merge commit, such as a conflict resolved in GitHub's editor, is dropped.
- A cherry-pick conflict fails the job and names the patch. In a clean working tree, `git fetch upstream` and run `.fork/sync-upstream.sh origin/main upstream/master`; it stops at the same conflict. Resolve it, stage the files, run `.fork/sync-upstream.sh --continue`, test, push `sync/upstream`, and open the pull request.
- When a patch is dropped, the pull request lists it; remove its row here.
- If upstream changes a file under `.github/workflows/`, the job's token cannot push it and publishing fails. Run the sync locally and push it yourself.

Safeguards:

- Upstream code runs only in the build job, which has a read-only token, no stored credentials and no cache. The publish job, which can write, never runs it.
- The build job hashes the bundled branch before any upstream code runs; the publish job refuses a bundle with a different hash, and checks that its tip is a sync merge on top of the current `main`.
- The search for the last sync merge ignores upstream history, so an upstream commit with an `Upstream-Sync:` trailer cannot pose as one.
- A ruleset on `main` blocks direct pushes, force-pushes and deletion, and requires a pull request. Nobody can bypass it.
- Actions are pinned to commit SHAs.
- The job only opens pull requests if Settings → Actions → General → "Allow GitHub Actions to create and approve pull requests" is on. If it is off, the job still pushes `sync/upstream` and logs a link to open the pull request by hand.