Summary
Togoder Security scanned the npm package ws@8.17.1 on Oct 4, 2026. An AI review of 16 source files produced 2 low severity findings. No malicious behavior, install-time payloads, credential theft or exfiltration were identified.
Findings 2
Environment variable read
NPS-177B453C4A86
Reads process.env.WS_NO_UTF_8_VALIDATE to allow users to opt out of using the optional native utf-8-validate module. This is a benign configuration toggle and does not harvest or exfiltrate credentials.
Dynamic module loading (optional dependency)
NPS-0C5438080EBE
The code attempts to require('utf-8-validate') inside a try/catch as an optional performance optimization for UTF-8 validation. This is a common pattern in the widely-used 'ws' WebSocket library and falls back to a built-in implementation if the module is unavailable. The module name is hardcoded, not computed from external input, and is only loaded when process.env.WS_NO_UTF_8_VALIDATE is not set.
Files reviewed
| File | Verdict | What the reviewer saw |
|---|---|---|
| browser.js | safe | Cleared by Jev triage; no further analysis needed |
| index.js | safe | Cleared by Jev triage; no further analysis needed |
| lib/buffer-util.js | safe | This is a standard buffer utility module from the ws WebSocket library with no malicious patterns detected. |
| lib/constants.js | safe | Cleared by Jev triage; no further analysis needed |
| lib/event-target.js | safe | No malicious patterns detected; the file implements standard Event, CloseEvent, ErrorEvent, MessageEvent, and EventTarget classes with no external network, file system, process, or dynamic code execution activity. |
| lib/extension.js | safe | Cleared by Jev triage; no further analysis needed |
| lib/limiter.js | safe | Cleared by Jev triage; no further analysis needed |
| lib/permessage-deflate.js | safe | This is a legitimate permessage-deflate implementation for the 'ws' WebSocket library, containing only standard zlib compression/decompression logic with no malicious patterns such as data exfiltration, credential harvesting, dynamic code execution, or suspicious network/process activity. |
| lib/receiver.js | safe | No malicious patterns detected; this is a standard WebSocket frame receiver implementation from the ws library. |
| lib/sender.js | safe | No malicious patterns detected; the code is a standard WebSocket frame sender implementation from the ws library. |
| lib/stream.js | safe | No malicious patterns detected |
| lib/subprotocol.js | safe | Cleared by Jev triage; no further analysis needed |
| lib/validation.js | safe | This is a standard UTF-8 and status code validation module (appearing to be lib/validation.js from the ws WebSocket library) with no malicious behavior; the only noteworthy patterns are a benign env-var toggle and an optional native module load with a safe fallback. |
| lib/websocket-server.js | safe | No malicious patterns detected |
| lib/websocket.js | safe | No malicious patterns detected; this is the standard 'ws' WebSocket client library implementation with only legitimate networking, crypto, and stream handling code. |
| wrapper.mjs | safe | Cleared by Jev triage; no further analysis needed |
Affected version ranges
None of the 5 scanned versions of ws are flagged high or critical. The latest scanned version, 8.21.3, is not scanned. Only versions we have scanned are listed; unscanned versions between them are not covered.
| Versions | Verdict | Count | Range | Top findings |
|---|---|---|---|---|
| 8.21.0 – 8.21.3 | Not scanned | 2 | >=8.21.0 <=8.21.3 | |
| 7.5.13 – 8.18.3 | No issues | 4 | >=7.5.13 <=8.18.3 | |
| 7.5.11 | Not scanned | 1 | 7.5.11 | |
| 7.5.10 | No issues | 1 | 7.5.10 | |
| 6.2.4 | Not scanned | 1 | 6.2.4 |
Full list, including published versions not scanned yet: version ranges API.
Scanned versions of ws
Frequently asked questions
Is ws safe to use?
Our AI source review of ws@8.17.1 found no malicious code: no install-time payloads, credential theft, exfiltration, obfuscated loaders or backdoors.
Does ws contain malware?
No malware was identified in ws@8.17.1 when Togoder Security scanned it on Oct 4, 2026. A new version can still introduce malicious code, so scan the exact versions in your lockfile.
How was ws checked?
Togoder Security downloaded the published npm package and had an AI model read its 16 source files, looking for install scripts, credential access, network exfiltration, obfuscation, backdoors and crypto-wallet theft. The results are cached by file hash and shown here.
How do I scan ws together with the rest of my dependencies?
Upload your lockfile at https://security.togoder.click/scan or call the API documented at https://security.togoder.click/api-docs. Files that have already been scanned, like the ones in ws@8.17.1, cost nothing.