fix(file-tools): allow macOS var folders temp writes - #32344
Open
drewTuzson wants to merge 1 commit into
Open
Conversation
Collaborator
This was referenced May 26, 2026
19 tasks
bitfrost7
pushed a commit
to bitfrost7/hermes-agent
that referenced
this pull request
Jul 10, 2026
…ousResearch#32344) Cherry-picked from PR NousResearch#32344 upstream. macOS resolves temp dirs under /private/var/folders/ which triggers the /private/var/ sensitive path check, blocking write_file to legitimate temp files. Add _SENSITIVE_PATH_EXEMPT_PREFIXES to exempt /var/folders/ and /private/var/folders/ before the main sensitive-path check.
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for identifying the macOS temp-directory regression. The premise remains valid on current main: tools/file_tools.py:673-675 blocks all /private/var/ descendants, and write_file_tool invokes that guard at tools/file_tools.py:1678.
Problems
tools/file_tools.py:196allows the exemption when either the resolved or normalized path matches. A user-writable allowlisted path can be a symlink to a protected target: the normalized spelling matches the exemption while the resolved target is sensitive. This weakens the macOS symlink protection introduced by311dac197145e19e07df68feba2cd55d896a3cd1.- The exemption is not Darwin-gated, so it changes the sensitive-path guard outside macOS as well.
Suggested changes
- Make the exemption Darwin-only and require both normalized and resolved paths to be allowlisted; fail closed when resolution fails.
- Extend
tests/tools/test_file_write_safety.py:109-115with symlink-target, resolution-error, and platform-gate coverage.
Automated hermes-sweeper review.
| "Use the terminal tool with sudo if you need to modify system files." | ||
| ) | ||
| for prefix in _SENSITIVE_PATH_EXEMPT_PREFIXES: | ||
| if resolved.startswith(prefix) or normalized.startswith(prefix): |
Contributor
There was a problem hiding this comment.
This must not be an OR check: an allowlisted-looking /private/var/folders/... symlink can resolve to a protected target while normalized still matches. Gate this to Darwin and require both resolved and normalized paths to match the allowlist, failing closed if resolution fails.
This was referenced Aug 3, 2026
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
Verification
Notes