Skip to content

Security Model

SIDHARTH SINGH edited this page Dec 3, 2026 · 1 revision

Security & SSRF Model

Multi-tenant HTML-to-PDF rendering is one of the highest-risk server features to expose carelessly because arbitrary templates and image tags execute fetches from inside the browser host. ONEX ships fail-closed by default.

Default Guardrails

  • Local files locked down: allowFileAccess: false denies file:// URLs and filesystem paths unless explicitly enabled and confined inside fileAccessRoot via symlink-safe realpathSync + path.relative.
  • Private networks & IPv6 tunneling blocked: Rejects loopback, RFC1918, CGNAT, cloud metadata (169.254.169.254), link-local, ULA, and recursively inspects IPv4 addresses embedded inside ::ffff:0:0/96, NAT64 64:ff9b::/96, and 6to4 2002::/16 addresses while stripping trailing DNS dots and IPv6 zone IDs.
  • DNS rebinding & 302 redirect chases: Resolves A/AAAA records (checkUrlAsync) and intercepts every sub-resource request (maxRedirects: 0) up to 10 hops so external servers cannot bounce Chromium into localhost via HTTP 302.
  • Sandbox integrity: Blocks unsafe switches (--no-sandbox, --disable-web-security, --remote-debugging-port) cleanly even if passed with =1.
  • Signed document immutability: optimizePdf(), mergePdfs(), extractPages(), watermarkPdf(), enforcePdfA(), and redactPdf() throw ONEX_SIGNED_DOCUMENT_IMMUTABLE on signed PDFs (including widget-only signatures) unless allowModifySigned: true is passed.
  • Hardened delivery surfaces: Constant-time SHA-256 API key comparison, streaming request size abort (> 20 MiB destroys socket immediately), queue overflow (503 Retry-After: 5), HTML escaping on footer templates, XML escaping on CII/XMP outputs, and no local p12Path filesystem reads on remote HTTP /sign.

See SECURITY.md for the complete SecurityError reference table.

Clone this wiki locally