open-webui/backend
Sebastien Tardif fd8361217f security: harden file serving endpoints against stored XSS
Prevent stored XSS attacks through file-serving endpoints by:

1. Adding a safe content-type allowlist (SAFE_INLINE_CONTENT_TYPES) for
   inline serving. Content types not on the allowlist are replaced with
   application/octet-stream and forced to Content-Disposition: attachment,
   preventing browsers from executing uploaded HTML/JS files.

2. Adding Content-Security-Policy sandbox header to the /content/html
   endpoint to block script execution even for legitimately served HTML.

3. Adding X-Content-Type-Options: nosniff to all file-serving responses
   to prevent MIME-type sniffing attacks.

4. Forcing application/octet-stream on the /content/{file_name} download
   endpoint which is always served as attachment.

Previously, the /content endpoint passed through the uploader-controlled
Content-Type header directly to the response, allowing a user to upload
a file with Content-Type: text/html containing malicious scripts. The
/content/html endpoint served files with their OS-inferred content type
and no CSP restrictions, enabling full same-origin script execution.
2026-05-05 02:39:34 -07:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
open_webui security: harden file serving endpoints against stored XSS 2026-05-05 02:39:34 -07:00
.dockerignore fix: litellm config issue 2024-02-24 22:35:11 -08:00
.gitignore refac 2024-09-06 04:59:20 +02:00
dev.sh refac 2026-03-24 19:43:30 -05:00
requirements-min.txt refac 2026-04-24 18:20:10 +09:00
requirements.txt refactor(firecrawl): use v2 API directly (#23934) 2026-04-24 18:32:08 +09:00
start.sh refac 2026-03-24 19:43:30 -05:00
start_windows.bat refac 2026-04-24 15:40:02 +09:00