Skip to content

Prevent where command from following symlinks out of repo#188

Merged
andrew merged 1 commit into
mainfrom
fix/where-symlink
May 2, 2026
Merged

Prevent where command from following symlinks out of repo#188
andrew merged 1 commit into
mainfrom
fix/where-symlink

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 2, 2026

`searchFileForPackage` used `os.Open` with an absolute path, which follows symlinks. A symlink named like a manifest file (e.g. `package-lock.json`) could point outside the repository and leak matching lines.

Uses `os.Root` scoped to the working directory so the kernel rejects any path that resolves outside the repo boundary. Same approach as PR #174.

searchFileForPackage used os.Open with an absolute path, which follows
symlinks. A symlink named like a manifest file could point outside the
repository and leak file contents. Uses os.Root scoped to the working
directory so the kernel rejects any path that resolves outside the repo.
@andrew andrew merged commit 5b1a216 into main May 2, 2026
4 checks passed
@andrew andrew deleted the fix/where-symlink branch May 2, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant