Repository navigation
Set Content-Security-Policy and Cache-Control Headers - #6949
Conversation
defaults to `frame-ancestors 'none'` to block framing. Users can configure the header to have a more robust CSP to meet their security needs. Docs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors Signed-off-by: Taylor Silva <[email protected]>
I'm not 100% sure this is the best thing to do, but looking at the header of some big sites (i.e. stackoverflow) I found they do set this header to `private`. Signed-off-by: Taylor Silva <[email protected]>
aoldershaw
left a comment
There was a problem hiding this comment.
@EstebanFS and I tried to better understand what these headers do. It sounds like the frame-ancestors in Content-Security-Policy obsoletes X-Frame-Options, which we also allow configuring - however, it isn't supported in IE, so probably makes sense to support both.
For Cache-Control, I guess these settings just mean don't cache anything. This makes sense for things that should be private/sensitive (like API responses), but probably isn't the best for things like assets (icons, stylesheets, javascript).
Also interesting that we explicitly set Cache-Control to cache these assets: https://github.com/concourse/concourse/blob/master/web/cache_handler.go. It seems like both values are sent back in the response - not sure which takes precedence
I feel like a default value for Cache-Control of private might be a bit better, but not sure if that'll satisfy the vulnerability scanner.
|
I'll be adding support for HSTS (https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) in a separate PR once this one is merged. |
|
Interesting about both Cache-Control headers being returned. I thought later handlers would overwrite it. Not sure how browsers are meant to handle conflicting headers like that either. (EDIT: didn't find this explicitly anywhere but I'm guessing the strictest rule is what gets enforced when there's conflicting rules). Also thought about setting it to |
I think we can get it to overwrite by using concourse/web/cache_handler.go Line 14 in 63c757c |
removed no-store Signed-off-by: Taylor Silva <[email protected]>
Signed-off-by: Taylor Silva <[email protected]>
|
I changed Cache-Control to only have |
This reverts commit fc320c0.
aoldershaw
left a comment
There was a problem hiding this comment.
LGTM! Note to self - we'll need to update CI to allow embedding iframes like we do with XFrameOptions: https://github.com/concourse/infrastructure/blob/dbf08cf0f07856beb2396c851edb531a1ed1f50b/terraform/environments/production/ci-values.yml.tpl#L14
|
I'm gonna go make the packaging PR's for this now. |

What does this PR accomplish?
Bug Fix | Feature | Documentation
Changes proposed by this PR:
frame-ancestors 'none'no-store, privateNotes to reviewer:
I'm not 100% sure about the cache-control values, but looking at theheader of some big sites (i.e. stackoverflow) I found they do set this header
to
private.Release Note
CONCOURSE_CONTENT_SECURITY_POLICYno-store, private. The value of the header is overwritten for some paths (i.e. web assets)Contributor Checklist
Reviewer Checklist
BOSH and
Helm packaging; otherwise, ignored for
the integration
tests
(for example, if they are Garden configs that are not displayed in the
--helptext).