Repository navigation
fix: the first run works under RestrictSUIDSGID=yes (no setgid outbox) - #21
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Root gives each outbox file the listener's group with fchown on the open file. Ensure makes the outbox 0770 with no setgid bit, and takes the bit off an outbox made by 0.1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
groupsky
marked this pull request as ready for review
November 16, 2026 12:40
This was referenced Nov 16, 2026
fix: the first run fails: RestrictSUIDSGID=yes in pullgate-run@.service blocks the setgid outbox
#19
Closed
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.
Fixes #19.
What was wrong
pullgate-run@.servicesetsRestrictSUIDSGID=yes. That filter refuses everychmodthat sets a setuid or setgid bit.spool.Ensuremade the outbox0770 | setgid, so the firstpullgate rununder the unit failed withchmod .../outbox: operation not permitted. Then the listener could not read the outbox.The fix (option a of the issue)
root:listener 0770with no setgid bit.spool.Send(gid, m)gives each outbox file the listener's group itself:fchown(-1, gid)andfchmod 0640on the open file, before the rename. The listener never sees a file with another group. Every caller passese.Owners.ListenerGID, which root takes from its own user lookup.Ensuretakes the setgid bit off an outbox made by 0.1.0. Removing a bit is allowed underRestrictSUIDSGID=yes.RestrictSUIDSGID=yesstays in the run unit. The reason is in DESIGN.md section 4.Tests
test/units/first-run.sh): it runs as root on the throwaway CI runner. It installs the binary and the units ofcontrib/systemd/as the README says, with no drop-in. It startspullgate-run@config-repo.service, checks the owners and modes of DESIGN.md section 4, then startspullgate-listen.serviceagainst a fake Telegram on127.0.0.1(test/units/faketg.py). It checks that the listener sent the question and removed it from the outbox. It fails on anylevel=ERRORorlevel=WARNline.fix /var/spool/pullgate/config-repo/outbox: chmod /var/spool/pullgate/config-repo/outbox: operation not permitted, and the listener loggedopen .../outbox: permission denied.TestOwnersAndModes(internal/spool): no setgid bit, the modes of section 4, an old setgid outbox gets fixed, and an outbox file has the listener's group and mode 0640.TestSendDeny: no group is refused; a group the chown cannot give is an error, and no file stays.Docs
CAP_CHOWNneed), section 14 (the new test).RestrictSUIDSGID=nodrop-in after the update.pullgate-run@.serviceandpullgate-apply@.service: keepCAP_CHOWN.test/units/first-run.sh.Reviews
The security reviewer (
.claude/agents/security-reviewer.md) and a correctness review ran on the diff. Fixed:journalctl --syncand needs theaskedline;CAP_CHOWNis needed;Not done: a CI test of
pullgate-apply@.service. The apply unit sets no capability limit, and the sameSendpath is covered by the run unit test. Thelevel=check was found to work: the failing run showedlevel=ERRORtext lines.🤖 Generated with Claude Code