-
Notifications
You must be signed in to change notification settings - Fork 27
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
🐛fix CSP frame-ancestors for dynamic-sidecar services #2977
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2977 +/- ##
========================================
+ Coverage 80.4% 80.7% +0.2%
========================================
Files 326 558 +232
Lines 16358 25636 +9278
Branches 2044 3392 +1348
========================================
+ Hits 13161 20699 +7538
- Misses 2723 4169 +1446
- Partials 474 768 +294
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -52,7 +52,7 @@ def get_dynamic_proxy_spec( | |||
"swarm_stack_name": dynamic_sidecar_settings.SWARM_STACK_NAME, | |||
"traefik.docker.network": swarm_network_name, | |||
"traefik.enable": "true", | |||
f"traefik.http.middlewares.{scheduler_data.proxy_service_name}-security-headers.headers.customresponseheaders.Content-Security-Policy": f"frame-ancestors {scheduler_data.request_dns}", | |||
f"traefik.http.middlewares.{scheduler_data.proxy_service_name}-security-headers.headers.customresponseheaders.Content-Security-Policy": f"frame-ancestors {scheduler_data.request_dns} {scheduler_data.node_uuid}.services.{scheduler_data.request_dns}", |
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.
Don't you need commas between these two values?
I see other entries of traefik that requires that ... for instance
Line 57 in dd94393
f"traefik.http.middlewares.{scheduler_data.proxy_service_name}-security-headers.headers.accessControlAllowOriginList": ",".join( |
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.
Q: scheduler_data.node_uuid}.services.{scheduler_data.request_dns}
is the entrypoint of a dynamic services, right? I see that the project id is not used for that. Does this assume that nodes have universal identifiers? i.e. two projects cannot include a node with the same NodeID as dynamic service ..
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.
Yes, that is exactly the entrypoint and we are saying to CSP that it can start iframes, to allow for iframe in iframes.
Yes, that is the same assumption as the legacy services!
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.
@GitHK @sanderegg OK, just for the record:
it would be good to identify dynamic services with something more than the node UUID (e.g. project_uuid/node_uuid)
We would like to guarantee the node-uuid uniquenes only within the scope of its project. That would help us a lot on:
- simplifies duplication of projects
- simplifies caching in metamodling iterations
- ...
See #2133 for more details
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.
ok, we need to discuss whether the project_id should be added. But I guess this can done in a separate PR
What do these changes do?
Services like
JupyterLab
when running inside an iframe might also try to display an iframe (for example to display the Voila preview).Related issue/s
How to test
Checklist