Office2PDF · Blog

Security & Sandboxing: How we handle untrusted documents safely

From Zip Bombs to SSRF: How office2pdf protects your infrastructure and data during document conversion.

Office2PDF
Security & Sandboxing: How we handle untrusted documents safely

When a user uploads a file to your SaaS application, they are handing you a black box. In the world of document conversion, that box could be a gift, or it could be a grenade.

Processing Office files is inherently risky. A DOCX or XLSX file is essentially a compressed collection of XML files and scripts. Without proper isolation, a malicious file can crash your server, steal your environment variables, or scan your internal network.

At office2pdf, security isn’t a bolt-on feature—it’s the foundation of our architecture. Here is how we ensure that your “untrusted” documents never compromise your “trusted” infrastructure.


The Threat Landscape

To build a reliable conversion system, we first had to define what we were defending against:

  1. Zip Bombs (Decompression Bombs): A 5MB file that expands into 500GB of data, instantly nuking your storage and memory.
  2. SSRF (Server-Side Request Forgery): Malicious documents with embedded links that force the conversion engine to “call home” or scan your internal metadata services (like AWS IAM roles).
  3. Resource Exhaustion: Documents designed to hang the CPU or leak memory, causing a cascading failure across your worker pool.

Our Multi-Layered Defense Strategy

We built office2pdf with a “Zero Trust” approach to file processing. We don’t just hope the file is safe; we assume it is dangerous.

1. Ephemeral Container Isolation

Every conversion job runs in its own disposable, isolated container. We use a heavily hardened version of the Gotenberg core, stripped of unnecessary permissions. Once the PDF is generated, the entire container is destroyed. No state is persisted. No data “leaks” from one job to the next.

2. Strict Network Hardening (No Egress)

Our conversion workers are network-blind. By default, the rendering engine has zero access to the public internet or your internal network. This effectively kills SSRF attacks—if a document tries to fetch an external image or ping an internal IP, the request is blocked at the kernel level.

3. Hard Resource Quotas

To prevent OOM errors and CPU spikes, we enforce strict limits on every job:

  • Memory Limits: Containers are capped (e.g., 512MB or 1GB) to prevent a single file from starving the host.
  • Timeouts: Any job that takes longer than our optimized threshold is automatically terminated.
  • No-Root Execution: Our engines never run with root privileges, mitigating the risk of container escape.

Privacy by Design: The Stateless Promise

For customers in the US and EU, data privacy is non-negotiable. office2pdf is a stateless service:

  • Instant Deletion: We do not store your files. Once the conversion is done and the bytes are delivered back to your Next.js or Node.js app, the source and the output are wiped from our memory.
  • GDPR Ready: Because we don’t persist Personal Identifiable Information (PII), we significantly simplify your compliance journey.

Why “DIY” Security is Expensive

As we discussed in our Open-Source vs. Paid API analysis, self-hosting a conversion engine means you are responsible for this entire security stack. One missed firewall rule or an unpatched container vulnerability could lead to a catastrophic breach.

With office2pdf, you get the fidelity of a tuned engine combined with enterprise-grade security, all at a competitive price point.


Conclusion

Security should never be a bottleneck for your product roadmap. Whether you are launching an enterprise document portal or a mission-critical SaaS application, office2pdf provides the hardened sandbox you need to scale with absolute confidence.

Ready to secure your document pipeline? Get started with office2pdf.


Next up: Case Study: How office2pdf handles 10,000+ conversions per hour with 99.9% uptime.

Convert Office → PDF securely

Low-cost API with security-first defaults for production pipelines.