mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-22 00:31:30 +00:00
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.
|
||
|---|---|---|
| .. | ||
| data | ||
| open_webui | ||
| .dockerignore | ||
| .gitignore | ||
| dev.sh | ||
| requirements-min.txt | ||
| requirements.txt | ||
| start.sh | ||
| start_windows.bat | ||