fix(ssh): keep bulk sync extraction scoped to .hermes - #30172
Merged
Conversation
Contributor
🔎 Lint report:
|
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.
Salvage of #10205 onto current main. Original author @Stark-X — commit authorship preserved via cherry-pick.
Summary
SSH backend bulk-upload no longer extracts its tar stream at
/, eliminating thetar extract over SSH failed ... Cannot change mode ... Operation not permittederrors and the silent home-directory permission widening that breaks sshdStrictModes.Root cause
_ssh_bulk_upload()mirrored absolute remote paths into the staging dir (home/<user>/.hermes/...) and rantar xf - -C /on the remote. With a local umask of 002 the staging dirs are created 0775, andtarapplies those modes to existing/homeand/home/<user>on the remote on extract — even with--no-overwrite-dir, the failing chmod surfaces as the rc=2 error Bertl reported. On hosts withStrictModes yes(default on most OpenSSH builds) this also rejects the next login.Changes
tools/environments/ssh.py: stage relative to$REMOTE_HOME/.hermes, reject paths that escape the base, extract with-C <base>instead of-C /(~20 LOC)tests/tools/test_ssh_bulk_upload.py: updated 2 expectations + new regression testtest_bulk_upload_never_stages_remote_home_prefixscripts/release.py: AUTHOR_MAP entry for @Stark-XValidation
scripts/run_tests.sh tests/tools/test_ssh_bulk_upload.py tests/tools/test_ssh_environment.py→ 46/46 pass_ssh_bulk_uploadcalls (subprocess mocked at the boundary):/home/testuser/.hermes/cache/foo.txt→ staging tree iscache/foo.txtonly, nohome/prefix/etc/passwd→ rejected:remote path '/etc/passwd' escapes sync base '/home/testuser/.hermes'Closes #10205.