← Back to release summary

Remove Content Type Sniffing for Worker Scripts

Category
JavaScript
Type
New or changed feature
Status
No active development (Chrome No active development)
Intent stage
Removed

WPT details: We have Worker tests in WPT that currently exercise both valid and invalid MIME types. When landing this change, we'll update their expectations accordingly.

Summary

Worker scripts will be rejected unless they're delivered with a javascript MIME type (https://mimesniff.spec.whatwg.org/#javascript-mime-type).

Motivation

Web browsers will execute JavaScript, use CSS, etc., even if the Content-Type: header indicates a non-matching MIME type. For example, including a text/html resource via a <script src=.... > tag would succeed. This has been a security concern for quite a while, and there's a long-standing desire to eliminate or at least reduce this. Tightening MIME type restrictions makes it less likely that a server's resources are inadvertently executed as script, and allows us to tighten CORB protections outside the renderer process.

Standards & signals

Ecosystem

Docs: https://mimesniff.spec.whatwg.org/#javascript-mime-type https://groups.google.com/a/chromium.org/d/msg/blink-dev/35t5cJQ3J_Q/FH45dl0vAwAJ

View on chromestatus.com