mozilla/srihash.org

Google Fonts fails to hash

Closed this issue · 5 comments

This is the attempted URL:

https://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700,800

It produces the error message:

<!-- Warning: Unrecognized content-type. Are you sure this is the right resource? -->

When run here:

https://www.srihash.org/

That's odd. The content type does appear to be set correctly on the server side:

$ curl --head 'https://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700,800'
HTTP/1.1 200 OK
Content-Type: text/css; charset=utf-8

and text/css is what we're looking for in the code.

Maybe this got broken in sri-toolbox?
neftaly/npm-sri-toolbox@2523cd7

Ah indeed, it's @jonathanKingston 's fault :)

I guess that commit should be reverted and we should release a new version of sri-toolbox?

So SRI toolbox was actually just returning "" for the content as it wasn't being passed one which made all this code work. However I don't think the check worked for when being given an invalid content type either.

Either way the right thing was to switch this to checking the response content-type headers which we were not doing.