ci(deploy): pin the deploy key to one forced command; self-update runs the new setup.sh (#163)
Some checks failed
CI / build (push) Has been cancelled
deploy / deploy (push) Has been cancelled
test / test (push) Has been cancelled

The 10-27 incident showed what an unrestricted root deploy key is worth to an
attacker. The CI key is now installed on the box as
restrict,command="/usr/local/sbin/agentbbs-ci-deploy", so it gets no shell,
scp, sftp, pty or forwarding.

- deploy/ci-deploy.sh (installed by setup.sh): verbs `arch`, `upload
  agentbbs|ascii-live` (ELF on stdin, size-capped, root-only staging dir) and
  `deploy main|master` (app secrets as NAME=<base64> on stdin, allowlisted).
  It does what the old inline heredoc did: sync to origin, pause the
  self-update timer, install binaries, exec setup.sh SKIP_BUILD=1.
- deploy.yml: uses those verbs instead of scp + `sudo bash -s`.
- self-update.sh: reset to origin before exec'ing setup.sh, so a setup.sh
  change takes effect on the first timer run instead of the second.

Co-authored-by: Anthony Ettinger <anthony@profullstack.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sh1pt-actions-fleet[bot] 2026-11-02 09:21:21 +00:00 • committed by GitHub
parent eb8e9ae9c5
commit 29c14d4cb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 128 additions and 49 deletions

View file

@ -39,5 +39,8 @@ if [ "$FORCE" -eq 0 ] \
fi
echo "redeploying: ${local_rev:0:12} -> ${remote_rev:0:12} (force=$FORCE)"
# setup.sh does the reset --hard, rebuild, and restart under its own lock.
# Move the checkout to origin first so the NEW setup.sh runs. Exec'ing the
# on-disk copy before its own reset ran the previous commit's setup.sh, so a
# setup.sh change needed two timer runs to take effect.
git -C "$SRC_DIR" reset --hard "origin/${BRANCH}"
exec "$SRC_DIR/setup.sh"