You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use handle-based reads in FileHelper so path traversal, file-type checks, and reading operate on stable filesystem objects. Preserve supported contained symlinks, link chains, and trusted root aliases.
Extract the existing Windows handle primitive for reuse by FileHelper and catalog-cache I/O, add deterministic coverage for path replacement and handle cleanup, and update the FileHelper design contract. Narrow cleanup-fallback test fixtures to disable directory removal capabilities without disabling project reads.
Testing
Set up this checkout's .venv and editable install using the local development guide. Run commands from the checkout root.
Tested locally with .venv/bin/specify --help (Windows PowerShell: .\.venv\Scripts\specify.exe --help)
Ran relevant existing tests with .venv/bin/python -m pytest tests -q (Windows PowerShell: .\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks and LC_ALL=en_US.UTF-8 on macOS
Tested with a sample project (if applicable)
Commands and results:
.venv/bin/specify --help
Passed.
LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest tests/test_file_helper.py tests/specify_cli/test_file_policy.py tests/specify_cli/integrations/test_file_changes.py tests/specify_cli/workflows/test_catalog_cache.py tests/specify_cli/presets/test_command_remove.py tests/specify_cli/integrations/test_command_switch.py -q
555 passed, 82 skipped.
LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest tests -q
14,841 passed, 136 skipped, 15 failed before narrowing the cleanup-fallback fixtures.
The subsequent focused run passes all 14 affected cleanup cases.
The remaining version-output formatting failure also reproduces with the original FileHelper implementation.
The remaining failure is tests/specify_cli/test_version_execution.py::TestWindowsUvToolEnvironment::test_non_windows_uv_tool_dry_run_still_previews_installer: terminal wrapping splits the long checkout interpreter path. No unrelated formatting change is included.
Native Windows execution was not available on the macOS host. Windows read-path wiring is covered with simulated handles; existing native Windows handle tests remain in the suite. A separate sample-project run is not applicable to this internal filesystem change.
AI Disclosure
I did not use AI assistance for this contribution
I did use AI assistance (fill in the disclosure below)
AI disclosure: Authored on behalf of @mnriem by GitHub Copilot using GPT-6.1 Sol (model ID: gpt-6.1-sol) in autonomous agent mode with runtime-default reasoning settings. AI assistance covered implementation, documentation, tests, automated checks, and this pull request description; no line-by-line human review is claimed.
Use Darwin's native search-only flag when a Python build omits its binding, with permission regressions covering the missing-constant case.
Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The native Windows tests fail before exercising the intended behavior because of invalid CreateFile arguments, with an additional failure caused by the nonempty-file symlink fixture.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Attribute-only Windows opens can convert pinned directories into junctions and redirect subsequent reads outside the root, a critical safety gap not covered by the native regression test.
Prevent junction swaps via attribute-only directory opens
src/specify_cli/file_helper.py:176
An attribute-only FILE_WRITE_ATTRIBUTES open bypasses write-sharing checks, so converting an emptied, pinned directory into a junction can redirect the next full-path open outside the root. This conflicts with design/file-helper.md (“Safety limits and migration”); the native test only checks GENERIC_WRITE, not this attribute-only case. Open children relative to their pinned parent handles and add a native Windows regression for attribute-only junction conversion.
Avoid requiring directory-list permission for pinned reads
src/specify_cli/file_helper.py:172
These directory pins introduce an extra Windows permission requirement: windows_handle requests FILE_LIST_DIRECTORY (0x1), so a user with traversal permission and read access to a known file, but no folder-listing permission, can no longer read it. The previous pathname read did not require enumeration, and this also affects bootstrap reads of .specify/init-options.json. Please use a non-enumerating directory pin that retains rename/reparse protection, with a native Windows ACL regression test.
AI-generated review for the requester by GitHub Copilot (model: unknown; autonomous mode; code analysis).
Preserve the upstream exclusive-create implementation and tests while unifying the private Windows handle helper.
Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep POSIX startup and filesystem operations independent of optional _ctypes while retaining one set of Windows ABI type definitions through the import cache.
Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the documentation states access requirements only for the root, while those rights are required for every resolved directory and can cause leaf reads to fail.
Retain lazy Windows ABI initialization and parent-relative reads alongside upstream text overwrite support. Preserve both test suites and their distinct traversal contracts.
Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An active maintainability finding flags a third POSIX parent-descriptor walk with differing capability checks, requiring future traversal and cleanup fixes in three places.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The security-sensitive NtCreateFile/ctypes read-confinement path lacks native Windows validation of ABI, sharing, ACL, and reparse semantics that macOS simulations cannot establish.
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
triage-must-haveVerdict: high-value, important work for Spec Kit — do first
2 participants
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.
Description
Use handle-based reads in
FileHelperso path traversal, file-type checks, and reading operate on stable filesystem objects. Preserve supported contained symlinks, link chains, and trusted root aliases.Extract the existing Windows handle primitive for reuse by
FileHelperand catalog-cache I/O, add deterministic coverage for path replacement and handle cleanup, and update the FileHelper design contract. Narrow cleanup-fallback test fixtures to disable directory removal capabilities without disabling project reads.Testing
Set up this checkout's
.venvand editable install using the local development guide. Run commands from the checkout root..venv/bin/specify --help(Windows PowerShell:.\.venv\Scripts\specify.exe --help).venv/bin/python -m pytest tests -q(Windows PowerShell:.\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks andLC_ALL=en_US.UTF-8on macOSCommands and results:
The remaining failure is
tests/specify_cli/test_version_execution.py::TestWindowsUvToolEnvironment::test_non_windows_uv_tool_dry_run_still_previews_installer: terminal wrapping splits the long checkout interpreter path. No unrelated formatting change is included.Native Windows execution was not available on the macOS host. Windows read-path wiring is covered with simulated handles; existing native Windows handle tests remain in the suite. A separate sample-project run is not applicable to this internal filesystem change.
AI Disclosure
AI disclosure: Authored on behalf of @mnriem by GitHub Copilot using GPT-6.1 Sol (model ID:
gpt-6.1-sol) in autonomous agent mode with runtime-default reasoning settings. AI assistance covered implementation, documentation, tests, automated checks, and this pull request description; no line-by-line human review is claimed.