Repository navigation
T92 — Ship min-answerer in every release that ships min, link-clean and signed - #1971
norrietaylor merged 10 commits into
Conversation
dist-build.sh builds the answerer in its own cargo invocation — never beside -p minvmd or through --workspace, which would unify the libkrun feature into the answerer a root host service must not carry — and runs the link gate on what it built, so a link-unclean answerer never leaves the build machine. stage-release.sh carries bin/min-answerer beside min on linux amd64, linux arm64 and darwin arm64, required like the other binaries; the staged copy is only the copy source NET-122's advisory finds and copies to a root-owned path, and no unit or plist references the user prefix. package-nfpm.sh and packaging/nfpm.yaml ship /usr/bin/min-answerer, root-owned like the other binaries; neither installs or enables the service — the advisory's one privileged step stays the only one. install.sh's component loop places the row by its generic rules; its header now names the contract, and install_test.sh asserts it: installed beside min on every platform, replaced on upgrade, recorded, no unit or plist at the user-writable path. stage-release_test.sh asserts the row and the missing-artifact refusal.
NET-122's privileged step copies this machine's min-answerer into a root-owned service path, so the advisory now verifies the source before it ever offers the step: codesign --verify --strict on macOS, where the shipped source is Developer ID signed, and the link rule the release's gate ships by on both OSes — every library resolving from a system directory, no embedded search path, the interpreter a system loader. The check runs unprivileged, in the CLI's own process, and a source that fails it is refused with the reason (AnswererStep::SourceRefused, which wraps the service state the detection read, so the fact naming what the host is missing survives). glibc ldd can execute the target's interpreter, so ldd runs there and nowhere else. The privileged step itself re-checks the copy it makes — with the static readelf/otool checks alone, never ldd — and a copy that fails is removed and named, so an unchecked program never sits in the root-owned path. Skipped for debug and test builds under the same gate as T71's channel-path override: a dev tree links user-writable libraries on purpose, and the advisory keeps offering its step there. The parses are pure over the tools' outputs, so the rule is unit-tested on every platform the suite runs on; an upgrade to an older service copy re-surfaces the advisory the way a newer one does, and its command re-copies the program. Refs: NET-122
Record what shipping min-answerer in every release that ships min takes: the build's own cargo invocation and its link gate, the stage row beside min, the package contents, and the installer row — all done by the scripts this repository owns. The workflow half stays with the code owner, because .github/workflows/ is frozen and CODEOWNER-gated: record the exact steps the release.yml patch must add (rename, sign with an empty entitlements set, verify, link-check the signed artifact, upload), and that no release can stage until it lands, since the stage now refuses without the artifact the manifest requires. That patch is the needs-human item blocking the first release that carries T71, and the privileged macOS e2e runner that answerer_survives_session_stop needs is the residual these steps do not close. Refs: NET-122
…nswerer-in-every-release-that-ships-mi
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
The advisory no longer re-runs the release's link checks on the user-side copy source. On macOS it checks the Developer ID designated requirement, built from a compile-time TEAMID and identifier; a release build without them names the step unavailable. On both OSes it pins the SHA-256 of the bytes it verified. The privileged step refuses a destination directory root does not own or others can write, installs into an exclusive mktemp name, refuses a copy whose hash differs from the pin, re-runs codesign -R on macOS, and renames into place before writing any unit. A release with no min-answerer shows a named unavailable state instead of dropping the step. The identity checker is injected so the tests drive the real wiring.
The frozen release workflow does not build or upload min-answerer yet, so stage-release.sh and package-nfpm.sh warn and omit it instead of failing the stage. Both lists are temporary (gominimal/inbox#899).
The privileged copy now walks the destination directory up to / and refuses at the first component that is not root-owned, is group- or other-writable, or is sticky, naming it. A user could otherwise rename a directory on the path between the check and the rename. Both current destinations pass on stock hosts, so they stay where they are.
… the walk A stock host has no destination dir until the first install. The root step now creates it with install -d -m 0755 -o root before the ancestor walk, which checks the new dir with the rest, instead of relying on mkdir -p and root's umask.
|
Approved: no findings at Nothing to do. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none: |
norrietaylor
left a comment
There was a problem hiding this comment.
T92 is reworked per the design ruling: Developer ID requirement, a hash-pinned root copy, an ancestor custody walk that creates a missing destination root-owned, and the artifact optional until release.yml ships it (inbox#899). ARCH passed it, CI is green on every lane, and minimal-review found nothing. The release.yml patch in the body is the code-owner item, and it blocks only the first release that offers the service step.
…very platform (gominimal#2002) * ci(release): ship min-answerer signed for every platform The build, staging, packaging and install scripts already handle min-answerer (gominimal#1971), but the release workflow never built, signed or uploaded it, so stage-release.sh and package-nfpm.sh skipped it with a warning. Linux: rename the min-answerer artifacts dist-build.sh already builds, re-run scripts/check-answerer-links.sh on the renamed files and upload them as min-answerer-linux-{amd64,arm64}. macOS: build min-answerer in its own -p min-answerer invocation, link-gate it, rename it, Developer-ID sign it (hardened runtime, timestamp, no entitlements, identifier dev.minimal.min-answerer), verify it against the designated requirement min checks, re-run the link gate on the signed bytes and upload it as min-answerer-macos-arm64. Pass MINIMAL_ANSWERER_TEAMID and MINIMAL_ANSWERER_IDENTIFIER as job env to the macOS build so the min it builds carries that identity. * docs(release): describe min-answerer as built, signed and uploaded by the workflow The release workflow now builds, link-gates, signs and uploads min-answerer, so the pipeline doc no longer calls it a pending code-owner patch or a gap. * refactor: rename min-answerer to minzoned The host box-zone service binary becomes minzoned, matching minimald and minvmd. It holds the box zone: the box names and the addresses behind them, so a dns name would be too narrow once address arbitration lands. The name stays narrow on purpose: a privileged, config-less service should not invite more functions. - crate, package and binary: crates/minzoned, minzoned - launchd label dev.gominimal.zone, systemd units minzoned.socket and minzoned.service - root-owned copies /Library/PrivilegedHelperTools/minzoned and /usr/local/lib/minimal/minzoned - codesign identifier dev.minimal.minzoned; compile-time env MINIMAL_ZONED_TEAMID and MINIMAL_ZONED_IDENTIFIER - release artifacts minzoned-{linux-amd64,linux-arm64,macos-arm64} - scripts/check-zoned-links.sh (and its test), just zoned-build and zoned-link-check - advisory lead-in: install the Minimal box-name service (DNS and addresses for boxes) * ci(release): build, sign and ship the box-name service as minzoned Follows the rename of min-answerer to minzoned: the artifact names, the link check script, the cargo package and binary, the signing identifier dev.minimal.minzoned and the MINIMAL_ZONED_* build env that min compiles in. * test(e2e): match the renamed box-name service in the session e2e The advisory command now installs minzoned, so the e2e's answerer-step matches look for minzoned instead of the old zone-answerer label. The install test's root-owned-path guard names the new program and plist paths. Daemon log greps keep the zone-answerer component name. * ci(release): notarize the shipped macOS binaries (gominimal#2003) After signing, build-release-macos-arm64 now submits min, minvmd and min-answerer to the Apple notary service with `xcrun notarytool submit --wait`, each in a ditto zip used only for the submission. The release fails unless every result is Accepted, and the step prints the notary log of a rejected submission. The release ships bare Mach-O files, which stapler cannot staple, so Gatekeeper looks the ticket up online. Credentials come from a notarytool keychain profile in the signing keychain, named by the MACOS_NOTARY_PROFILE repository variable. The job timeout rises from 45 to 60 minutes to cover the notary waits. Document the step and its runner prerequisites in release-pipeline.md. * test(minzoned): prove the macOS service install on a hosted runner (gominimal#2011) * test(minzoned): prove the macOS service install on a hosted runner The self-hosted Mac fleet runs PR code without sudo, so the minzoned LaunchDaemon path had no CI proof. A new zoned job on macos-latest runs the privileged install command min prints, then checks custody, the system resolver, the channel (a script stands in for the node), the uid gate, a restart, a re-run and a clean teardown. A hidden debug-only verb, min debug-answerer-command, prints the command without a session. * test(minzoned): wait for the range job to apply every alias * fix(scripts): spell the zoned restart check as an if so shellcheck passes * docs(scripts): say release.yml now ships minzoned in the optional-artifact notes
T92 — Ship min-answerer in every release that ships min, link-clean and signed
slice: S9
kind: task
covers: NET-122
size: M
est: 140 code, 160 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the release staging log names the min-answerer artifact per platform beside min and minvmd; dist-build prints the link check's verdict on what it built; the advisory names the reason when it refuses an unsigned or link-unclean source
observability: one line per staged min-answerer artifact; the advisory's refusal line when the copy source fails its signature or link check
layers:
- release:
- scripts/dist-build.sh: builds the
min-answererbin for the target only in its own separate invocation (-p min-answerer, never through--workspaceor beside-p minvmd, which would unify minvmd's libkrun feature back in), from the crate T71 created (no libkrun, no KVM backend), lists it in the built-binaries line, and runs scripts/check-answerer-links.sh on what it built- scripts/stage-release.sh: stages
min-answererper platform (linux amd64, linux arm64, darwin arm64) asbin/min-answerer, besidemin, where the advisory'sanswerer_sourcelooks, required like the other binaries, with no lib/ component on any platform; the staged binary is the source the advisory copies into a root-owned path, and no service unit or plist references it- scripts/package-nfpm.sh: carries
min-answererin the deb and rpm besidemin, root-owned in /usr/bin; neither package installs or enables the answerer service, so the advisory stays the one privileged step- scripts/install.sh: installs
min-answererbesideminon every platform it installsmin, and replaces it on upgrade like the other binaries; the installed copy is only the advisory's copy source, and no unit or plist the installer writes names the user-prefix pathtest: bash scripts/stage-release_test.sh
test: bash scripts/install_test.sh
- cli:
- crates/minimal/src/resolver.rs: before copying, the advisory verifies the
min-answerersource withcodesign --verify --stricton macOS and the link rule on both OSes, run unprivileged before the privileged step (glibclddcan execute the target's interpreter, solddnever runs as root), and after the copy re-checks the root-owned copy with the staticreadelf/otoolchecks only; it refuses with the reason when any check fails, skipped only for debug and test builds under the same gate as T71's channel-path override; an upgrade that changes the answerer protocol re-surfaces the advisory through T71's protocol comparison, so an old root copy never runs silently against a new channeltest: cargo nextest run -p minimal advisory_refuses_an_unsigned_or_link_unclean_source
test: cargo nextest run -p minimal advisory_resurfaces_when_service_binary_is_older
- handoff:
- docs/internal/release-pipeline.md: records the min-answerer release steps, and because .github/workflows/release.yml is frozen the PR body carries a patch to it for the code owner that, mirroring minvmd's steps, renames, signs (Developer ID Application,
--options runtime, an empty entitlements set: no hypervisor, no disable-library-validation, no allow-dyld-environment-variables, no JIT), notarizes and uploadsmin-answerer-macos-arm64, uploads the Linuxmin-answererartifacts, adds each to the checksums and the manifest like the other binaries, and runs scripts/check-answerer-links.sh again on every signed and renamed artifact before upload, so the shipped bytes are the checked bytes; the PR body names the patch as the needs-human item that blocks the first release carrying T71, and names the privileged macOS e2e runner for answerer_survives_session_stop as the residual it does not closeproduces: none
consumes:
- crates/minvmd/src/bin/min-answerer.rs
- crates/minimal/src/resolver.rs
- scripts/check-answerer-links.sh
proof: A dist build of every shipped platform produces a link-clean min-answerer beside min, staged and packaged where the advisory finds it, installed and upgraded by the shell installer and the packages, and never referenced by a unit or plist at its user-writable path; the advisory refuses an unsigned or link-unclean source with the reason; an upgrade that changes the answerer protocol re-surfaces the advisory and never runs an old root copy silently against a new channel; the release workflow change that signs, notarizes, checks again and uploads it is handed to the code owner as a patch.
depends on:
- blocked by #1803
- blocked by #1947
Proof
A dist build of every shipped platform produces a link-clean min-answerer beside min, staged and packaged where the advisory finds it, installed and upgraded by the shell installer and the packages, and never referenced by a unit or plist at its user-writable path; the advisory refuses an unsigned or link-unclean source with the reason; an upgrade that changes the answerer protocol re-surfaces the advisory and never runs an old root copy silently against a new channel; the release workflow change that signs, notarizes, checks again and uploads it is handed to the code owner as a patch.
Amended scope
This PR follows the architecture ruling on the answerer's identity model (design §7.1, post-install custody). The source sits beside
minin a prefix its user can write, so every user-side check is only a pre-check. The checks that count run in the rendered root step, on the root-owned copy.The block's line "the link rule on both OSes" (and its "re-checks the root-owned copy with the static
readelf/otoolchecks") is amended:scripts/check-answerer-links.sh(T91, T91 — Check that min-answerer links only system libraries #1954), inscripts/dist-build.shand again on every signed and renamed artifact in the release.yml patch below. The user-sideotool/readelf/lddchecks, the post-copy re-checks, and their parsers are removed.codesign --verify --strict -R '=<requirement>'against the Developer ID designated requirementanchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "<TEAMID>" and identifier "<identifier>". TEAMID and identifier are compile-time consts (option_env!("MINIMAL_ANSWERER_TEAMID"),option_env!("MINIMAL_ANSWERER_IDENTIFIER")). A macOS release build without them offers no step and says "this build carries no signing identity"; there is no fallback to--strictalone. Debug and test builds skip the check under T71'sdebug_path_overridegate (any(test, debug_assertions)). On both OSes the advisory pins the SHA-256 of the bytes it verified./, refusing at (and naming) the first component that is not root-owned, is group- or other-writable, or is sticky; then it runsinstall -m 0755 -o root -g <wheel|root>to an exclusivemktempname in that dir, hashes the temp copy (shasum -a 256/sha256sum), removes it and exits non-zero naming both hashes on a mismatch, re-runscodesign --verify --strict -Ron macOS, renames it into place atomically, and only then writes and loads the unit or plist. Nothing before the rename touches the running service.stage-release.shandpackage-nfpm.shwarn and omit a missingmin-answerer. A release without it shows the named state "this release ships no min-answerer; the answerer service step is unavailable", never a silently dropped step.package-nfpm.shis included because a requiredmin-answererthere would break the next versioned release before the workflow patch lands.Needs a code owner
The only needs-human item is the
.github/workflows/release.ymlpatch below (the workflow is frozen). It blocks the first release that offers the answerer service step. It:scripts/check-answerer-links.shon, and uploadsmin-answerer-linux-{amd64,arm64}(dist-build already builds and link-gates it in its own-p min-answererinvocation);min-answererin its own-p min-answererinvocation and link-gates it, renames it, signs it with the Developer ID (--options runtime,--timestamp, empty entitlements,--identifier dev.minimal.min-answerer), verifies it against the exact designated requirementminchecks, re-runs the link gate on the signed and renamed bytes, and uploads it;MINIMAL_ANSWERER_TEAMID=3G47C5HY64andMINIMAL_ANSWERER_IDENTIFIER=dev.minimal.min-answereras job env to the macOS build, so theminit builds carries the signing identity.Checksums and the manifest need no workflow change: the release and stage-installer jobs gather artifacts by their platform-suffixed names, and
stage-release.sh'sCOMPONENTStable hashesmin-answerer-*into thecomponentsmanifest.The patch does not notarize: notarizing every shipped macOS binary is follow-up gominimal/inbox#900. After the patch lands, empty
OPTIONAL_COMPONENTS/OPTIONAL_ARTIFACTS(gominimal/inbox#899).release.yml patch (applies with
git applyon this branch)Residuals
/usr/bin, which closes that residual on packaged hosts.min-answereris temporary (gominimal/inbox#899).answerer_survives_session_stopremains open.min-answererincluded: gominimal/inbox#900./usr/localor/usr/local/libwas handed to a user (a Homebrew-stylechown) is refused by the ancestor walk, naming the directory; both destinations' chains pass on stock macOS and Linux.Verification
just fix,just clippy: clean (macOS scope).just test(macOS scope):970 tests run: 970 passed (1 leaky), 11 skipped.cross clippy -p minimal --lib --tests --target aarch64-unknown-linux-musl --locked -- -D warnings: clean.cross test -p minimal --lib --target aarch64-unknown-linux-musl --locked -- resolver:::test result: FAILED. 51 passed; 3 failed, the three being the knownsh_parsesbaseline (the container's/bin/sh -nruns the command:sudo: not found). Withsh_parsespointed at/bin/bashfor a local run (not committed):test result: ok. 54 passed; 0 failed.advisory_refuses_an_unsigned_or_link_unclean_source(realanswerer_step_with_sourcewiring, injected identity checker: refused with reason on fail; rendered command carries the pinned SHA-256 on pass),advisory_names_an_unavailable_answerer_step,privileged_copy_refuses_a_source_swapped_after_render,privileged_copy_refuses_a_user_writable_ancestor(0777, 0775, 0757 and sticky 01755 on an ancestor: refused naming it, nothing copied),privileged_copy_refuses_a_user_owned_destination(realfindover a user-owned temp tree,installstubbed), andadvisory_resurfaces_when_service_binary_is_older.installstubbed andfinddelegating to/usr/bin/find: the checked bytes install; a swapped source is refused naming both hashes; a writable or sticky ancestor and a user-owned destination are refused naming the directory. The unstubbed walk passes on/Library/PrivilegedHelperToolson this Mac, and on/usr/local/lib/minimalin a stockubuntu:24.04container.cargo check --release -p minimalon macOS, with and without the two env vars: no warnings from this change (three pre-existing dead-code warnings onmainremain:ZONE_LINK,ZONE_LINK_ADDR,service_exec_start).bash scripts/stage-release_test.sh:65 passed, 0 failed.bash scripts/install_test.sh:508 passed, 0 failed.just lint-shell: 50 scripts pass.just lint-prose docs/internal/release-pipeline.md: 0 errors, 0 warnings.git apply --checkpasses on this branch, it parses as YAML, andactionlintreports only the pre-existingubuntu-26.04-armrunner-label note.Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Out of scope
These files are outside the task's
layers::packaging/nfpm.yaml: it carries the/usr/bin/min-answererentry, inside markers thatscripts/package-nfpm.shstrips while the artifact is optional.Closes #1948