Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or requestpriority: lowDo when nothing else waitsDo when nothing else waits
Description
Today pullgate run NAME starts only from its timer (pullgate-run@NAME.timer, every 5 minutes in the example). After a push, the owner waits for the next round. Let the owner send /check (all instances) or /check NAME to the bot, so the host fetches now and, when there is a new commit, asks the usual Apply question at once.
How it must fit the design
- The listener stays as small as it is. It also takes
messageupdates (allowed_updates = ["callback_query", "message"]), but only fromowner_idinchat_id, and only the exact text/checkor/check NAME, where NAME is ininstancesoflistener.toml. Anything else: ignore it (no answer to other users, no log of the text). - All the listener can do is write a check request into the instance's inbox: a fixed-form file with no data from the message (the file name or a fixed kind field says "check"; nothing else). It can still not cause an apply.
- Root decides. A path unit (or the existing apply path unit) starts
pullgate-run@NAME.servicefor the request; root removes the request file under the same checks as an approval (regular file, owner, size, no symlinks). The run is the normal run: same sandbox, same rules (v0.1: pull a repo, ask the owner on Telegram, apply one exact commit #1 rules 1–6). No new code path that applies anything. - Rate limit per instance (for example at most one requested run per minute), so a flood of
/checkcannot make the host fetch all the time. Extra requests in that time are dropped, with one reply. - Reply on every accepted
/check: "checking NAME…", and after the run either the Apply question (as today) or "NAME: no new commit (applied SHA …)", or "NAME is paused / off". - Paused or
mode = "off"instances: reply so, do not fetch.
Threats to cover in THREAT-MODEL.md
- A stolen bot token: the thief cannot send messages as the owner. Even a forged request only fetches and asks; it never applies.
- A message in another chat or from another user: ignored.
- Many requests: the rate limit.
Done when
-
/checkand/check NAMEwork as above; DESIGN.md (sections 3, 8, 9) and README describe them. - Tests for the deny paths: other user, other chat, unknown NAME, extra text, edited message, rate limit, paused and off instance, a check request file that is a symlink or has the wrong owner. And a test that a check request never leads to an apply without a tap.
- THREAT-MODEL.md has the entries above.
- The example units in
contrib/systemd/start the run on a request; the units test in CI covers it. - Security review subagent run on the PR, findings fixed.
More from review (2026-11-11)
- How root checks a request. Today root accepts an inbox file only with a code it recorded (rule 4, THREAT-MODEL T2/T12). A check request has no code. Write down the new file kind, how root checks it, and update T2 and T12. The listener stays untrusted.
- Root enforces the rate limit, not the listener (T2). The listener may also limit, but root must not trust it.
mode = "auto"(DESIGN section 13): there a run writes the auto approval itself, so/checkwould lead to an apply without a tap. Decide and write down: refuse/checkfor auto instances, or allow it and say clearly that auto instances apply on/checkas on the timer. The "never applies without a tap" test is then formode = "ask".- More deny tests: a replayed
update_id;/check@otherbot; a request while the lock is held (it waits or is dropped, never runs twice at once); a request for an auto instance (as decided above).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority: lowDo when nothing else waitsDo when nothing else waits
Activity
groupsky commentedon Nov 12, 2026
Done in #13 (
fbd8782)./checkand/check NAME: the listener writes a fixedspool/NAME/check/request;contrib/systemd/pullgate-check@.path(PathExists=) starts the normalpullgate-run@NAME.service. Root checks and removes the file like an approval, and keeps the rate limit (one requested run per minute, in its own state). Paused/off: reply, no fetch.mode = "auto": allowed, applies as the timer would (DESIGN section 13, README). DESIGN sections 3, 8, 9, 13 and README describe it.TestCheckCommandsThatDoNotCount(other user, other chat, unknown NAME, extra text, edited message,/check@otherbot),TestReplayedUpdateIsIgnored,TestCheckRateLimitByRoot,TestCheckPausedAndOff,TestBadCheckRequests(symlink, wrong owner, too big, wrong content, directory, FIFO),TestCheckBadRequestFiles,TestCheckWaitsForTheLock,TestCheckWaiterStopsWhenRequestIsGone,TestCheckAutoModeApplies, andTestCheckRequestNeverAppliesWithoutTap(mode ask). e2e:/checkfrom another user does nothing; the owner's/checkruns and replies.pullgate-check@.path; the CI "example units" job runssystemd-analyze verifyon it./checkoff until reset (only denies).