Skip to content

fix(targets): reject special path targets in preflight - #549

Open
sylvesterkaczmarek wants to merge 3 commits into
openai:mainfrom
sylvesterkaczmarek:fix/path-target-special-files
Open

fix(targets): reject special path targets in preflight#549
sylvesterkaczmarek wants to merge 3 commits into
openai:mainfrom
sylvesterkaczmarek:fix/path-target-special-files

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

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 main at 37bf87a692fc72d41f7312cc48808d699d204fba checks 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 valid paths target.

The bundled generate_rank_input.py scope resolver later rejects the same node because it explicitly requires is_dir() or is_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 raises InvalidTargetError during local target validation.

Tests / validation

Added path-target-special-files.test.ts:

  • POSIX regression creates a real Unix-domain socket inside the repository and requires normalizeTarget() to reject it;
  • a control verifies ordinary file and directory targets still normalize normally.

The branch is based directly on current upstream main at 37bf87a692fc72d41f7312cc48808d699d204fba and 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.

@github-actions github-actions Bot added the bug Something isn't working label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path-target preflight accepts special files that scan setup later rejects

1 participant