fix(targets): reject special path targets in preflight - #549
Open
sylvesterkaczmarek wants to merge 3 commits into
Open
fix(targets): reject special path targets in preflight#549sylvesterkaczmarek wants to merge 3 commits into
sylvesterkaczmarek wants to merge 3 commits into
Conversation
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
Reject special filesystem nodes as path scan targets during local target normalization instead of allowing them to fail later in bundled scan setup.
Fixes #548.
Reproduction / evidence
Current upstream
mainat37bf87a692fc72d41f7312cc48808d699d204fbachecks only that a path target exists, resolves it, and stays inside the repository. It does not check whether the resolved target is a file or directory.On POSIX, a Unix-domain socket inside the repository therefore passes
normalizeTarget()and is returned as a validpathstarget.The bundled
generate_rank_input.pyscope resolver later rejects the same node because it explicitly requiresis_dir()oris_file().That contradicts the public preflight boundary, which validates local inputs before runtime initialization.
Root cause
Existence and containment checks were present, but filesystem type validation was deferred to a later Python setup helper.
Fix
After canonicalizing each path target,
stat()the resolved path and require it to be a regular file or directory. A special node now raisesInvalidTargetErrorduring local target validation.Tests / validation
Added
path-target-special-files.test.ts:normalizeTarget()to reject it;The branch is based directly on current upstream
mainat37bf87a692fc72d41f7312cc48808d699d204fbaand is not behind it. Production change: 14 additions, 0 deletions.Full repository tests cannot be run in this execution environment because the repository cannot be cloned here. Pushed-head CI remains the authoritative full-suite validation.
Risk
Low. The accepted target set now matches the file/directory invariant already enforced by bundled scan setup. Normal files, directories, and in-repository symlink targets that resolve to either remain supported.