# Threat model

> What could go wrong in Sypnia Files, and how each threat is answered.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://files.docs.sypnia.com/security/threat-model/

For agents: Files threat model: cross-user access (default deny, policies as user), active content (separate content domain files.sypnia.app, CSP sandbox, nosniff, active types as downloads), fake types (byte sniffing), malware (scan buckets, quarantine), leaked signed URL (expiry, signed options), secret key in browser (Origin refused, rotate), decompression/transform bombs (50 MP / 25 MB), storage exhaustion (per-project quotas).

| Threat                                                                        | Answer                                                                                                                                                                                                          |
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| A user reads or overwrites another user's files                               | default deny; every operation checked against policies as that user                                                                                                                                             |
| An uploaded HTML or SVG file runs scripts with your app's or Sypnia's cookies | files are served from a separate domain (`files.sypnia.app`), with `Content-Security-Policy: sandbox` and `X-Content-Type-Options: nosniff`; active types are sent as downloads unless the bucket allows inline |
| A file pretends to be an image                                                | the type is sniffed from the bytes and checked against `allowedTypes`                                                                                                                                           |
| Malware is uploaded and shared                                                | optional scanning per bucket; infected files are never served and are quarantined                                                                                                                               |
| A signed URL is leaked                                                        | it expires; its options are signed; buckets can require short expiries                                                                                                                                          |
| A secret key reaches a browser                                                | refused when sent with an `Origin` header; rotate with `files keys rotate`                                                                                                                                      |
| A transform bomb (huge dimensions)                                            | originals limited to 50 megapixels and 25 MB for transforms                                                                                                                                                     |
| One project fills shared storage                                              | per-project quotas; uploads refused past them                                                                                                                                                                   |
