Skip to content

feat(packaging): signed apt and yum repositories on Pages (#138) - #442

Merged
scttfrdmn merged 5 commits into
mainfrom
feat/apt-yum-repo-on-pages
Aug 14, 2026
Merged

scttfrdmn merged 5 commits into
mainfrom
feat/apt-yum-repo-on-pages

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes the second half of #138 part (c). apt install objectfs and dnf install objectfs work, which is what makes apt upgrade reach ObjectFS at all.

Two one-liners add the repositories; pages.yml builds and signs both from the release assets on every deploy. GitHub Pages hosts them — ~33 MB of packages per release against a 1 GB site cap, so a five-release retention bound is ~165 MB.

The two scripts do not offer the same guarantee

setup-repo-debian.sh writes a deb822 entry with Signed-By:, which authorizes the key for this repository and no other. A key in /etc/apt/trusted.gpg.d — where apt-key add, which #138's text specifies, puts it — is a valid signer for every repository the machine reads, Debian's own openssh-server included.

rpm has no equivalent. rpm --import adds to a single system-wide keyring, gpgkey= in a .repo file creates no per-repository one, so trusting this repository on a RHEL-family machine means trusting the key for everything. setup-repo-rhel.sh prints that before importing anything.

Both fail closed: an index that does not verify is refused with no flag to proceed, and with no signing key at deploy time no repository is published rather than an unsigned one — an unsigned repository would fail at a user's apt update instead of in CI.

Four defects found by installing from a real repository in a container

None was reachable any other way.

  • nfpm builds unsigned rpms. The first rockylinux:9 run downloaded the package and failed with Error: GPG check FAILED. The deb had no such problem, and that is why only the rpm needs a signature block: apt's InRelease signature covers the Packages indexes, which carry each .deb's checksum, so one signature at the top transitively covers the packages. rpm has no such chain.
  • rpm -K exits 0 for an unsigned package. Unsigned prints digests OK and returns 0; signed prints digests signatures OK and also returns 0. A status-only check passes for every unsigned package while reporting it verified a signature, so the assertion matches the text.
  • zypper does not read /etc/yum.repos.d. A yum-only script succeeds on openSUSE and configures nothing — every step green, .repo file present, package not found.
  • reprepro keeps one version per suite. Indexing five releases would have published one: a retention bound of five shipping as a bound of one.

Five documented one-liners were a 404

The scripts were committed, reviewed and tested in three containers while pages.yml copied only install.sh. Same defect install.sh spent a year in, and worse — these pipe into sudo bash. Both are now copied, byte-compared and in the paths filter: a stale installer installs an old binary, a stale setup script installs an old signing key, and that key stays trusted after a later correct run.

Verification

internal/config/served_repositories_test.go gates it, and 25 mutations each fail the intended test. Two found weaknesses in the gates rather than the code:

  • an exit 1 assertion satisfied by an unrelated exit 1 elsewhere in the same step, so deleting the fail-closed guard still passed;
  • two existing gates matching one literal shell spelling (cp scripts/install.sh _site/install.sh, run: make package-linux) that broke when the steps became a loop and a block scalar — property intact, spelling changed. Both now check the property.

New repo-install CI job builds the repositories from pages.yml's own extracted steps, so the two copies cannot drift, then installs on ubuntu:24.04, rockylinux:9 and opensuse/leap:15.6 and asserts a tampered index is refused on each. Run locally in podman against all three images before pushing.

Every refusal assertion has an untampered control, because the first two versions reported a pass for a check that had not run: apt reused cached lists and re-verified nothing, and dnf prints Importing GPG key ... on a perfectly good refresh, which the first grep took as evidence of a rejection.

One thing this needs from the repository owner

release.yml now fails closed without secrets.GPG_SIGNING_KEY / secrets.GPG_PASSPHRASE, so the next release is blocked until those exist. Per the decision recorded earlier: a signing subkey (ASCII-armored) in an Actions secret, master key offline and never in CI, subkey expiry two years with rotation documented. The fingerprint placeholder in docs/index.md is filled in with the first signed release — both scripts tell users to verify against that page.

`apt install objectfs` and `dnf install objectfs` work, which is the half of
#138 part (c) that makes `apt upgrade` reach ObjectFS at all. pages.yml builds
both repositories from the release assets on every deploy; two scripts, served
at objectfs.io, add them.

The two scripts do not offer the same guarantee, and the asymmetry is apt's and
rpm's rather than ours. setup-repo-debian.sh writes a deb822 entry with
Signed-By:, scoping the key to this repository; a key in
/etc/apt/trusted.gpg.d — where apt-key add, which #138's text specifies, puts
it — signs for every repository the machine reads. rpm has no equivalent:
rpm --import is system-wide, gpgkey= creates no per-repository keyring, so on
RHEL trusting this repository means trusting the key for everything.
setup-repo-rhel.sh prints that before importing rather than papering over it.

Both fail closed. No signing key at deploy time publishes no repository rather
than an unsigned one, since an unsigned index fails at a user's apt update
instead of in CI.

Four defects found by installing from a real repository in a container, none
reachable any other way:

- nfpm builds unsigned rpms, so the first rockylinux:9 run downloaded the
  package and failed GPG check. apt needed no equivalent because InRelease
  covers the Packages indexes, which carry each .deb's checksum; rpm has no
  such chain and each package stands alone.
- rpm -K exits 0 for an unsigned package — "digests OK" vs "digests signatures
  OK", both status 0 — so the assertion matches the text.
- zypper reads /etc/zypp/repos.d, not /etc/yum.repos.d, so a yum-only script
  succeeds on openSUSE and configures nothing.
- reprepro keeps one version per suite, which would have shipped a retention
  bound of five as a bound of one.

Five documented one-liners were a 404 until the deploy served the scripts they
name — worse than install.sh's year of the same, since these pipe into sudo
bash. Both are now copied, byte-compared and in the paths filter: a stale
installer installs an old binary, a stale setup script installs an old signing
key, and that key stays trusted afterwards.

Gated by internal/config/served_repositories_test.go and verified by mutation:
25 mutations each fail the intended test. Two found weaknesses in the gates
themselves — an exit 1 assertion satisfied by an unrelated exit 1 in the same
step, and two existing gates that matched one literal shell spelling and broke
when a step became a loop over three files while their property still held.

ci.yml gains repo-install, which builds the repositories from pages.yml's own
extracted steps — so the copies cannot drift — and installs on ubuntu:24.04,
rockylinux:9 and opensuse/leap:15.6, asserting a tampered index is refused on
each. Every refusal has an untampered control, because the first two versions
reported a pass for a check that had not run: apt reused cached lists and
verified nothing, and dnf prints "Importing GPG key ..." on a good refresh,
which the first grep took as evidence of a rejection.
@scttfrdmn scttfrdmn added type: enhancement New feature or improvement to existing functionality type: ci-cd Continuous integration or deployment improvements priority: medium Important but not urgent area: ci-cd CI workflows, gates, and release automation labels Aug 14, 2026
A $GITHUB_ENV write takes effect in subsequent steps only, and repo-install set
OBJECTFS_SIGNING_KEY_FILE and _ID there and then ran `make package-linux` in the
same step. nfpm saw neither, and an unset key_file is not an error to nfpm — it
skips signing — so the build printed four "created package" lines and produced
an unsigned rpm.

Caught by the job's own check, and note which half did the work:

  dist/objectfs-0.13.0-1.aarch64.rpm: digests OK

Exit status 0, as it is for every unsigned package. This is the case the text
assertion exists for.

release.yml is unaffected: there the build is a separate step, so $GITHUB_ENV is
the right mechanism. The new gate is conditional for that reason — it fires only
on a step that both sets the variables and runs make, and it names both, since
the first version named only the file and passed on a step exporting one of two.
The repo-install job runs pages.yml's own repository-building shell rather than a
second copy of it, extracted with python so an edit to the workflow is picked up
automatically. The extractor took the `run:` body and none of the YAML around it,
so the step's `env:` block was left behind — and REPO_KEEP, a plain literal there
that the step's summary reads, was unbound.

Under `set -u` that killed the script on its last line, after both repositories
had built and both signatures had verified: `repo-step.sh: line 163: REPO_KEEP:
unbound variable`. The substance of the step had all succeeded.

Carried across generally rather than by naming REPO_KEEP, since the gap is the
`env:` block and not that one variable. Only the plain literals: substituting a
`${{ secrets.* }}` expression would write its literal text into a shell variable,
which is worse than leaving it unset because then nothing would fail. Those are
exported by this job explicitly, with values a harness can have.

Two guards, because both halves can go quiet:

- The python side raises if it carries nothing. An indent or quoting change in
  that block makes the regex match zero lines, which is the same outcome as not
  having the loop and is invisible at the point of failure.
- The shell side checks every name pages.yml declares that the extracted script
  still reads, against the environment the script will run in. `printenv`, not a
  shell-variable test: the script is a subprocess, so a plain assignment here
  would satisfy `${!v+x}` and still leave the child unbound. "Still reads" is
  load-bearing — GH_TOKEN is in that block and is used only by the release
  download the substitution removes.

Verified in a debian:12 container against the four locally built 0.13.0 packages:
189 lines and 1 literal env var extracted, both repositories signed and verified,
all seven expected artifacts present, and the summary block that died now renders
`retention: newest 5 release(s); carried 1`.

Both guards mutation-tested: dropping the carried export, reshaping the env
block's indent, unsetting a variable this shell supplies, and assigning one
without exporting it are each caught. A scan for other variables the script reads
and nothing sets found none, so REPO_KEEP was the only instance.

Refs #138
The previous commit's comments explained which env entries the extractor skips by
naming them the obvious way, and that broke the workflow file: Actions interpolates
expressions everywhere in a workflow, including inside what a shell would read as a
comment, because the substitution happens before any shell exists. Neither the
wildcard form nor the empty one parses, so the file failed and no job started.

That failure has no local symptom and almost no remote one. check-yaml passed,
shellcheck passed on the extracted step, the YAML was well-formed and the shell was
correct. The run reports "This run likely failed because of a workflow file issue"
with no job list, no log and no annotation -- `gh run view` prints that sentence and
stops, and `gh pr checks` shows only the checks from other workflows.

Fixed by taking the braces out of the prose, and in the one place the marker is
genuinely needed -- the extractor tests for it, to skip the templated entries -- by
building it from its halves at runtime.

Gated by TestWorkflowExpressionsAreValid, which walks every workflow and requires
that anything inside braces looks like an expression: non-empty, no wildcards, and
starting from a known context, function, negation or literal. Deliberately not a
parser; what has to be told apart is prose that happens to sit in braces from a real
context reference, and the two are far apart.

Four mutations, each caught: the exact wildcard comment that failed, the exact empty
one, arbitrary prose in braces, and an unclosed opener. The floor of 50 checked
expressions is against a counted 92 (ci 50, release 28, dependabot 9, pages 4,
security 1), so the test going quiet is a failure rather than a pass.

The misspell suppression is for GitHub's own spelling of a function name; verified it
still fires without it, so it is not left over from something already fixed.

Refs #138
All three are the same shape as the ones already in this entry: a mechanism that
applies somewhere other than where it appears to. Two came out of running the job
($GITHUB_ENV applying to later steps only, so nfpm silently wrote an unsigned rpm;
the extractor taking a step's shell without its env block), and the third came out
of documenting the second, since workflow expressions are interpolated inside
comments and a comment naming secrets.* fails the file before any job starts.
@scttfrdmn
scttfrdmn merged commit f7d4dd6 into main Aug 14, 2026
43 checks passed
@scttfrdmn
scttfrdmn deleted the feat/apt-yum-repo-on-pages branch August 14, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci-cd CI workflows, gates, and release automation priority: medium Important but not urgent type: ci-cd Continuous integration or deployment improvements type: enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant