Files
inbuxa-server/crates/dav
jcoffey-dev 699629ede0 WebDAV: uploaded files can't run as pages on the server's origin
A file stored over WebDAV was served with whatever content type its
uploader gave it, and with no Content-Disposition or sandbox policy. An
HTML or SVG file opened in a browser ran as a page of the mail server's
own origin, the one that serves the sign-in page and JMAP. Any account
that can store a file could leave one for someone else to open.

Every file answer (GET, HEAD, ranges, 416) now carries
"Content-Security-Policy: default-src 'none'; frame-ancestors 'none';
sandbox" and nosniff, so a document has an opaque origin and no
scripts. Only raster images, audio, video and plain text are offered for
display; HTML, XHTML, SVG, XML, PDF and anything unknown download as
attachments. WebDAV clients ignore both headers.

Test: in the WebDAV suite, user_content stores HTML, XHTML, SVG, PDF,
untyped, text and PNG files and checks both headers on GET, HEAD and a
range request. On main the HTML file came back as text/html with
neither header.

Reported privately in a security review.

(cherry picked from commit 05da91201917e17da4bb74c680a6c469d8fd52d3)
2026-11-20 13:16:49 -07:00
..
2026-10-18 13:51:24 -07:00