v0.6.402: security, stored files go out as user content (#1139) #1141
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sx1139"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1139 (stored XSS through plain-mode links) and a second route the sweep found (WebDAV GET with the browser session served
.htmlastext/html).httpx.UserContenton every route that returns stored file bytes:nosniff, a sandboxing CSP (default-src 'none'; img-src 'self' data:; media-src 'self'; style-src 'unsafe-inline'; sandbox allow-downloads), active types (HTML, XHTML, SVG, XML, JavaScript, MHTML) always as attachment withapplication/octet-stream; passive PDFs keep inline without the sandbox (Chrome won't show a sandboxed PDF).shareLinksPlainAllowed(off): otherwise 403link-mode-plain-disabled. The web app always makes key links; existing plain links keep working with the safe headers.allow-downloads, route tests for every path, the data export ZIP, fail-closed on unparsable types. Chromium check: top-level image, audio and text still work under the policy; Safari/Firefox on the #1005 list.S1: UserContentCSP ends in "sandbox allow-downloads": the sandboxed document may start a download (a media player's own download button); no script, no same-origin access. The HTML standard takes a download's permission from the initiating document, so this is a hedge. N2: every WHATWG JavaScript MIME type essence is active; an active answer is sent as application/octet-stream, so nosniff refuses it as a script. N3: the personal data export downloads go through httpx.UserContent. N4: a stored type that does not parse is active (fail closed). N5: application/x-pdf is a PDF (no sandbox), sent as application/pdf. S2: header assertions for versions/raw, /api/v1/zip/{id}, /s/?zip=1 plain and strong, the strong payload, the OCM grant GET, ocm/fetch (a remote text/html), WOPI GetFile and the export download; a test that PUT /api/v1/settings with shareLinksPlainAllowed is audited. Existing tests changed: preview_test.go and preview1097_test.go checked that the policy ends in "sandbox"; they now compare the exact policy.