fix(docker): skip symlinked stage2 chown targets - #52789
Merged
benbarclay merged 1 commit intoJun 26, 2026
Merged
Conversation
harjothkhara
force-pushed
the
fix/stage2-skip-symlink-chown
branch
from
June 26, 2026 01:56
5a37043 to
e83ce11
Compare
harjothkhara
force-pushed
the
fix/stage2-skip-symlink-chown
branch
from
June 26, 2026 02:06
e83ce11 to
a998840
Compare
benbarclay
marked this pull request as ready for review
June 26, 2026 02:09
pai-scaffolde
pushed a commit
to Scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
Prevents stage2-hook.sh recursive chown from following a symlinked $HERMES_HOME/home (or profiles/cron) and destroying the host user's home directory. Also guards top-level state-file chowns and refuses first-boot seeding through symlinks. Fixes NousResearch#52781. Co-authored-by: harjoth <harjoth.khara@gmail.com>
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?
Prevents the Docker stage2 ownership repair from following symlinked
$HERMES_HOMEtargets. Recursive repairs now skip symlinked Hermes-owned subdirectories such ashome,profiles, andcron; allowlisted top-level state files also skip symlinked paths; and first-boot seed paths refuse to write through symlinks.This keeps the existing targeted-ownership contract intact: Hermes repairs files and directories it owns, without recursively changing ownership of host-owned paths reached through symlinks.
Related Issue
Fixes #52781
Type of Change
Changes Made
docker/stage2-hook.sh: add a symlink-aware recursive chown helper for Hermes-owned subtrees.docker/stage2-hook.sh: skip symlinked allowlisted top-level files before chown/chmod.docker/stage2-hook.sh: refuse first-boot seeding through dangling symlink paths.tests/tools/test_stage2_hook_symlink_chown.py: cover real-directory repair and symlinked-directory refusal.tests/tools/test_stage2_hook_toplevel_chown.py: cover symlinked allowlisted file refusal.tests/tools/test_stage2_hook_gateway_bootstrap_state.py: cover gateway bootstrap symlink refusal.tests/test_docker_home_override_scripts.py: update the profiles/cron repair contract for the helper.How to Test
scripts/run_tests.sh tests/tools/test_stage2_hook_symlink_chown.py tests/tools/test_stage2_hook_toplevel_chown.py tests/tools/test_stage2_hook_gateway_bootstrap_state.py tests/tools/test_stage2_hook_unraid_uid.py tests/tools/test_stage2_hook_log_dir_seed.py tests/tools/test_dockerfile_immutable_install.py tests/test_docker_home_override_scripts.pysh -n docker/stage2-hook.shgit diff --checkDuplicate-work checks
gh pr list --repo NousResearch/hermes-agent --state all --search "52781"-> no PRs.gh pr list --repo NousResearch/hermes-agent --state all --search "stage2-hook chown symlink destroy home directory docker"-> no PRs.Checklist
Code
Documentation & Housekeeping
cli-config.yaml.exampleupdate N/ACONTRIBUTING.md/AGENTS.mdupdate N/AScreenshots / Logs
Focused proof passed locally: