feat(file_safety): support multiple HERMES_WRITE_SAFE_ROOT dirs - #53292
Merged
kshitijk4poor merged 3 commits intoJun 26, 2026
Merged
Conversation
Supports multiple directories separated by ':' (Unix PATH-style). E.g., HERMES_WRITE_SAFE_ROOT=/opt/data:/var/www/html Fixes NousResearch#49535
Add note about colon-separated multiple directories support.
kshitijk4poor
force-pushed
the
salvage/49557-multi-safe-roots
branch
from
June 26, 2026 22:15
6f707c9 to
ce33d45
Compare
Collaborator
Salvage of #49557 (@xydigit-zt), cherry-picked onto current |
- Use os.pathsep instead of literal ':' so Windows paths (C:\dir) and the Windows separator ';' work correctly. - Add 9 tests covering multi-root behavior: writes inside first/second root, writes outside all roots, trailing/leading/double separators, all-separators edge case, static deny priority, duplicate dedup. - Update hermes_cli/tips.py tip string to mention multiple paths. - Update docs to mention os.pathsep / ; on Windows. Follow-up for salvaged PR NousResearch#49557.
kshitijk4poor
force-pushed
the
salvage/49557-multi-safe-roots
branch
from
June 26, 2026 22:20
ce33d45 to
936ffa5
Compare
1 task
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
HERMES_WRITE_SAFE_ROOT now accepts multiple colon-separated directories (
:on Unix,;on Windows), so Docker deployments with multiple bind mounts can whitelist all of them for writes.Changes
agent/file_safety.py: Renamedget_safe_write_root()→get_safe_write_roots()returningset[str]; splits onos.pathsepinstead of literal:for cross-platform supporttests/tools/test_file_write_safety.py: Added 9 tests for multi-root behavior (first/second root, outside-all, trailing/leading/double separators, all-separators edge case, static deny priority, duplicate dedup)hermes_cli/tips.py: Updated tip string to mention multiple pathswebsite/docs/reference/environment-variables.md+ zh-Hans: Updated docsWhat was dropped from the original PR
The original PR #49557 bundled an unrelated
UnicodeDecodeErrorfix intools/memory_tool.py(addresses #49508). That fix is correct but belongs in its own PR — dropped here to keep this PR single-concern.What was fixed during salvage
os.pathsepinstead of hardcoded:— on Windows, drive-letter paths likeC:\Users\foocontain a colon that would break the split.os.pathsepis;on Windows.hermes_cli/tips.py(missed by original PR).;on Windows.Validation
;support:)os.pathsep)Closes #49535
Credit: @xydigit-zt's original commits cherry-picked with authorship preserved.