Repository navigation
Open
Labels
Description
After #7 there is an install.sh that installs a checked release. Let the owner also update pullgate on a host from the bot: /update checks GitHub for a newer release, and when there is one the bot asks the usual question with Apply and Skip. On Apply, root installs that exact release with the checks of install.sh.
How it must fit the design
- Same gate as a commit. The question names the exact version and the SHA-256 of the tarball for this host's CPU, and links the release notes. Apply installs only that tarball (rule 2, "one exact commit", for a release). A newer release that arrives in between closes the old question and asks again.
- The listener only writes requests and approvals, as today: a check request for the built-in
pullgatetarget, and the approval code. Root checks GitHub, records the question in its own state, and installs. Root takes the version and SHA-256 from its own state, never from the approval. - Root runs the install with every check of feat: install.sh that installs or updates pullgate from a checked release #7: SHA-256 from
SHA256SUMS,gh attestation verifywith the release bundle and the release workflow identity, the new binary'spullgate version. Best as a built-in copy ofinstall.sh(pullgate update, as nodkey does), so the code that checks is the code that was installed and checked before. - Forward only by default: never install an older version from Telegram.
- Fail closed and keep a way back: keep the old binary until the new one runs; if the new binary does not start (
pullgate version, then the listener service is active), put the old one back and report. Report the new version when done. - Restart the listener and units after the install (the listener restarts itself last, after it has reported).
- The bot tells the owner about a new release by itself (owner request, 2026-11-16): root checks GitHub once a day (in the run timer, or its own timer) and, for each newer release, sends one notice with the version, the release link and "send /update to install" (as
nodkeydoes for its broker). On by default;[updates] check = falsein the listener or host config turns it off. A release that fixes a security problem says so first and repeats daily until installed. No question is asked without/update, so a notice never needs a tap. The notice goes out only for a release that passed the SHA-256 and attestation checks (as "Check before asking" below); a release that fails them gets a warning notice instead, never the "/update" hint. - The units come with the update. The binary carries the
contrib/systemd/units of its own version (embedded). After the install, root compares them with/etc/systemd/system/; where a shipped unit differs, it installs the new one (a unit file is pullgate's own file; the owner's changes belong in drop-ins), runsdaemon-reloadandreenablefor each unit the README enables, and lists in the report what changed. It also lists every drop-in under/etc/systemd/system/pullgate-*.d/, so the owner sees a workaround that a release has made unneeded (the 0.1.0 → 0.1.1 update needed this by hand: fix: the first run fails: RestrictSUIDSGID=yes in pullgate-run@.service blocks the setgid outbox #19, fix: pullgate-listen.service has no [Install] section, so enable fails and the listener does not start after a reboot #20).
Threats to cover in THREAT-MODEL.md
- This replaces the program that is the gate. A wrong or bad binary removes the gate. So the attestation check is required, never optional, and there is no setting to skip it.
- A stolen bot token: cannot tap as the owner (rule 4); a forged request only checks and asks.
- A release that is published but bad: forward-only plus the owner's tap; the owner can pin
--versionwithinstall.shby hand.
Done when
-
/updatechecks, asks with version + SHA-256 + release link, and installs on Apply as above; DESIGN.md and README describe it. - Tests (fake release server, as in feat: install.sh that installs or updates pullgate from a checked release #7): wrong SHA-256, failed attestation, wrong version, older version, a newer release that arrives while a question is open, a new binary that does not start (rollback to the old one), Skip.
- THREAT-MODEL.md has the entries above.
- The daily notice: a test with a fake release server sends one notice per new release, none when up to date, and a repeated one for a security release;
check = falsestops it. - The unit update: a test where a shipped unit differs installs it, reloads, re-enables, and reports it; a drop-in is listed, not touched.
- The install CI job (test: CI installs pullgate as the README says and runs a full loop under the real units #27) updates from the previous release to the build under test with
/updateon the fake Telegram server. - Security review subagent run on the PR, findings fixed.
More from review (2026-11-11)
- Name space.
pullgateis also a valid instance name. Use a name that no instance can have (for example a separate inbox and state directory, or a name outside[a-z0-9][a-z0-9-]{0,31}), and test that an instance calledpullgatedoes not touch the self-update. - Root now downloads and unpacks. THREAT-MODEL T13 covers only git over ssh. Add: HTTPS only, no redirect outside GitHub's release hosts, a size limit per download, a time limit, tar entries with no
.., absolute paths, symlinks or other types, only the expected files.ghruns as root: say whichgh(pinned, checked, as in feat: install.sh that installs or updates pullgate from a checked release #7). - Check before asking. Run the SHA-256 and attestation checks before the question is sent, and again on Apply (the files are fetched again or kept in a root-only place). The question never offers a release that failed a check.
- The design says the opposite today: DESIGN section 15 and THREAT-MODEL T5 say self-update is not in 0.1 and pullgate does not repair itself. Rewrite both for this feature.
- A crash in the middle of the swap (T10): after a reboot the host has either the old or the new binary, never none or a half file (rename in the same directory,
fsync); test it. - Done when, more exactly: DESIGN.md gets a section for self-update (the flow, the files, the states); README "Install" gets the
/updatesteps. The release-to-release update is tested in CI (test: CI installs pullgate as the README says and runs a full loop under the real units #27), not by a live run.
Activity
[-]feat: update pullgate itself from Telegram (check for a new release, Apply to install)[/-][+]feat: update pullgate from Telegram: a notice for each new release, /update installs it with its units[/+]