Borrowing heavily from @stevesoudersorg’ post…
I wanted to use the HTTP Archive data to see how many resources have certain response headers intended for web application security.
This query tells us how many total requests were made in the November crawl:
SELECT count(*)
FROM [httparchive:runs.2013_11_15_requests]
result: 27,889,759 requests
Strict Transport Security (HSTS)
Purpose: to instruct browsers that your site is to only be accessed over https
SELECT domain(url) as domain, count(*) as num
FROM [httparchive:runs.2013_11_15_requests]
WHERE lower(respOtherHeaders) contains "strict-transport-security"
GROUP BY domain ORDER BY num desc
result: 830 sites with HSTS
830 / 27,889,759 = far less than one percent
If you are one of the valiant minority that has already implemented HSTS you should strongly consider requesting to have your site added to the list of sites which Chrome will always first visit using https. Instructions here and turnaround is usually quick. (Firefox also works off the same list, so all the more reason!)
X-Frame-Options
Purpose: to significantly reduce the risk of successful clickjacking attacks against your site.
SELECT domain(url) as domain, count(*) as num
FROM [httparchive:runs.2013_11_15_requests]
WHERE lower(respOtherHeaders) contains "x-frame-options"
GROUP BY domain ORDER BY num desc
result: 13,453 sites with X-Frame-Options
13,453 / 27,889,759 = far less than one percent
Content Security Policy
Purpose: to significantly reduce the risk of successful Cross Site Scripting (XSS) attacks against your site.
SELECT domain(url) as domain, count(*) as num
FROM [httparchive:runs.2013_11_15_requests]
WHERE lower(respOtherHeaders) contains "content-security-policy"
GROUP BY domain ORDER BY num desc
result: 69
69 / 27,889,759 = you don’t want to know
Yes, I know I didn’t include all the variants of the CSP headers that have been used. I don’t think it would change the outcome very much.
##Conclusion##
These numbers were expected to be low. At least now we have a baseline to compare against in future crawls.
In any case we have a lot of work to do to promote the use of headers like these and create a safer browsing experience online!