Skip to content

fix: require zig mirrors to be both live upstream and reviewed - #33

Merged
purpleclay merged 1 commit into
mainfrom
31-manage-zig-mirror-list
Aug 1, 2026
Merged

fix: require zig mirrors to be both live upstream and reviewed#33
purpleclay merged 1 commit into
mainfrom
31-manage-zig-mirror-list

Conversation

@purpleclay

@purpleclay purpleclay commented Aug 1, 2026

Copy link
Copy Markdown
Owner

closes #31

Summary by CodeRabbit

  • Security

    • Release builds now use only verified, currently supported, and explicitly approved Zig package mirrors.
    • Releases stop early when no approved mirror can provide the required package, improving supply-chain protection and reliability.
  • Documentation

    • Added guidance for reviewing, comparing, and safely updating approved mirrors.
    • Documented the 16 approved Zig package mirrors.
  • Maintenance

    • Updated configuration for mirror validation and automated checks.
    • Added tooling for validating signed Zig downloads.
    • Improved spelling-check support for third-party mirror hostnames.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The release workflow checks out a reviewed Zig mirror list at the workflow commit, intersects it with live upstream mirrors, probes approved candidates, and passes the selected mirror to build jobs. The repository adds mirror entries, maintenance documentation, and supporting configuration.

Changes

Zig mirror selection

Layer / File(s) Summary
Reviewed mirror list and validation policy
.github/zig-mirrors.txt, .github/zig-mirrors.md, .gitignore, typos.toml, flake.nix
The repository adds 16 mirror endpoints, documents synchronization and validation, preserves the files through ignore rules, excludes hostnames from spellchecking, and adds minisign to the development shell.
Pinned allowlist intersection
.github/workflows/release-rust.yml, .github/zizmor.yml
The workflow checks out the reviewed list at github.workflow_sha, intersects it with live upstream mirrors, fails when the intersection is empty, and updates zizmor references for the changed workflow lines.
Mirror probing and build wiring
.github/workflows/release-rust.yml
The plan job probes approved mirrors for the required tarball, selects a responsive mirror, restricts egress to its host, and passes the mirror to the build matrix and setup-zig.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PlanJob
  participant ReviewedMirrorList
  participant ZigUpstream
  participant BuildMatrix
  participant setup-zig
  PlanJob->>ReviewedMirrorList: Checkout reviewed mirror list at github.workflow_sha
  PlanJob->>ZigUpstream: Read live community mirror list
  PlanJob->>PlanJob: Intersect lists and probe the Zig tarball
  PlanJob->>BuildMatrix: Pass selected mirror and egress host
  BuildMatrix->>setup-zig: Configure the selected mirror
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: requiring Zig mirrors to be both upstream-listed and repository-reviewed.
Linked Issues check ✅ Passed The changes commit a reviewed list, enforce its intersection with upstream mirrors, and document a process to prevent staleness.
Out of Scope Changes check ✅ Passed The workflow, documentation, configuration, and development-shell changes directly support the reviewed Zig mirror allowlist objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 31-manage-zig-mirror-list

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-rust.yml:
- Around line 119-137: Verify this workflow change through an actual zigbuild
release run: confirm the checked-out .github/zig-mirrors.txt comes from the
called workflow commit, the generated matrix contains only the intersection of
live and reviewed mirrors, and the selected mirror is accepted by harden_runner.
Record or otherwise validate these acceptance checks without changing the
intersection logic around live_mirrors, reviewed_mirrors, and zig_mirrors.
- Around line 78-90: The checkout_release_workflows step currently uses caller
workflow identity, which can reference a commit absent from
purpleclay/release-workflows. Update its ref expression to use job.workflow_sha
and set the repository from job.workflow_repository, preserving the existing
pinned checkout and sparse-checkout behavior.

In @.github/zig-mirrors.md:
- Around line 27-30: Add blank lines immediately before and after the indented
shell code fence in the numbered list item, preserving the existing curl command
and surrounding Markdown content.
- Around line 16-21: Correct the marker descriptions in the documentation
surrounding the diff command: `<` denotes lines present only in the live
upstream input, while `>` denotes lines present only in the committed
`.github/zig-mirrors.txt` input. Keep the command and review guidance unchanged.
- Around line 16-19: Update the shell code block containing the
process-substitution diff command to explicitly use a Bash fence, since the
syntax requires Bash rather than POSIX sh.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cb52903b-a8b2-4c23-b34e-ed01657d727f

📥 Commits

Reviewing files that changed from the base of the PR and between 9ffaad0 and e726c1a.

📒 Files selected for processing (6)
  • .github/workflows/release-rust.yml
  • .github/zig-mirrors.md
  • .github/zig-mirrors.txt
  • .github/zizmor.yml
  • .gitignore
  • typos.toml

Comment thread .github/workflows/release-rust.yml
Comment thread .github/workflows/release-rust.yml Outdated
Comment thread .github/zig-mirrors.md Outdated
Comment thread .github/zig-mirrors.md Outdated
Comment thread .github/zig-mirrors.md Outdated
@purpleclay
purpleclay force-pushed the 31-manage-zig-mirror-list branch from e726c1a to 4fe364f Compare August 1, 2026 06:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-rust.yml:
- Around line 130-133: Preserve full normalized mirror base URLs during
approval: update the mirror intersection in .github/workflows/release-rust.yml
lines 130-133 to compare URLs including paths, then derive each approved URL’s
host:443 for zig_mirrors. Update .github/zig-mirrors.md lines 25-31 to use the
exact approved base URL, append the archive name, and download and validate that
resulting tarball.
- Around line 88-89: Preserve the documented self-checkout expressions using
job.workflow_repository and job.workflow_sha in the checkout configuration. Do
not replace them with github.workflow_sha; if validation requires actionlint
compatibility, update its schema or add a narrowly scoped suppression instead.
- Around line 78-90: Update the plan job permissions to grant contents: read so
checkout_release_workflows can fetch job.workflow_repository at
job.workflow_sha, and require each caller job invoking this reusable workflow to
grant the same permission. Preserve persist-credentials: false in the checkout
configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6cd59a9b-83a7-4bf0-aa9b-17bc00929397

