
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
High-performance, security-hardened JavaScript sandbox for executing untrusted code with worker pooling, script caching, and resource limits
🔒 Secure, high-performance JavaScript sandbox for executing untrusted code safely.
npm install runframe
Always use the latest version of runframe (v2.2.0)
The latest version includes critical security updates:
Older versions may be vulnerable to sandbox escapes. Update immediately with:
npm install runframe@latest
import { createSandbox } from 'runframe';
const sandbox = createSandbox({
cpuMs: 5000, // 5 second timeout
memoryMb: 128 // 128MB memory limit
});
const result = await sandbox.run('1 + 2 + 3');
console.log(result); // { type: 'result', result: 6 }
const sandbox = createSandbox({
cpuMs: 5000,
memoryMb: 128,
globals: {
PI: 3.14159,
add: (a, b) => a + b
}
});
const result = await sandbox.run('PI + add(2, 3)');
// { type: 'result', result: 8.14159 }
const sandbox = createSandbox({
cpuMs: 5000,
memoryMb: 128,
allowedModules: ['crypto', 'path']
});
const result = await sandbox.run(`
const crypto = require('crypto');
crypto.randomBytes(16).toString('hex');
`);
const sandbox = createSandbox({
cpuMs: 5000,
memoryMb: 128
});
sandbox.hooks.on('before', (ctx) => {
console.log('Started:', ctx.executionId);
});
sandbox.hooks.on('after', (ctx) => {
console.log('Duration:', ctx.duration, 'ms');
});
sandbox.hooks.on('error', (ctx) => {
console.error('Error:', ctx.error);
});
await sandbox.run('1 + 1');
createSandbox(options)Creates a new sandbox instance.
Options:
cpuMs (number): Execution timeout in millisecondsmemoryMb (number): Memory limit in MBglobals (object, optional): Custom global variablesallowedModules (array, optional): Whitelisted modules ['crypto', 'path', 'util', 'os', 'url']seed (number, optional): Random seed for deterministic resultsReturns: { run(code): Promise<result> }
sandbox.run(code)Executes code in the sandbox.
Parameters:
code (string): JavaScript code to executeReturns: Promise that resolves with { type: 'result', result: any, stats: {...} } or { type: 'error', error: string }
sandbox.hooks.on(event, handler)Listen to execution events.
Events:
'before' - Code started'after' - Code finished'error' - Execution error'console' - Console output (log, error, etc)✅ Blocks dangerous operations:
eval() or Function() constructorrequire() or file system accessprocess object✅ Code integrity verification
✅ 32+ security tests pass
const sandbox = createSandbox({
cpuMs: 1000,
memoryMb: 64,
globals: { username: 'John', score: 100 }
});
const template = `\`Hello \${username}, your score is \${score}\``;
const result = await sandbox.run(template);
const sandbox = createSandbox({
cpuMs: 5000,
memoryMb: 256,
allowedModules: ['crypto']
});
const code = `
const crypto = require('crypto');
const hash = crypto.createHash('sha256');
hash.update('test');
hash.digest('hex');
`;
const result = await sandbox.run(code);
const sandbox = createSandbox({
cpuMs: 500,
memoryMb: 64,
globals: { Math }
});
const expr = '2 * Math.PI * 5'; // Circumference
const result = await sandbox.run(expr);
try {
const result = await sandbox.run('throw new Error("test")');
} catch (err) {
console.error('Sandbox error:', err.message);
}
import { createWorkerPool } from 'runframe/pool';
const pool = createWorkerPool({ size: 4 });
const results = await Promise.all([
pool.run('1 + 1'),
pool.run('2 + 2'),
pool.run('3 + 3')
]);
import { createScriptCache } from 'runframe/cache';
const cache = createScriptCache();
const sandbox = createSandbox({ cpuMs: 5000, memoryMb: 128 });
const compiled = cache.compile('1 + 2 + 3');
const result = await sandbox.run(compiled);
const sandbox = createSandbox({
cpuMs: 5000,
memoryMb: 128,
seed: 12345 // Same seed = same Math.random() output
});
const result = await sandbox.run('Math.random()');
// Always returns same value with same seed
constructor.constructor escapesprocess object completely blockedeval() and Function() constructor blockedRunframe protects against:
Testing: 32 security tests verify protection against 90+ attack vectors
Optimizations: Worker pooling, script caching, deterministic execution
Benchmarks:
Limits: CPU 100ms-60s, Memory 16MB-4096MB
const sandbox = createSandbox({ cpuMs: 1000, memoryMb: 64 });
const result = await sandbox.run('Math.sqrt(16)');
const sandbox = createSandbox({
cpuMs: 1000,
memoryMb: 64,
globals: { user: 'Alice', count: 5 }
});
const result = await sandbox.run('`User ${user} has ${count} items`');
const sandbox = createSandbox({
cpuMs: 500,
memoryMb: 64,
globals: {
isEmail: (s) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)
}
});
const result = await sandbox.run('isEmail("test@example.com")');
const sandbox = createSandbox({
cpuMs: 5000,
memoryMb: 128,
allowedModules: ['crypto']
});
const code = `
const crypto = require('crypto');
crypto.createHash('sha256').update('data').digest('hex');
`;
const result = await sandbox.run(code);
runframe is a production-grade JavaScript sandbox built for security-first applications. It's designed to safely execute untrusted code with minimal risk.
MIT
Package: runframe v2.1.0
Maintained: December 2025
Security Status: ✅ Verified and Protected
FAQs
High-performance, security-hardened JavaScript sandbox for executing untrusted code with worker pooling, script caching, and resource limits
We found that runframe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.