Live data from Hacker News

How widely used are security-based HTTP response headers?

scotthelme.co.uk

11–20 of 36 posts

Re: How widely used are security-based HTTP response headers?

#11
post #8
post #7

Earlier quoted context omitted.

Because it doesn't eliminate the Server header, "off" will return "Server: nginx". Just one of several "fuck you" features in nginx.

Server: header makes people gone mad?

It wastes space, and reveals unnecessary information about your server infrastructure.

Re: How widely used are security-based HTTP response headers?

#12

HN uses x-frame-options:"DENY" to good effect which takes care of a fair number of click-jack tricks, it also uses strict-transport-security. But there is only so much you can do with headers, the real risks are in the documents themselves. How about a pair in the primary document disabling any kind of javascript execution in the space between the tags. And those tags should only work in the primary document.

> How about a pair in the primary document disabling any kind of javascript execution in the space between the tags.

But wouldn't folks still be able to inject scripts by just writing `alert('hi')`?

Re: How widely used are security-based HTTP response headers?

#13
post #4

It's unfortunate that response headers on a secure website need to be bloated so much to receive benefits that should be default on modern sites. I imagine a world where you specifically have to opt-in to unsafe behavior, not the other way around, but of course this would break many existing sites. For those of you looking at this, I've found the X-Frame-Options (to prevent clickjacking via iframe) and Content-Securi…

> I've found the X-Frame-Options (to prevent clickjacking via iframe)

I wish some way existed to prevent clickjacking (e.g. via invisible iframe) without actually banning frames. There are useful applications for framing another site that can't be achieved by any other means, apart from writing a browser extension. And framing a site without making it invisible seems like unfortunate collateral damage.

Re: How widely used are security-based HTTP response headers?

#14

HN uses x-frame-options:"DENY" to good effect which takes care of a fair number of click-jack tricks, it also uses strict-transport-security. But there is only so much you can do with headers, the real risks are in the documents themselves. How about a pair in the primary document disabling any kind of javascript execution in the space between the tags. And those tags should only work in the primary document.

CSP does exactly that; you can just ban inline scripts entirely.

Re: How widely used are security-based HTTP response headers?

#16
post #3

I've found HPKP and HSTS easy to trivial, but gave up on deploying CSP. It's major refactoring when so much stuff directly includes 3rd party CSS and script, or just injects static CSS and JS in to pages inline.

> It's major refactoring when so much stuff directly includes 3rd party CSS and script, or just injects static CSS and JS in to pages inline. You can still use CSP, and whitelist specific third-party domains. (There's no way to whitelist inline code, though, and if there were it'd be more work than eliminating it and moving it to files.) But the refactoring is well worth doing. By eliminating inline JavaScript and of…

> There's no way to whitelist inline code

That's not completely true - the nonce attribute (specify a nonce in the CSP header, have nonce=that on every script tag) or by sending the hashes of the inline scripts upfront in the CSP header.

It doesn't give you inline code in attributes (e.g. onclick) but it's a big help for migrating.

Re: How widely used are security-based HTTP response headers?

#18
post #4

It's unfortunate that response headers on a secure website need to be bloated so much to receive benefits that should be default on modern sites. I imagine a world where you specifically have to opt-in to unsafe behavior, not the other way around, but of course this would break many existing sites. For those of you looking at this, I've found the X-Frame-Options (to prevent clickjacking via iframe) and Content-Securi…

> I've found the X-Frame-Options (to prevent clickjacking via iframe) I wish some way existed to prevent clickjacking (e.g. via invisible iframe) without actually banning frames. There are useful applications for framing another site that can't be achieved by any other means, apart from writing a browser extension. And framing a site without making it invisible seems like unfortunate collateral damage.

Dan Kaminsky is working on something: http://dankaminsky.com/2015/08/09/defcon-23-lets-end-clickja...

Re: How widely used are security-based HTTP response headers?

#20

Earlier quoted context omitted.

> It's major refactoring when so much stuff directly includes 3rd party CSS and script, or just injects static CSS and JS in to pages inline. You can still use CSP, and whitelist specific third-party domains. (There's no way to whitelist inline code, though, and if there were it'd be more work than eliminating it and moving it to files.) But the refactoring is well worth doing. By eliminating inline JavaScript and of…

> There's no way to whitelist inline code That's not completely true - the nonce attribute (specify a nonce in the CSP header, have nonce=that on every script tag) or by sending the hashes of the inline scripts upfront in the CSP header. It doesn't give you inline code in attributes (e.g. onclick) but it's a big help for migrating.

Ah. I hadn't found that in Mozilla's CSP documentation. Thanks.
Post reply on HN