Skip to content

chore(deps): update tmp to 0.2.7 and drop the unused glob dependency - #257

Open
lifeiswilde wants to merge 1 commit into
sourcegraph:scipfrom
lifeiswilde:deps/tmp-without-rimraf
Open

lifeiswilde wants to merge 1 commit into
sourcegraph:scipfrom
lifeiswilde:deps/tmp-without-rimraf

Conversation

@lifeiswilde

Copy link
Copy Markdown

What changes

  • packages/pyright-internal: tmp goes from ^0.2.1 to ^0.2.7 (package.json and lock).
  • packages/pyright-scip: glob is removed from dependencies (package.json and lock).

The lock diffs contain only those changes plus the "dev": true flags npm adds to the glob 7 chain, which is now reachable from dev dependencies only.

Why

Dependency scanners flag @sourcegraph/scip-python for glob 7 (GHSA-c6wh-w8c3-cv3g, glob <= 14.0.5), by two routes:

  1. dist/vendor.js is a webpack bundle that carries tmp 0.2.1 -> rimraf 3.0.2 -> glob 7 (plus minimatch, inflight, once and others), all pulled in by pyright-internal. tmp 0.2.7 has no dependencies, so the whole chain leaves the bundle.
  2. packages/pyright-scip/package.json lists glob in dependencies, so npm installs glob 7.2.3 for every consumer. Nothing under src/, test/, the webpack config, index.js or the package scripts requires it. The build/ scripts that use glob resolve it from the root devDependencies, so they are unaffected.

Reachability

The advisory's path (an absolute ignore pattern with braces in root or cwd) is not reachable in scip-python today. The bundled glob was only called by rimraf for temporary file cleanup, with no ignore, root or cwd. This change is about the scanner flag and about taking a stale dependency chain out of the bundle, not about an exploitable path.

tmp advisories

tmp 0.2.1 is also covered by two advisories that 0.2.7 fixes:

  • GHSA-52f5-9888-hmc6 (low): arbitrary temporary file or directory write through a symbolic link dir option, affects <= 0.2.3, fixed in 0.2.4.
  • GHSA-ph9p-34f9-6g65 (high): path traversal through unsanitized prefix, postfix or dir, affects < 0.2.6, fixed in 0.2.6.

scip-python only passes fixed values to tmp, so these were not reachable either.

tmp API check

tmp is used in one file, packages/pyright-internal/src/common/realFileSystem.ts. Its calls were checked against the 0.2.7 source and run against both 0.2.1 and 0.2.7:

  • tmp.setGracefulCleanup(): unchanged.
  • tmp.dirSync({ prefix: 'pyright' }): unchanged.
  • tmp.fileSync({ dir: <that directory>, discardDescriptor: true, ...options }): unchanged. tmp 0.2.4 and later require dir to resolve inside the system temp directory; the directory comes from the dirSync call above, so it does.
  • removeCallback() on the directory: behaves as before (it throws ENOTEMPTY on a non-empty directory in both versions, and dispose() already ignores that).

One observable difference: tmp 0.2.4 and later return the real path of the temp directory, so on macOS the name is /private/var/... where it was /var/....

Testing

Node 24.4.1 and Python 3.10.22 (the versions in .tool-versions), npm 11.4.2:

  • npm install at the root, then in packages/pyright-scip: npm install && npm run build (production webpack bundle).
  • npm test -- --runInBand: 7 tests passed.
  • npm run check-snapshots: 22/22 tests passed, 0 failed.
  • npm install --package-lock-only --ignore-scripts in packages/pyright-scip (the lock check in CI) leaves no diff, and node build/checkLockIndent.js passes.
  • The built dist/vendor.js.map lists no glob, rimraf, minimatch, inflight, once or wrappy sources (the published 0.6.8 map lists all of them); the 16 sources it no longer has are the glob 7 chain and rimraf.
  • The packed package.json has no glob dependency. Installing the tarball into an empty folder and running npm ls glob --all shows no glob (installing the published 0.6.8 shows glob@7.2.3), and npm audit there reports 0 vulnerabilities.
  • Indexing a small Python project with the installed tarball produces a byte-identical index to the one from the published 0.6.8.

🤖 Generated with Claude Code

tmp 0.2.7 has no dependencies, so the bundle no longer carries
tmp -> rimraf 3 -> glob 7 -> minimatch/inflight/once and friends.

glob was listed in pyright-scip's dependencies, so npm installed it for
every consumer, but nothing in src/, test/ or the webpack config requires
it. The build/ scripts that use it resolve it from the root devDependency.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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