
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@ws-kit/rate-limit
Advanced tools
Token-bucket rate limiting for WS-Kit with pluggable backends and ready-to-use key functions.
npm install @ws-kit/rate-limit @ws-kit/memory @ws-kit/core
import { createRouter } from "@ws-kit/core";
import { rateLimit, keyPerUserPerType } from "@ws-kit/rate-limit";
import { memoryRateLimiter } from "@ws-kit/memory";
const limiter = memoryRateLimiter({ capacity: 100, tokensPerSecond: 10 });
const router = createRouter().use(
rateLimit({
limiter,
key: keyPerUserPerType, // rl:tenant:user:type
cost: () => 1,
}),
);
@ws-kit/memory) — Single-process dev/test. Zero dependencies. Optional prefix to isolate policies sharing a backend.@ws-kit/redis) — Distributed, atomic via Lua and server clock. Use when running multiple pods/servers.keyPerUserPerType (default): per-user, per-message-type fairness.keyPerUser: single bucket per user (lighter memory).key: (ctx) => "rl:tenant:user:type"; include tenant/user/type as needed.cost: weight expensive operations (return ctx.type === "Compute" ? 10 : 1)."anon", so guests share one bucket; use a custom key with IP/session when you need per-guest isolation.interface RateLimitPolicy {
capacity: number; // max tokens
tokensPerSecond: number; // refill rate
prefix?: string; // optional key namespace
}
consume() returns { allowed: boolean; remaining: number; retryAfterMs: number | null; }. retryAfterMs is null when cost exceeds capacity.
memoryRateLimiter() for deterministic tests.FAQs
Token-bucket rate limiting middleware for WS-Kit
We found that @ws-kit/rate-limit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.