Skip to content

[bug] ix text resolves --path outside --root and can search outside the workspace #542

Description

@Hiro-Chiba

Description

ix text --root <workspace> --path <relative-path> resolves the path from the process working directory instead of from --root. An absolute --path outside the workspace is also accepted, so the command can search files outside the selected workspace.

Steps to reproduce

  1. Create /tmp/ix-fixture/src/example.ts containing a unique term.
  2. Change to a different directory.
  3. Run ix text <term> --root /tmp/ix-fixture --path src --format json.
  4. Run ix text localhost --root /tmp/ix-fixture --path /etc --format json.

Expected behavior

Relative paths are resolved from --root. Paths that escape the selected workspace, including symlink escapes, return a structured error and a non-zero exit status.

Actual behavior

The relative path is resolved from the current directory. Absolute paths outside the workspace are searched successfully with exit status 0.

CLI output

The first command searches the wrong src directory. The second can return matches from /etc.

Environment

  • OS: macOS
  • Node: 22.x
  • Ix version: 0.10.5 and current main (3baa7dc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions