# thread-stream@3.2.0 security report (npm)

- Verdict: **Needs review** (risk level: medium)
- Scanned: 2026-10-04T21:18:00.000Z
- Files reviewed: 5
- Findings: 5 medium, 2 low severity findings
- Report: https://security.togoder.click/npm/thread-stream
- Source: Togoder Security (https://security.togoder.click), AI source-code review

## Summary

Togoder Security scanned the npm package thread-stream@3.2.0 on Oct 4, 2026. An AI review of 5 source files produced 5 medium, 2 low severity findings. The overall verdict is medium: the findings flag risky but common patterns (dynamic code, unsafe defaults, broad file or network access) rather than confirmed malware.

## Findings

### [medium] dynamic module loading

Finding ID: `NPS-6B9FC4DDC5CF`

File: `index.js:47`

The createWorker function constructs a Worker thread path using a global override ('__bundlerPathsOverrides') that can replace the thread-stream-worker path. If an attacker can influence globalThis.__bundlerPathsOverrides (e.g., via prototype pollution or bundler config injection), arbitrary code could be executed in a worker thread. However, this is a legitimate feature for bundlers and not inherently malicious.

### [medium] worker thread dynamic execution

Finding ID: `NPS-BC4A672C854B`

File: `index.js:50`

The Worker is instantiated with a file path derived from 'join(__dirname, 'lib', 'worker.js')' or an overridden path. While the default path is safe, the override mechanism introduces a potential risk for code execution if the global override is controlled by an attacker.

### [medium] Dynamic module loading with computed input

Finding ID: `NPS-4DEBE496CA95`

File: `lib/worker.js:30`

The code dynamically loads a module from a filename provided via workerData using realImport and realRequire. The filename is decoded and passed directly to the module loader, which could execute arbitrary code if an attacker can control the workerData filename.

### [medium] Dynamic module loading with computed input

Finding ID: `NPS-5F9C9F5E8A9F`

File: `lib/worker.js:43`

Similar dynamic loading using realRequire with a decoded filename in the catch block. This further increases the risk of arbitrary code execution from external input.

### [medium] Dynamic module loading with computed input

Finding ID: `NPS-B3E349AA1C4D`

File: `lib/worker.js:50`

Fallback dynamic loading using realRequire with a decoded filename when import fails with specific errors. Again, this allows execution of arbitrary code from the provided filename.

### [low] no obvious malicious patterns

Finding ID: `NPS-AA49ED892A39`

File: `index.js`

No data exfiltration, credential harvesting, obfuscation, dynamic eval, process spawning, or file system manipulation outside package scope was detected. The code appears to be a legitimate implementation of a thread-based stream (thread-stream).

### [low] shared array buffer usage

Finding ID: `NPS-0D50EF428E89`

File: `index.js:102`

Uses SharedArrayBuffer and Atomics for inter-thread communication, which is a legitimate performance feature but could be exploited for side-channel attacks if untrusted code runs in the same process. Not malicious by itself.

## Files reviewed

- `index.js` (medium): The code is a legitimate thread-stream implementation with a potential risk from a global override for worker path, but no malicious patterns were detected.
- `lib/worker.js` (medium): The code dynamically loads and executes modules based on a filename from workerData, which could be exploited for arbitrary code execution if an attacker controls the input.
- `bench.js` (safe): No malicious patterns detected
- `lib/indexes.js` (safe): Cleared by Jev triage; no further analysis needed
- `lib/wait.js` (safe): Cleared by Jev triage; no further analysis needed

## Version ranges

None of the 2 scanned versions of thread-stream are flagged high or critical. The latest scanned version, 4.0.0, is not scanned. Only versions we have scanned are listed; unscanned versions between them are not covered.

- 4.0.0 (`4.0.0`): not scanned
- 3.2.0 (`3.2.0`): medium (dynamic module loading +2 more)
- 3.1.0 (`3.1.0`): not scanned
- 0.15.2 (`0.15.2`): medium

## Scanned versions

- [3.2.0](https://security.togoder.click/npm/thread-stream@3.2.0): medium, 2026-10-04T21:18:00.000Z
- [0.15.2](https://security.togoder.click/npm/thread-stream@0.15.2): medium, 2026-10-04T16:41:17.000Z

AI analysis is guidance, not a guarantee. Methodology: https://security.togoder.click/methodology
