Repository navigation
ci(deploy): pin deploy key to a forced command; self-update runs the new setup.sh - #163
Merged
Merged
Conversation
…s the new setup.sh 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: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan10 finding(s) HIGH/CRITICAL: 7 | LOW: 3
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deploy-on-merge has failed with
Permission denied (publickey)since the post-incident root key cleanup. This replaces the old unrestricted key with a fresh ed25519 key pinned to one forced command.Box (already done, by hand):
/usr/local/sbin/agentbbs-ci-deployinstalled from this branch'sdeploy/ci-deploy.sh; rootauthorized_keyslinerestrict,command="/usr/local/sbin/agentbbs-ci-deploy" ssh-ed25519 ... github-actions-deploy@agentbbs-2026-11-02(backupauthorized_keys.bak-cideploy-20261102).Changes
deploy/ci-deploy.sh: verbsarch,upload agentbbs|ascii-live(ELF from stdin, 256 MiB cap, root-only staging dir/var/lib/agentbbs-deploy),deploy main|master(app secrets on stdin asNAME=<base64>, allowlisted). Same steps as the old inline heredoc. Nothing from the command line is evaluated by a shell..github/workflows/deploy.yml: uses those verbs instead ofscp+sudo -n env ... bash -s(withrestrictneither would work, andbash -swould have made the forced command pointless).setup.sh§7c installs the forced command so it stays in sync with the workflow.scripts/self-update.sh:git reset --hard origin/<branch>before exec'ing setup.sh, so the NEW setup.sh runs (it used to run the previous commit's copy, so setup.sh changes needed two timer runs).Verified with the new key from dev2:
id, empty command,deploy main;id,deploy evil, non-ELF upload,upload ../../etc/passwdall refused; scp/sftp closed;-Lforwarding "administratively prohibited". A fullarch/uploadx2 /deploy mainrun with runner-equivalent binaries succeeded; bbs.profullstack.com/and/manifest.webmanifest200, :22 serves agentbbs, :2202 admin login still works.Needs: the
DEPLOY_SSH_KEYsecret updated to the new private key (the GitHub App token cannot write Actions secrets).🤖 Generated with Claude Code