mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-24 00:51:27 +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.
|
||
|---|---|---|
| .. | ||
| analytics.py | ||
| audio.py | ||
| auths.py | ||
| automations.py | ||
| calendar.py | ||
| channels.py | ||
| chats.py | ||
| configs.py | ||
| evaluations.py | ||
| files.py | ||
| folders.py | ||
| functions.py | ||
| groups.py | ||
| images.py | ||
| knowledge.py | ||
| memories.py | ||
| models.py | ||
| notes.py | ||
| ollama.py | ||
| openai.py | ||
| pipelines.py | ||
| prompts.py | ||
| retrieval.py | ||
| scim.py | ||
| skills.py | ||
| tasks.py | ||
| terminals.py | ||
| tools.py | ||
| users.py | ||
| utils.py | ||