Security
Security for comark-arrow spans sandbox isolation, upstream sandbox limits, and how you integrate with Comark's security plugin.
Run agent source only in QuickJS/WASM
Agent-authored widget source runs only inside @arrow-js/sandbox (QuickJS/WASM), not in the host page realm (R9.1). The host never evals fence bodies.
Treat isolation as a boundary, not proof
Isolation is not correctness (R9.6). A sandboxed widget can still show wrong numbers, misleading UI, or call allowed bridge APIs. Review generated widgets the way you review generated numbers or SQL.
Understand upstream sandbox limits
@arrow-js/sandbox bridges a restricted runtime:
fetch()— https only, no credentials, 15 s timeout, 1 MB response cap- Timers — available inside the sandbox
- Host cookies and DOM — unreachable from sandboxed code
Re-check upstream release notes when you upgrade @arrow-js/sandbox.
Allowlist ArrowSandbox in security()
If your Comark pipeline uses security({ allowedTags: [...] }), include ArrowSandbox in the allowlist. Without it, the security plugin may strip sandbox nodes from output.
Pin the sandbox version
Pin @arrow-js/sandbox to 1.0.6 (Early Access). Re-check the API on upgrade — bridge behavior, fetch limits, and module resolution can change between releases.
Host bridge
Expose allowlisted host functions to ArrowJS sandboxes via provideArrowHostBridge. Bridge modules never go on the AST — supply them from the app.
Static fallbacks
Render Arrow fences without booting QuickJS for HTML, PDF, email, and ANSI targets. Choose source, placeholder, or caption fallbacks and pre-bundle TypeScript in Vite.