Skip to content

Conversation

@chakra-guy
Copy link
Collaborator

@chakra-guy chakra-guy commented Jan 12, 2026

Summary

Adds a new apps/load-tests package with a local load test runner for validating the relay server's WebSocket connection handling.

Features

  • Two test scenarios:

    • connection-storm: Rapid connection establishment (tests throughput)
    • steady-state: Connect and hold for duration (tests stability)
  • Rich output:

    • Real-time progress bar with connection status
    • Connection time percentiles (p50, p95, p99)
    • Success rate, retries, and stability metrics
    • JSON output for automated analysis

Usage

cd apps/load-tests

Run against local Docker Compose

yarn start --target=ws://localhost:8000/connection/websocket --scenario=steady-state --connections=100 --duration=60

Run against production

yarn start --target=wss://mm-sdk-relay.api.cx.metamask.io/connection/websocket --scenario=connection-storm --connections=500 --ramp-up=10 --output=results/test.json

Screenshot 2026-01-12 at 12 03 02 Screenshot 2026-01-12 at 12 05 14

Note

Adds a new apps/load-tests package to run local WebSocket load tests against a Centrifugo relay.

  • CLI start command executes connection-storm and steady-state scenarios with ramp-up/hold, using a CentrifugeClient wrapper and progress bars
  • Outputs formatted console summary (success rate, retries, connect-time percentiles) and optional JSON via writer
  • Includes scaffolding for infra/results commands (infra, results stubs), .env.example, and ignores results/
  • Minor config: broaden .gitignore for **/*.tsbuildinfo; update root LavaMoat allowScripts for tsx>esbuild

Written by Cursor Bugbot for commit 1c54b83. This will update automatically on new commits. Configure here.

Adds a new load testing package with two scenarios:
- connection-storm: Rapid connection establishment testing
- steady-state: Connection stability over time

Usage:
  yarn start --target=ws://localhost:8000/connection/websocket --scenario=steady-state --connections=100 --duration=60

Features:
- Centrifuge WebSocket client wrapper with timing
- Progress bar with real-time connection status
- JSON output with latency percentiles
- Configurable ramp-up pacing

Note: Infrastructure commands (infra, results aggregate) are placeholders
for the follow-up distributed testing PR.
- Rename 'latency' to 'connectTime' for clarity
  (measures connection establishment time, NOT message RTT)
- Add p50 and p99 percentiles to connectTime stats
- Fix connectionStability comment to accurately describe what it measures
  (percentage connected at end, not 'stayed connected the whole time')
- Add temp/ to gitignore for working documents
- Update lavamoat config for tsx>esbuild
@socket-security
Copy link

socket-security bot commented Jan 12, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​types/​cli-progress@​3.11.61001007280100
Added@​types/​ssh2@​1.15.51001007781100
Addedcli-progress@​3.12.010010010080100
Addedssh2@​1.17.09310010081100
Addedtsx@​4.21.01001008187100
Addedchalk@​5.6.210010010082100
Addedcommander@​13.1.010010010084100

View full report

@socket-security
Copy link

socket-security bot commented Jan 12, 2026

Warning

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Warn Low
Potential code anomaly (AI signal): npm esbuild is 100.0% likely to have a medium risk anomaly

Notes: On its face this package.json looks like the legitimate esbuild package layout: it runs a local install.js during postinstall and defines many optional platform-specific packages. The main risk is that the uninspected install.js may perform arbitrary, privileged actions (download remote binaries, execute code, add hooks, exfiltrate data, etc.). You should audit the contents of install.js (and any code it downloads or executes) before trusting installation in sensitive environments. The package.json itself does not contain obvious malicious indicators (no http:// deps, no non-registry dependency URLs, no overrides), but the postinstall hook makes it potentially risky.

Confidence: 1.00

Severity: 0.60

From: ?npm/tsx@4.21.0npm/esbuild@0.27.2

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/esbuild@0.27.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm tsx is 100.0% likely to have a medium risk anomaly

Notes: This fragment appears to be a bundler-generated bootstrap/initialization piece that imports many modules and executes an initialization function (r). No explicit malicious activity is evident within this fragment itself, but the risk stems from side effects of the imported modules on load. A careful review of the implementations of the imported modules (especially those exporting r and those performing initialization, build-time, or network/file operations) is recommended to rule out hidden telemetry, backdoors, or undesired side effects.

Confidence: 1.00

Severity: 0.60

From: apps/load-tests/package.jsonnpm/tsx@4.21.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tsx@4.21.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm tsx is 100.0% likely to have a medium risk anomaly

Notes: No clear indicators of classic malware (no reverse shell, no network connections, no child_process usage, no hard-coded credentials). The primary risk is information leakage: the loader posts module load events and dependency paths to external consumers via p.port and O.send. In contexts where those channels are controlled by an untrusted or remote party, this could leak local file paths or project structure. The module otherwise performs expected loader duties (file reads, tsconfig handling, transforming CJS to ESM, returning data: URLs). Review runtime consumers of O and any provided p.port to ensure they are trusted before using this loader in a sensitive environment.

Confidence: 1.00

Severity: 0.60

From: apps/load-tests/package.jsonnpm/tsx@4.21.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tsx@4.21.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm tsx is 100.0% likely to have a medium risk anomaly

Notes: This module installs signal handlers and actively hides them from inspection by monkeypatching listener inspection APIs. In the main thread it can forward SIGINT/SIGTERM events to a remote client (via client.connectingToServer) and may exit the process after forwarding. The concealment is a noteworthy red flag: it makes detection and auditing harder and may be used to implement covert telemetry or control. The file alone is not conclusively malicious, but the combination of hiding handlers and forwarding signals to an external component warrants careful review of the client module (client-D6NvIMSC.cjs) and any network destinations it uses before trusting this package in sensitive environments.

Confidence: 1.00

Severity: 0.60

From: apps/load-tests/package.jsonnpm/tsx@4.21.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tsx@4.21.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm tsx is 100.0% likely to have a medium risk anomaly

Notes: The module installs hidden signal handlers for SIGINT and SIGTERM, hides them from other code by monkey-patching process.listenerCount and process.listeners, forwards signals to an external client callback, and may force exit. That stealthy interception of process signals is suspicious from a supply-chain/security perspective because it can be used to intercept or suppress normal shutdown behavior and to forward events to another module which may perform network I/O or exfiltration. There is no direct evidence in this file of data exfiltration, reverse shell, or explicit malicious payload, but the hiding behavior and delegation to an external client warrant caution and further inspection of the imported client and cjs modules. Recommend auditing the client callback and cjs/index.cjs for network operations or data-leaking behavior before trusting this package.

Confidence: 1.00

Severity: 0.60

From: apps/load-tests/package.jsonnpm/tsx@4.21.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tsx@4.21.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Ignoring alerts on:

  • asn1@0.2.6
  • cpu-features@0.0.10
  • ssh2@1.17.0
  • buildcheck@0.0.7

View full report

…ck overflow

Since the array is already sorted ascending, use sorted[0] for min and
sorted[sorted.length - 1] for max instead of Math.min/max(...sorted).
This prevents RangeError: Maximum call stack size exceeded when
testing with >65K connections.
@chakra-guy
Copy link
Collaborator Author

These alerts are for packages used exclusively in apps/load-tests/, which is an internal load testing CLI tool that is:

  1. Not published to npm - This is a private app ("private": true in package.json) used only for internal infrastructure testing
  2. Requires explicit opt-in - Only runs when developers manually invoke the CLI with DigitalOcean credentials

The flagged packages are expected dependencies for SSH-based infrastructure management:

@SocketSecurity ignore npm/ssh2@1.17.0

@SocketSecurity ignore npm/buildcheck@0.0.7

@SocketSecurity ignore npm/cpu-features

@SocketSecurity ignore npm/asn1

@chakra-guy
Copy link
Collaborator Author

@SocketSecurity ignore npm/ssh2@1.17.0

@chakra-guy
Copy link
Collaborator Author

@SocketSecurity ignore npm/buildcheck@0.0.7

@chakra-guy
Copy link
Collaborator Author

chakra-guy commented Jan 12, 2026

@SocketSecurity ignore npm/cpu-features@0.0.10

@chakra-guy
Copy link
Collaborator Author

chakra-guy commented Jan 12, 2026

@SocketSecurity ignore npm/asn1@0.2.6

@chakra-guy chakra-guy requested a review from a team January 12, 2026 15:18
jiexi
jiexi previously approved these changes Jan 12, 2026
- Remove .gitkeep, results/ dir is created programmatically
- Remove redundant .infra-state.json ignore (already covered by results/)
- Simplify .tsbuildinfo pattern to **/*.tsbuildinfo
@chakra-guy chakra-guy merged commit 1cddfac into main Jan 15, 2026
12 checks passed
@chakra-guy chakra-guy deleted the ts/load-testing-scaffolding branch January 15, 2026 09:26
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.

3 participants