fix(file-tools): allow writes to platform temp directory on macOS - #31021
Open
yy7yy7kimo-code wants to merge 1 commit into
Open
yy7yy7kimo-code wants to merge 1 commit into
yy7yy7kimo-code wants to merge 1 commit into
Conversation
Contributor
19 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for isolating the macOS temp-directory false positive. The issue is still present on current main: tools/file_tools.py:635-675 blocks task-resolved /private/var/folders/... paths through the broad /private/var/ prefix.
Problems
tools/file_tools.py(PR right-side line 181): returning from_check_sensitive_path()here skips the exact-path and Hermes-config protections below it. Currenttests/tools/test_file_tools.py:596-630requires a config file under a temporary directory to remain blocked for bothwrite_file_toolandpatch_tool; this implementation would permit it when it is belowtempfile.gettempdir().- The PR has no regression coverage for the macOS temp-root path or for retaining those protections.
tests/tools/test_file_write_safety.py:171-196currently covers/private/var/dbblocking and normal/tmpallowance only.
Suggested changes
- Skip only the broad
_SENSITIVE_PATH_PREFIXESscan for a verified resolved temp path; continue to the exact-path and Hermes-config checks. - Add allow/block regression cases for macOS temp paths and for a config path beneath the temp root.
Automated hermes-sweeper review.
| except (OSError, ValueError): | ||
| resolved = filepath | ||
| normalized = os.path.normpath(os.path.expanduser(filepath)) | ||
| if _is_allowed_temp_path(os.path.normpath(resolved)): |
Collaborator
There was a problem hiding this comment.
This early return also skips the exact-path and Hermes-config guards below. tests/tools/test_file_tools.py:596-630 requires a config located under a temporary directory to remain blocked for both write and patch; exempt only the broad prefix loop, then continue through the remaining checks.
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.
macOS resolves /var/folders/ to /private/var/folders/ which is blocked by the /private/var/ sensitive-system path guard. Adds _is_allowed_temp_path() to explicitly allow platform temp directory writes.