Repository navigation
fix: require zig mirrors to be both live upstream and reviewed #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+182
−22
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Keeping `zig-mirrors.txt` in sync | ||
|
|
||
| `zig-mirrors.txt` is the reviewed set of Zig community mirrors trusted as a build-job egress target for zigbuild legs. `release-rust.yml` only allows a mirror through if it's *both* in this file *and* currently live upstream (see [issue #31](https://github.com/purpleclay/release-workflows/issues/31) for why it isn't just fetched from upstream directly). | ||
|
|
||
| This is a deliberately manual process — a bot opening a routine PR risks training reviewers to rubber-stamp it, which defeats the point of requiring review at all. Automating this is tracked as a possible future issue if the manual upkeep ever becomes a real burden; it isn't expected to. | ||
|
|
||
| ## When to check | ||
|
|
||
| There's no fixed schedule. Worth checking when: | ||
|
|
||
| - A zigbuild release fails with "no zig mirrors are both live upstream and reviewed" (`compose_build_matrix`'s hard-failure path) — this means the two lists have diverged enough to share nothing at all, and needs attention immediately. | ||
| - Roughly every few months, or whenever you're touching this workflow for another reason anyway. | ||
|
|
||
| ## How to check | ||
|
|
||
| ```bash | ||
| diff <(curl -fsSL https://ziglang.org/download/community-mirrors.txt | sort) \ | ||
| <(sort .github/zig-mirrors.txt) | ||
| ``` | ||
|
|
||
| Lines prefixed `<` are new upstream entries — this is the part that needs actual scrutiny, not a rubber stamp. Lines prefixed `>` are in the committed file but no longer live upstream — safe to drop, no review needed, they can't be reached anyway. | ||
|
|
||
| ## Reviewing a new entry | ||
|
|
||
| For each newly-added host, actually verify it before adding it — don't just accept it because it's on the official list. At minimum: | ||
|
|
||
| 1. Use the mirror's exact base URL as listed upstream, including its path — the path is part of what's being trusted, not incidental, and `release-rust.yml` compares the full URL when deciding what to approve (see #31). Most reviewed mirrors serve the archive flat, at `<base>/<file>` — unlike `ziglang.org/download` itself, which nests it under `<base>/<version>/<file>`; try the flat form first (only a minority of mirrors need the version segment). Download the archive *and* its `.minisig` sibling, then verify against the [Zig Software Foundation's public key](https://ziglang.org/download/) — a `200` response alone proves nothing, since a malicious mirror could serve any tarball it likes: | ||
|
|
||
| ```sh | ||
| archive=zig-x86_64-linux-<version>.tar.xz | ||
| curl -fsSL "https://<mirror-base-url>/$archive" -o "$archive" | ||
| curl -fsSL "https://<mirror-base-url>/$archive.minisig" -o "$archive.minisig" | ||
| minisign -Vm "$archive" -P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U | ||
| ``` | ||
|
|
||
| `minisign` only checks that the signature matches the downloaded bytes — it does not check that the signed file is the one you actually asked for. A mirror could substitute the signature and archive for a *different*, still-genuinely-signed release. Verify that manually: the command above prints a `Trusted comment` line containing a `file:` field — confirm it reads exactly `file:zig-x86_64-linux-<version>.tar.xz`, matching the archive name you requested. | ||
|
|
||
| 2. Check who operates it, if that's discoverable (project README, DNS WHOIS, whether it's referenced elsewhere in the Zig community). Prefer mirrors run by identifiable people/organizations over anonymous ones. | ||
|
|
||
| Then update `.github/zig-mirrors.txt` to match upstream, **and** add the new host to the `plan` job's `harden_runner` `allowed-endpoints` in `release-rust.yml` — `compose_build_matrix` probes reviewed mirrors for liveness before pinning one, and that probe can't reach a host harden-runner hasn't been told about. Commit both together as a normal PR, reviewed the same as any other change to this workflow. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| https://fs.liujiacai.net/zigbuilds | ||
| https://pkg.earth/zig | ||
| https://pkg.hexops.org/zig | ||
| https://zig-mirror.tsimnet.eu/zig | ||
| https://zig.bcr.ist | ||
| https://zig.chainsafe.dev | ||
| https://zig.karearl.com/zig | ||
| https://zig.linus.dev/zig | ||
| https://zig.mirror.mschae23.de/zig | ||
| https://zig.savalione.com | ||
| https://zig.squirl.dev | ||
| https://zig.tilok.dev | ||
| https://zig.vortan.dev/zig | ||
| https://ziglang.freetls.fastly.net | ||
| https://zigmirror.com | ||
| https://zigmirror.hryx.net/zig |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| rules: | ||
| superfluous-actions: | ||
| ignore: | ||
| # release-rust.yml:169 — dtolnay/rust-toolchain: explicit toolchain + | ||
| # release-rust.yml:250 — dtolnay/rust-toolchain: explicit toolchain + | ||
| # cross-target install; hand-rolling rustup here would just reimplement | ||
| # this action with less auditability. | ||
| - release-rust.yml:169 | ||
| - release-rust.yml:250 | ||
| stale-action-refs: | ||
| ignore: | ||
| # release-rust.yml:169 — dtolnay/rust-toolchain intentionally ships no | ||
| # release-rust.yml:250 — dtolnay/rust-toolchain intentionally ships no | ||
| # tags: master/stable/beta/nightly are branch aliases by design, so | ||
| # this pin is the tip of "master", not a stale reference. | ||
| - release-rust.yml:169 | ||
| - release-rust.yml:250 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ | |
| buildInputs = | ||
| [ | ||
| alejandra | ||
| minisign | ||
| nil | ||
| typos | ||
| zizmor | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [files] | ||
| # A list of third-party hostnames, not prose — spellcheck will keep | ||
| # producing false positives here as mirrors are added/removed over time | ||
| # (e.g. "zig.bcr.ist", "zig.squirl.dev" are real domains, not typos). | ||
| extend-exclude = [".github/zig-mirrors.txt"] | ||
|
|
||
| [default.extend-words] | ||
| # The same mirror hostnames also appear in release-rust.yml's harden_runner | ||
| # allowed-endpoints (can't be excluded like zig-mirrors.txt above, since | ||
| # that's a real code file). Keep in sync with zig-mirrors.txt. | ||
| ist = "ist" | ||
| squirl = "squirl" |
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.
Uh oh!
There was an error while loading. Please reload this page.