
Product
Unify Your Security Stack with Socket Basics
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
@agoric/xsnap
Advanced tools
Snapshotting VM worker based on Moddable's XS Javascript engine
Xsnap is a utility for taking resumable snapshots of a running JavaScript worker, using Moddable’s XS JavaScript engine.
Xsnap provides a Node.js API for controlling Xsnap workers.
const worker = await xsnap();
await worker.evaluate(`
// Incrementer, running on XS.
function handleCommand(message) {
const number = parseInt(new TextDecoder().decode(message), 10);
return new TextEncoder().encode(`${number + 1}`).buffer;
}
`);
await fs.writeFile('bootstrap.xss', worker.makeSnapshotStream());
await worker.close();
Some time later, possibly on a different computer…
const decoder = new TextDecoder();
const worker = await xsnap({
snapshotStream: fs.createFileStream('bootstrap.xss'),
});
const response = await worker.issueCommand('1');
console.log(decoder.decode(response)); // 2
await worker.close();
The parent and child communicate using "commands".
issueCommand
function to send a request
and receive as response from the Node.js parent.handleCommand
function to respond
to commands from the Node.js parent.
handleCommand
may be asynchronous after a fashion: it
may return an object and, before the promise queue becomes empty,
set the result
property of this object to an ArrayBuffer
.
See the evaluate and report test for an example.issueCommand
method to send a
request and receive a response from the XS child.handleCommand
function to
respond to commands from the XS child.FAQs
Snapshotting VM worker based on Moddable's XS Javascript engine
We found that @agoric/xsnap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 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.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.
Research
/Security News
The Socket Threat Research Team uncovered a coordinated campaign that floods the Chrome Web Store with 131 rebranded clones of a WhatsApp Web automation extension to spam Brazilian users.