# @unrs/resolver-binding-wasm32-wasi@1.12.2 security report (npm)

- Verdict: **Needs review** (risk level: medium)
- Scanned: 2026-10-06T14:13:44.000Z
- Files reviewed: 4
- Findings: 1 high, 7 medium, 4 low severity findings
- Report: https://security.togoder.click/npm/@unrs/resolver-binding-wasm32-wasi
- Source: Togoder Security (https://security.togoder.click), AI source-code review

## Summary

Togoder Security scanned the npm package @unrs/resolver-binding-wasm32-wasi@1.12.2 on Oct 6, 2026. An AI review of 4 source files produced 1 high, 7 medium, 4 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

### [high] Excessive filesystem preopens

Finding ID: `NPS-3DF5870E0ACE`

File: `wasi-worker.mjs:34`

The WASI instance is configured with preopens mapping the root directory (`__rootDir`) to itself. This gives the WASM module unrestricted access to the entire filesystem, far beyond what is typically necessary, enabling potential data theft or tampering.

### [medium] Environment variable access

Finding ID: `NPS-3710ADF6A049`

File: `resolver.wasi.cjs:21`

The code passes process.env directly to the WASI environment (env: process.env) and to worker threads (env: process.env), potentially exposing all environment variables to the WASM runtime and worker threads. This could leak sensitive environment variables if the WASM module or worker code is compromised.

### [medium] Broad filesystem preopens

Finding ID: `NPS-155BA35E917E`

File: `resolver.wasi.cjs:23`

The WASI instance is configured with preopens mapping the filesystem root (/) to itself ([__rootDir]: __rootDir), granting the WASM module full filesystem access. This violates the principle of least privilege and could allow malicious WASM code to read or write any file on the system.

### [medium] Dynamic code execution via WebAssembly

Finding ID: `NPS-60F7BF02A52E`

File: `resolver.wasi.cjs:39`

The module loads and instantiates WebAssembly code from a file (resolver.wasm32-wasi.wasm) that is read at runtime. While this is typical for NAPI-RS WASM bindings, the WASM binary is not verified or integrity-checked, so if the file is tampered with, arbitrary native-like code could execute with the above permissions.

### [medium] Broad filesystem access

Finding ID: `NPS-995722DFCBE4`

File: `wasi-worker-browser.mjs:13`

The WASI preopens configuration maps the root directory '/' to itself, granting the WebAssembly instance access to the entire container filesystem. While the actual host filesystem access is limited by the browser environment and memfs proxy, this broad preopen could allow the WASM module to read or write files outside the package scope if the runtime environment permits it.

### [medium] Dynamic code execution via eval

Finding ID: `NPS-697819FBCACD`

File: `wasi-worker.mjs:17`

The importScripts function uses `(0, eval)(...)` to evaluate arbitrary code read from a file path. If a malicious actor can influence the filename passed to importScripts, this could lead to arbitrary code execution in the worker context.

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

Finding ID: `NPS-80D48E562583`

File: `wasi-worker.mjs:17`

The `importScripts` function reads a file from an arbitrary path and evals it. The path is provided by the caller (e.g., via postMessage from the parent thread). This could be exploited if the parent thread or another attacker controls the message payload.

### [medium] Environment variable exposure

Finding ID: `NPS-93A3FC708B66`

File: `wasi-worker.mjs:32`

All process environment variables (`process.env`) are passed to the WASI instance, potentially leaking sensitive secrets (API keys, tokens) into the sandboxed WASM module.

### [low] Worker thread with inherited environment

Finding ID: `NPS-A855C8B1751B`

File: `resolver.wasi.cjs:68`

Worker threads are spawned with env: process.env, giving them access to all environment variables. Combined with the broad filesystem preopens, this increases the attack surface if the worker code is malicious.

### [low] Node.js internal handle manipulation

Finding ID: `NPS-3E7B4E9B29FD`

File: `resolver.wasi.cjs:78`

The code uses Object.getOwnPropertySymbols to find internal worker symbols (kPublicPort, kHandle) and overwrites their ref methods to prevent the worker from keeping the event loop alive. This is a hack that relies on undocumented Node.js internals and could be used to hide active worker threads, though in this context it appears to be a workaround for Rust thread management.

### [low] Dynamic code loading

Finding ID: `NPS-683F7481CE90`

File: `wasi-worker-browser.mjs:17`

The code instantiates a WebAssembly module from a message-provided wasmModule. If an attacker can control the message source, they could supply a malicious WASM binary for execution. However, in typical usage this is expected behavior for a WASM worker.

### [low] Unvalidated message handling

Finding ID: `NPS-C53D6E1C7C87`

File: `wasi-worker-browser.mjs:32`

The global onmessage handler directly passes incoming postMessage events to the MessageHandler without origin validation. This could enable cross-origin or malicious messages to trigger WASM module loading or interaction if the worker is embedded in an untrusted context.

## Files reviewed

- `resolver.wasi.cjs` (medium): The file appears to be a legitimate NAPI-RS generated WASI loader, but it grants broad filesystem access and exposes all environment variables to WASM and worker threads, which could be risky if the WASM binary is compromised.
- `wasi-worker-browser.mjs` (medium): This is a standard WASI worker for running WebAssembly modules with N-API bindings; it uses broad filesystem preopens and unvalidated message handling but contains no clear malicious exfiltration, credential theft, or obfuscation patterns.
- `wasi-worker.mjs` (medium): The WASI worker exposes dangerous eval-based script loading and grants full filesystem and environment access to a WASM module, creating potential security risks if misused or if message inputs are untrusted.
- `resolver.wasi-browser.js` (safe): No malicious patterns detected; the file is a standard WebAssembly/NAPI browser runtime loader for a resolver module.

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