Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some unnecessary headers #90

Closed
domenic opened this issue Apr 25, 2018 · 13 comments
Closed

Some unnecessary headers #90

domenic opened this issue Apr 25, 2018 · 13 comments

Comments

@domenic
Copy link
Member

domenic commented Apr 25, 2018

Based on https://sonarwhal.com/scanner/82d0ae4e-aa8d-4b9b-9d32-24c1b0817136

  • We are sending X-XSS-Protection on CSS and SVG resources, but apparently it's only relevant for HTML resources
  • We are sending X-Content-Type-Options for HTML and SVG resources, but apparently it's only relevant for script and style. (Maybe this will change with CORB though?)
@annevk
Copy link
Member

annevk commented Apr 26, 2018

Yeah, sending X-Content-Type-Options for all makes sense. (There's also a gap in the specification I found out the other day as apparently some browsers use it for navigation too.)

@annevk
Copy link
Member

annevk commented Apr 26, 2018

And surely X-XSS-Protection would be relevant for SVG containing script?

@domenic
Copy link
Member Author

domenic commented Apr 26, 2018

I dunno, I guess there's no spec for them, so it's unclear if browsers would process them on SVGs.

@alrra
Copy link
Member

alrra commented Apr 26, 2018

sending X-Content-Type-Options for all makes sense.

@annevk sonarwhal used to do that, but then things were changed to only recommend it for scripts and stylesheets because of the reasons specified in the docs, namely:

Note: Modern browsers only respect the header for scripts and stylesheets, and sending the header for other resources such as images may create problems in older browsers.


Maybe this will change with CORB though?

Yes.


(There's also a gap in the specification I found out the other day as apparently some browsers use it for navigation too.)

@annevk Can you provide more information (or a link)? Thanks!


@annevk, @domenic I'm one of the maintainers of the sonarwhal project, so if you have any other feedback, let me know! I'll happily change what sonarwhal suggests if something is not accurate.

@annevk
Copy link
Member

annevk commented Apr 26, 2018

@alrra

HTTP/1.1 200 OK
Content-Type: garbage
X-Content-Type-Options: nosniff

<?xml version="1.0"?><test/>

Test that with and without the header and notice the difference. (Note that this behavior is not standardized.)

@annevk
Copy link
Member

annevk commented Apr 26, 2018

(Also, sending it for other resources does not create problems. What creates problems is if you send it for resources that are not correctly labeled.)

@alrra
Copy link
Member

alrra commented Apr 26, 2018

What creates problems is if you send it for resources that are not correctly labeled.

@annevk Yes, that's was the intend, but I can see the confusion. I've updated to docs to make them more clear, thanks!

Test that with and without the header and notice the difference.

Thanks!

@rugk
Copy link

rugk commented Dec 11, 2018

Actually also "HTML" can be a malicious mime type, as it can obviously embed JS. (Maybe also other types such as SVG?)

See https://www.youtube.com/watch?v=dBJt3eR8-bg for a talk by @hannob on that subject.

Also is not this issue basically a dupe of webhintio/hint#1221 now? Or what is still to be discussed here? (Is not it fixed by webhintio/hint@5c798f5 or what was actually the purpose of this issue?)

@annevk
Copy link
Member

annevk commented Dec 11, 2018

@rugk whatwg/misc-server is for issues with WHATWG's server setup. I doubt webhintio/hint has access to our keys to make the relevant changes.

@rugk
Copy link

rugk commented Dec 11, 2018

Ugh… yeah…

So you still serve the header for all assets?
And here is the reasoning as I see it: webhintio/hint@5c798f5

So is there still something to do in this issue?
Or do you want to wait whether browsers change their decisions about what mime types?


Actually I only came here because it is linked on MDN.

nosniff only applies to "script" and "style" types (this restriction may change in the future).

Though I do not see how that link would be fitting here. After all, you are not discussion or indicating browsers may change their decision here or what?
Now I am totally confused… 😕

@annevk
Copy link
Member

annevk commented Dec 12, 2018

This issue is not exclusively about nosniff.

@rugk
Copy link

rugk commented Dec 13, 2018

So the link on MDN makes no sense…

@annevk
Copy link
Member

annevk commented Mar 19, 2021

I guess we can close this now.

@annevk annevk closed this as completed Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants