Repository navigation
feat: pullgate bootstrap with pairing, so nobody types or pastes the owner ID - #48
Merged
Merged
Conversation
…owner ID Fixes #31 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks
…ecks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 5 tasks
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.
What
pullgate bootstrap, as root on a console of a new host:--instance NAME --repo URLfirst (and--branch,--apply,--known-hosts). Nothing is asked or written before these pass.systemd-ask-password(no echo, not in the history, not an argument), or with--token-stdinfrom stdin.getMechecks it.owner_idandchat_idcome only from that message. 5 wrong codes, the code from a group, or a timeout stop it and write nothing. Then it writesbot-token(0600) andlistener.toml(root, group of the listener, 0640).ssh-keygenand prints the public key ("add it as a read-only deploy key"), pins the host key (thegithub.comed25519 key that the binary carries, with its fingerprint; another host needs--known-hosts FILE), writes a minimal instance config when none exists, and waits untilgit ls-remotecan read the branch.There is no flag, key or variable for the IDs. Programs that bootstrap starts get only
PATHandLC_ALL.The CI job "README install and a full loop under the units" now writes
bot-tokenandlistener.tomlwithpullgate bootstrapon the fake Telegram, and checks that the IDs come from the pairing.Not in this PR: step 1 (make the users, directories and units) and step 5 (run
pullgate doctor, enable the units). They needpullgate doctor(#28). A new issue, blocked by #28, takes them.Not in this PR: the one-paste form with a SHA-256 in the release notes (it is in the proposal, not in "Done when").
Tests
internal/bootstrap/bootstrap_test.go:TestPairRightCode,TestPairWrongCode,TestPairGroupChat,TestPairTimeout,TestPlantedIDsAreNotUsed,TestPlantedFileStaysWhenPairingFails,TestTokenNeverLeaks,TestBadToken,TestGitHubKey,TestOtherHostNeedsKnownHosts,TestWaitRemote(a fake git host that appears later).Reviews
The security reviewer and a correctness review ran. Fixed:
--api-urlcould point to a server that changes the sender ID. Now only the real Bot API, or a test server on127.0.0.1.http://127.0.0.1:80@hostpassed the prefix check, in bootstrap and in the listener config. Nowconfig.CheckAPIURLparses the URL (tests in both packages)./etc/pullgateis safe;listener.tomlis written before the token, and the directory is synced.NAME.tomlis probed with its own repo, key and known hosts, and nothing else is written for it..pubwithout a key is refused.Fixes #31
🤖 Generated with Claude Code