Skip to content

test: add symlink-escape tests for go.sum and npm-shrinkwrap.json#2324

Open
ZeroX-404 wants to merge 2 commits into
google:mainfrom
ZeroX-404:test/symlink-escape-gosum-shrinkwrap
Open

test: add symlink-escape tests for go.sum and npm-shrinkwrap.json#2324
ZeroX-404 wants to merge 2 commits into
google:mainfrom
ZeroX-404:test/symlink-escape-gosum-shrinkwrap

Conversation

@ZeroX-404

Copy link
Copy Markdown

This PR adds two integration tests that demonstrate symlink escape via os.DirFS in the go.sum and npm-shrinkwrap.json extractors.

These tests follow the same pattern as the confirmed bug in requirements.txt (issue #2323): a symlink placed inside the scanned directory, pointing to a file outside the scan root, is followed by os.DirFS.Open(), causing the scanner to read and parse a file that should be out of scope.

  • TestGoSumSymlinkEscape: creates go.sum as a symlink to a file outside the root. The scanner reads it and the package appears in the JSON output.
  • TestNpmShrinkwrapSymlinkEscape: same approach with npm-shrinkwrap.json and a valid package-lock.json stub.

These tests will fail until a fix (such as the os.Root approach in PR #2028) is applied to all file-opening paths in the extractors.

Ref: #2323, #2028, #2003

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