📥 Commits

Reviewing files that changed from the base of the PR and between e726c1a and 4fe364f.

📒 Files selected for processing (6)
  • .github/workflows/release-rust.yml
  • .github/zig-mirrors.md
  • .github/zig-mirrors.txt
  • .github/zizmor.yml
  • .gitignore
  • typos.toml

Comment thread .github/workflows/release-rust.yml
Comment thread .github/workflows/release-rust.yml
Comment thread .github/workflows/release-rust.yml Outdated
@purpleclay
purpleclay force-pushed the 31-manage-zig-mirror-list branch from 4fe364f to e6a4f96 Compare August 1, 2026 08:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-rust.yml:
- Around line 134-145: Update the mirror-selection flow around approved_mirrors
and the setup_zig matrix so it selects a reviewed full mirror URL, includes that
URL in each matrix entry, and passes it through setup-zig’s with.mirror input.
Derive the network allowlist host from the selected reviewed URL rather than
allowing every path on all reviewed hosts, while preserving the existing
live-and-reviewed filtering.

In @.github/zig-mirrors.md:
- Around line 27-32: Extend the mirror verification procedure after downloading
the tarball to fetch its matching .minisig file, verify the archive using the
ZSF public key, and independently confirm that the signature’s trusted file
field exactly matches the requested archive filename. Do not rely on minisign
alone for the filename check, and keep validation against the downloaded tarball
rather than a HEAD response.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c4539015-157d-4bcc-af43-1266c3595059

📥 Commits

Reviewing files that changed from the base of the PR and between 4fe364f and e6a4f96.

📒 Files selected for processing (6)
  • .github/workflows/release-rust.yml
  • .github/zig-mirrors.md
  • .github/zig-mirrors.txt
  • .github/zizmor.yml
  • .gitignore
  • typos.toml

Comment thread .github/workflows/release-rust.yml Outdated
Comment thread .github/zig-mirrors.md Outdated
@purpleclay
purpleclay force-pushed the 31-manage-zig-mirror-list branch from e6a4f96 to 9b54c3d Compare August 1, 2026 12:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-rust.yml:
- Around line 75-76: Update the plan job’s mirror-probing flow around the
candidate loop and harden_runner setup: resolve and validate approved mirror
endpoints before applying the probe policy, or move probing into a separate job
with only approved candidate hosts allowed. Preserve the build-job restriction
to ${zig_mirror_host}:443 and ensure zig_mirror is populated when a permitted
mirror is available.

In @.github/zizmor.yml:
- Around line 4-13: Update both ignore entries in the zizmor configuration to
reference release-rust.yml:227 instead of release-rust.yml:203, including their
explanatory comments, so they match the dtolnay/rust-toolchain usage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 67ae06f6-303d-4fee-801d-633026c11c5c

📥 Commits

Reviewing files that changed from the base of the PR and between e6a4f96 and 9b54c3d.

📒 Files selected for processing (7)
  • .github/workflows/release-rust.yml
  • .github/zig-mirrors.md
  • .github/zig-mirrors.txt
  • .github/zizmor.yml
  • .gitignore
  • flake.nix
  • typos.toml

Comment thread .github/workflows/release-rust.yml
Comment thread .github/zizmor.yml Outdated
@purpleclay
purpleclay force-pushed the 31-manage-zig-mirror-list branch from 9b54c3d to e879229 Compare August 1, 2026 12:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-rust.yml:
- Around line 176-180: Update the liveness probe in the mirror-selection loop
around zig_tarball and zig_mirror to request each candidate using the approved
URL structure, inserting ZIG_VERSION between the candidate base URL and
zig_tarball. Preserve the existing curl options and mirror-selection behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4d221858-b3f4-4dc8-b6b3-450ad9777742

📥 Commits

Reviewing files that changed from the base of the PR and between 9b54c3d and e879229.

📒 Files selected for processing (7)
  • .github/workflows/release-rust.yml
  • .github/zig-mirrors.md
  • .github/zig-mirrors.txt
  • .github/zizmor.yml
  • .gitignore
  • flake.nix
  • typos.toml

Comment thread .github/workflows/release-rust.yml
Closes #31

`compose_build_matrix` previously allowlisted every host
`community-mirrors.txt` currently listed, straight from a live fetch at
build time — mutable, externally-maintained content with zero review on
our side. A compromised or maliciously-edited upstream entry would have
been automatically trusted as a build-script egress target.

Now takes the intersection of that live list with a reviewed,
repository-owned .github/zig-mirrors.txt: a mirror disappearing upstream
drops out with no PR needed; a new one only becomes trusted once someone
reviews and commits it here.

Signed-off-by: purpleclay <purpleclaygh@gmail.com>
@purpleclay
purpleclay force-pushed the 31-manage-zig-mirror-list branch from e879229 to 65b4781 Compare August 1, 2026 13:58
@purpleclay
purpleclay merged commit aea67c3 into main Aug 1, 2026
4 checks passed
@purpleclay
purpleclay deleted the 31-manage-zig-mirror-list branch August 1, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zig mirror allowlist is derived from mutable, unreviewed remote content

1 participant