test(docker): cover group-add privilege drop - #1
Open
JMilthaler wants to merge 1 commit into
Open
Conversation
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 does this PR do?
I'm running into the same supplementary-group issue described in NousResearch#75627. The requested regression test seemed straightforward, so I had an agent create and independently review it in hopes of unblocking NousResearch#75632 and getting the fix into the official branch.
This adds the requested real-image Docker regression test. It launches the built Hermes image with
--group-add 1001, exercises the real/init→ s6 cont-init →main-wrapper.sh→s6-setuidgid hermeslifecycle, and verifies both that the final command runs as UID10000and that supplementary GID1001survives the privilege drop.The test uses explicit
RUNTIME_UID=andRUNTIME_GROUPS=markers, including an exactly-one-marker assertion, so stage2 logging cannot produce a false positive.Related Issue
Related to NousResearch#75627.
Adds the regression coverage requested on NousResearch#75632.
Type of Change
Changes Made
test_group_add_survives_main_wrapper_privilege_droptotests/docker/test_main_invocation.py.--group-add 1001.main-wrapper.shexecutes as Hermes UID10000.1001remains present afters6-setuidgidcallsinitgroups().How to Test
Build the Docker image from this branch.
Set
HERMES_TEST_IMAGEto the built image tag.Run:
Expected result: one test executes and passes, proving the final UID is
10000and GID1001survives the full s6 privilege-drop path.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passThe full Python suite was not run because this is a targeted Docker integration-test contribution. The requested real-image regression test executed successfully in GitHub Actions.
Documentation & Housekeeping
docs/, docstrings) — N/A; test-only change with an explanatory test docstringcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Real-image GitHub Actions verification:
Run group-add regression teststep: success1 tests passed, 0 failedAdditional checks completed:
ruff check tests/docker/test_main_invocation.py: passedpython3 -m py_compile tests/docker/test_main_invocation.py: passedsh -n docker/stage2-hook.sh: passedgit diff --check: passed