-
Notifications
You must be signed in to change notification settings - Fork 420
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
Add options to set additional nginx headers #3817
base: develop
Are you sure you want to change the base?
Changes from 2 commits
9d61e49
f92effa
f60409c
eafbdeb
09513a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -536,6 +536,40 @@ kubecostFrontend: | |
# fqdn: kubecost-multi-diag.kubecost.svc.cluster.local:9007 | ||
# clusterController: | ||
# fqdn: cluster-controller.kubecost.svc.cluster.local:9731 | ||
# | ||
|
||
# Configurable headers for nginx responses. | ||
nginxHeaders: | ||
# applied to all route locations | ||
server: | ||
- Content-Security-Policy "default-src 'self' cdn.userway.org; frame-ancestors 'none';"; | ||
- Cache-Control "must-revalidate"; | ||
# per-location headers | ||
location: | ||
root: [] | ||
healthz: [] | ||
model: [] | ||
clusterTurndown: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
hideOrphanedResources: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
hideDiagnostics: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
multiClusterDiagnosticsEnabled: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
multiClusterDiagnostics: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
forecastingEnabled: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
productConfigs: | ||
- "'Access-Control-Allow-Origin' '*' always;" | ||
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm worried that one configuration per route could quickly become unwieldy. Would it be possible start with: nginxHeaders:
routes:
- "'Access-Control-Allow-Origin' '*' always;"
- "'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS' always;" These headers would then be added to all routes. Do you see an issue with this from a frontend or security perspective? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's an issue. I was attempting to keep the same behavior we have today, where some |
||
|
||
# Kubecost Metrics deploys a separate pod which will emit kubernetes specific metrics required | ||
# by the cost-model. This pod is designed to remain active and decoupled from the cost-model itself. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it'd be a new header. I'm not super familiar with CSPs, do we know this will work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I still need to test it 😅
The idea is that sources like scripts, images, styles, etc can only be loaded from the same domain the UI is being accessed through, and cdn.userway.org. And also that the application cannot be embedded in an iframe. MDN has great CSP documentation if you feel like digging in more to check my understanding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed an update that I have tested, and it actually does work now.
I had to include directives for
font-src data:;
and I addedunsafe-inline
todefault-src
. I'm not sure whether these will still be flagged. It's safer than having no CSP, and we have something, somewhere, that is adding inline styles to the document.