Skip to content

Serve .html, .svg and .xhtml as text/plain in browse file handler#103

Merged
andrew merged 1 commit into
mainfrom
fix/browse-xss-content-type
May 2, 2026
Merged

Serve .html, .svg and .xhtml as text/plain in browse file handler#103
andrew merged 1 commit into
mainfrom
fix/browse-xss-content-type

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 2, 2026

These file types were served with executable content types (text/html, image/svg+xml) allowing stored XSS via package archive contents. A single GET to a cached artifact's .html or .svg file would execute attacker-controlled scripts on the proxy origin.

Changes:

  • Map .html, .htm, .xhtml, .svg to text/plain in detectContentType
  • Add Content-Security-Policy: sandbox and X-Content-Type-Options: nosniff headers to all browseFile responses

These file types were served with executable content types (text/html,
image/svg+xml) allowing stored XSS via package archive contents.
Also adds Content-Security-Policy: sandbox and X-Content-Type-Options:
nosniff headers to all browse file responses.
@andrew andrew merged commit f1ea8b5 into main May 2, 2026
5 checks passed
@andrew andrew deleted the fix/browse-xss-content-type branch May 2, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant