Skip to content

Reference

Sandbox and security

Where the code agents write runs, what it can reach, and how to deploy Artiwright safely.

Sandbox and security.md

Agents build documents by writing code (artiwright_run). That code runs in a sandbox: a separate Node.js process per active session, started with Node’s permission model.

The sandbox contains mistakes in code an AI writes, such as writing outside the session or running for ever, and makes abuse harder. Don’t rely on it alone against someone deliberately attacking it: Node.js documents its permission model as a seat belt rather than a guarantee against malicious code, and the network is turned off in JavaScript, not by the operating system. When users you don’t trust send files or prompts, add the setup for untrusted input around it.

Boundary In the sandbox
Files Reads only Artiwright’s own packages and the session folder; writes only the session folder
Processes and threads Denied: no child processes, worker threads or inspector
Native code No native addon loads after start-up (the renderer’s loads before any agent code runs)
Network Turned off in JavaScript: outbound connections, listening, DNS queries and UDP (fetch, http and https, net, tls, dgram, dns)
Environment Empty apart from three settings: no keys or tokens from the server
Time and memory Stopped after 60 seconds, and the call changes nothing; 1 GB of memory per process
Failures A crash or timeout replaces the process; the saved document is untouched

A session’s first call that needs the document (a run, or opening, drawing or checking it) starts its process, in about a second; later calls reuse it.

  • ARTIWRIGHT_SANDBOX=off (or sandbox=False in Python) runs agent code, and the reading and drawing of files, inside the server process. Use it only on your own machine, with agents you trust.
  • Over HTTP the server doesn’t open files by path on a client’s behalf; clients send a file’s contents.
  • Files are limited to 300 MB, and a file that unzips to far more than its size (a zip bomb) is refused. Engine calls time out after two minutes.
  • A file you open is read, laid out, drawn and checked in its session’s sandbox process too (artiwright_open, inspect, render, lint, apply and finalize), so the fonts and pictures inside it are parsed there, never in the server process. These calls stop after 5 minutes.
  • A file from elsewhere can link to outside resources, such as a picture on a network share that loads when the file opens. Artiwright keeps them as they were, and artiwright_finalize lists each one as a warning so the agent can remove it or keep it knowingly.
  • A local server (stdio, as desktop apps run it) saves finished files with artiwright_finalize into your working folder or any path you name that your account can write, and never overwrites a file. Over HTTP, finished files stay in the session’s outputs folder.

For untrusted users or several tenants, run the server in the container image with the operating system doing the isolating:

  • Run it as the image’s non-root user, with no outbound network, a read-only root filesystem (a volume for sessions and a tmpfs for /tmp), all Linux capabilities dropped and no-new-privileges.
  • Use a long random ARTIWRIGHT_MCP_TOKEN kept in a secret store (the server won’t listen beyond localhost without one), and serve it behind HTTPS.
  • Keep the sandbox on. Keep each tenant’s sessions in a separate folder, or a separate server.
  • Delete old sessions on a schedule.
  • Keep Artiwright up to date.

Artiwright runs where you run it. Documents stay in the sessions folder you choose, and Artiwright sends nothing anywhere: no telemetry, no usage reports. The only download is the Python package fetching its own JavaScript dependencies from npm on first use (or when you run artiwright-setup). Your model provider sees what your agent sends it, as with any other tool.