Content Security Policy

DFIRe does not send a Content Security Policy for its pages. This page gives the reason and lists what a policy that you set on your own reverse proxy must allow.

Why DFIRe does not send one

A Content Security Policy tells the browser where a page may load scripts, styles and images from, and which hosts it may connect to. The browser blocks everything else.

A correct policy depends on your installation. With Direct Storage on S3, the browser uploads straight to the host of your bucket. Some integrations load images from the hosts of other services. DFIRe cannot know these hosts in advance.

A policy that is too strict fails only in the browser. A page loses a function, and DFIRe sees no error and logs nothing. We also do not test DFIRe with a Content Security Policy in place.

For these reasons the policy is yours to set, on the reverse proxy in front of DFIRe, and yours to test.

What DFIRe sends

DFIRe sends these headers with its pages and its API responses:

Header Value
X-Frame-Options DENY
X-Content-Type-Options nosniff
Referrer-Policy strict-origin-when-cross-origin

DFIRe sets one policy itself. Every attachment download that DFIRe serves carries Content-Security-Policy: sandbox, so a downloaded file cannot run scripts if a browser opens it as a page.

What a policy must allow

The table lists what the web interface loads. The directive is the part of the policy that controls each kind of resource.

Directive What DFIRe loads
script-src Scripts from the DFIRe address only. A Direct Storage upload calculates the file hash in the browser with WebAssembly, which needs 'wasm-unsafe-eval'.
style-src Style sheets from the DFIRe address. The Markdown and JSON editors and the email previews use inline styles, which need 'unsafe-inline'.
font-src Fonts from the DFIRe address only.
img-src Images from the DFIRe address. Attachment pictures, report images and Knowledge Base images use blob: addresses. The QR code of multi-factor authentication and the icons in form fields use data: addresses. See the next section for images from other hosts.
connect-src The DFIRe address for the API, and a WebSocket to the same address (wss: when you serve DFIRe over HTTPS). With Direct Storage on S3, also the host of your bucket.

The email previews in Settings → Email Delivery and in the webhook editor show a message in a sandboxed frame. The frame takes the policy of the page, so the rule for inline styles applies to it too.

Images from other hosts

Three places show an image that the browser loads from another service:

  • Slack profile pictures beside messages from a case's Slack channel. Slack supplies the address of each picture.
  • The page screenshot in an urlscan.io enrichment result. urlscan.io supplies the address.
  • The status image of the license server in the license settings, from healthchecks.io.

If the policy does not allow these hosts, the pictures do not show. Nothing else stops working.

Pages outside the web interface

A policy that the proxy adds to every response also applies to the Django admin at /admin/ and to the API reference at /api/docs/. Both load their scripts and style sheets from /static/ on the DFIRe address. Test both pages with your policy.

Rules for the proxy

  • Keep the header on downloads. Do not remove or replace a Content-Security-Policy header that DFIRe sends. Add yours only to a response that has none, or add it as a second header. A browser applies every policy that a response carries.
  • Start in report-only mode. Send the policy as Content-Security-Policy-Report-Only first. The browser then blocks nothing and writes each violation to its console. Use the functions your team uses, then read the console.
  • Check again after each update. A new DFIRe version can load a resource from a new place. Read the console again in report-only mode after you update.

For the proxy itself, see Deployment → HTTPS.