Re: [whatwg/fetch] Add example(s) for X-Content-Type-Options (#636)

Jitendra1419-UI left a comment (whatwg/fetch#636)

Hi ,

I reviewed your suggestion regarding adding If mimeType is empty, then return allowed to the nosniff blocking algorithm.

Here is a critical security consideration regarding why the spec deliberately blocks requests with a missing Content-Type:

Core Purpose of nosniff:
The entire objective of X-Content-Type-Options: nosniff is to prevent browsers from guessing (MIME-sniffing) untrusted content. If a response lacks a Content-Type header, allowing it to execute would force the browser to either blindly trust the destination context or sniff the payload. This reopens classic XSS vectors (e.g., executing user-uploaded files without content headers as scripts).

Strict Contract:
By design, nosniff is an explicit opt-in security contract. When a server sends nosniff, it guarantees that it properly identifies resources. Permitting missing MIME types would weaken this contract and defeat the protection against un-typed or ambiguously typed file execution.

Spec Alignment:
The WHATWG Fetch editors intentionally require an explicit match (JavaScript MIME type or text/css) rather than merely checking for explicit mismatches.

If a site uses nosniff, the industry standard resolution is for the origin server to supply the appropriate Content-Type header (e.g., text/javascript or text/css), rather than loosening the security checks in the browser engine/spec.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/636#issuecomment-5955516031
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/636/5955516031@github.com>

Received on Friday, 2 October 2026 15:20:55 UTC