feat: Add support to run notebooks on its own subdomains in Istio #562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a draft at the moment, see Open Tasks for details.
This PR makes it possible to host notebooks on their own subdomains when Istio is used by adding this feature to the Kubeflow
notebook-controller
. This isolates the notebook's origin from the dashboard / Kubeflow API origin in the browser and addresses a security problem that allows session hijacking through a malicious notebook.(reopend PR from !7742 in kubeflow/kubeflow)
Motivation / Why this change is needed
This change addresses a security problem that allows session hijacking through a malicious notebook:
An attacker can log session cookies by misusing the Notebook feature: An attacker can create a Notebook with a custom image that logs the cookies / trigger API requests. Afterwards, they must convince the victim to visit the URL of the Notebook (a phishing attack). This is a classic phishing attack scenario.
Disallowing custom images wouldn't be sufficient because you can achieve the same thing with a few extra steps using one of default images.
The problem relies on the fact that the Notebooks and the Kubeflow Dashboard / APIs are in the Browser's same origin. Thus, any attacker-controlled site would be able to access the Kubeflow API in the context of the victim.
To prevent this attack, the authenticating cookies need to be removed from requests forwarded to Notebook's Pods, and the notebooks need to be hosted on a different domain. This PR accomplishes this.
A proof of concept that demonstrates the problem is available but will not be disclosed until the problem is fixed.
Request for Feedback
At the moment, we are removing all cookie headers for security reasons before the request is forwarded to the notebook container. This breaks the functionality in some notebook images. So the goal is to remove only the authenticating cookie and keep the remaining cookies.
Our idea is to use a Istio Wasm Plugin that accomplishes this.
@kimwnasptd @juliusvonkohout @thesuperzapper @ederign What do you think?
What this PR accomplishes
ISTIO_HOST_NOTEBOOK
in the notebook's VirtualServices whenISTIO_USE_NOTEBOOK_SUBDOMAINS
is set to prevent access to the dashboard / APIs from attacker-controlled notebooks through the browser.ISTIO_HOST_AUTH
for theISTIO_AUTH_PATH
.Open Tasks
This PR is a draft at the moment because the following parts are work in progress:
Configuration
The subdomain feature is disabled by default as the setup has some prerequisites and is a breaking change. It requires a wildcard domain and wildcard TLS certificate or automated domain and certificate management.
To enable the feature, do the following configuration steps:
notebook-controller
:configmap
ofoauth2
must also be adjusted by enabling cookies for subdomains. Edit theoauth2_proxy.cfg
configuration of theoauth2-proxy-hk55gm96k4
ConfigMap in theoauth2-proxy
namespace and add the following setting:cookie_domains = "kubeflow.example.com"