Repository navigation
fix: give the listener a HOME subdir so orphan reap passes SEC-3 - #188
Merged
Merged
Conversation
…n reap passes SEC-3 (#186)
…n reap passes SEC-3 (#186) Since #168 the unit set HOME to the runner home itself, so the SEC-3 guard in lib/common.sh (RUNNER_HOME must not equal HOME) aborted every orphan reap. HOME is now <prefix>/runners/%i/home, which listener_ensure_work_root creates mode 0700 owned by the service user (no recursive chown). The renderer's prefix rewrite already covers the new path; lib/common.sh is unchanged.
…r type paths (#186) listener_type_paths now owns the <runner_home>/home path alongside LISTENER_RUNNER_HOME and LISTENER_WORK_ROOT, so listener_ensure_work_root no longer recomputes it locally.
- Redeploying one type replaces the shared unit template and restarts the other active instances; create or repair each installed sibling's home/ (mode 0700, service user) before installing the new template, including inactive instances, so no listener starts with a missing HOME. - Refuse a symbolic link at the listener HOME path instead of following it and changing the target's mode and owner (listener_ensure_home). - The reap.sh regression now derives HOME from the unit template and asserts that the orphan is removed and its stale work dir pruned; the HOME equal to RUNNER_HOME case also asserts nothing is removed. - Add a dry-run test over an existing runner tree (no work/ or home/ created), keeping the original empty-prefix dry-run test. - CHANGELOG: say the redeploy creates the home dirs before restarting.
Member
Author
中文說明這個 PR 修正 #186。 問題
修正
Red 證據
合併後
|
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.
Summary
Give the listener unit a HOME that is a subdirectory of the runner home (
runners/<type>/home, mode 0700), so that the periodic orphan reap passes the SEC-3 guard again.Motivation
Closes #186. Since #168 the unit set
HOMEto the runner home itself. The SEC-3 guard inlib/common.shrefusesRUNNER_HOME == HOME, so every orphan reap exited FATAL and stranded containers and work dirs were no longer cleaned.Changes
deploy/scaleset-listener@.service:Environment=HOME=/opt/github-runner-listener/runners/%i/home.lib/listener-deploy.sh:home/with mode 0700, owned by the service user, for every installed type before it restarts listeners.lib/common.shis unchanged.Red evidence
Stage 1 commit
2f8f88e, run withjust test-unit,just test-integrationandjust lint. Five new or updated assertions failed on the missing behaviour, with no setup errors:The two new reap regression tests passed already at stage 1, because the guard is intentionally unchanged:
reap.shwithHOME=${RUNNER_HOME}/homeexits 0 and removes the orphan.reap.shwithHOME == RUNNER_HOMEis still refused.Commits
home/Test plan
just checkjust coverage-gate(87.9%)Notes
After merge, every listener host needs a redeploy, done at an idle gap.