🛡️ Sentinel: Fix Stored XSS via Content-Type spoofing in asset proxies (#237)

Sanitized the Content-Type header on image and video proxy routes (`/api/image/*`, `/api/video/*`). The content type is forced to lowercase, validated against a safe prefix (`image/`, `video/`, `audio/`), and restricted to block `svg` and `xml`. Any invalid type falls back to `application/octet-stream`. This prevents an attacker from uploading an SVG file containing a malicious script and triggering a Stored XSS attack via these proxy endpoints, which are excluded from the global CSP.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
Ralksta
2026-05-31 10:02:59 +02:00
committed by GitHub
parent 6b7fb09097
commit c2fa8e7596
4 changed files with 23 additions and 4 deletions

View File

@@ -14,6 +14,7 @@ vi.mock('../config', async () => {
standaloneAlbums: ['album-1'],
subpages: [],
albumOverrides: { 'album-1': 'Override Name' },
albumDescriptions: {},
cacheTtl: 0,
}),
};