security: Prevent session hijacking through a malicious notebook. - #3550
security: Prevent session hijacking through a malicious notebook. #3550sven-ernw wants to merge 7 commits into
Conversation
|
Welcome to the Kubeflow Community Distribution Repository Thanks for opening your first PR. Your contribution means a lot to the Kubeflow community. Before making more PRs: Community Resources:
Thanks again for helping to improve Kubeflow. |
There was a problem hiding this comment.
Pull request overview
This pull request hardens Kubeflow notebook access against session hijacking.
Changes:
- Adds gateway cookie filtering.
- Documents production security and multi-domain notebook configuration.
- Adds notebook-controller subdomain parameters.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Adds production security guidance. |
proposals/20260705-secure-notebook-setup.md |
Documents multi-domain notebook setup. |
common/oauth2-proxy/README.md |
Documents cookie-name coupling. |
common/oauth2-proxy/base/oauth2_proxy.cfg |
Adds subdomain cookie guidance. |
common/istio/istio-install/overlays/oauth2-proxy/kustomization.yaml |
Includes the gateway filter. |
common/istio/istio-install/overlays/oauth2-proxy/envoy-filter-gateway.yaml |
Filters the session cookie. |
applications/notebooks-v1/upstream/notebook-controller/manager/params.env |
Adds subdomain parameters. |
applications/notebooks-v1/upstream/notebook-controller/manager/manager.yaml |
Injects the parameters into the controller. |
|
Addressed all comments from Copilot. |
|
/assign @juliusvonkohout |
|
/ok-to-test |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@thesuperzapper I have reviewed and fixed all suggestions from the CoPilot review. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
proposals/20260705-secure-notebook-setup.md:100
- Remove the duplicated word
section.
This will make the setup work. Please ensure that you follow the recommendations in the [_Security Considerations_ section](../README.md#security-considerations) section for guidance on a secure setup.
|
Fixed all feedback from review, pull request can be merged once kubeflow/notebooks#562 is merged. |
…icious notebook. Add the EnvoyFilter ``envoy-filter-gateway.yaml`` in the `oauth2-proxy` overlay that strips the authentication cookie from requests before they are forwarded to backend services, such as a malicious notebook. Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
…icious notebook. Add a description of how to set up multi-domain support for notebooks, including the configuration parameter (disabled by default). Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
…icious notebook. Add a Security Considerations section to the README.md which describes important security measures for a secure production setup. Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
…icious notebook. Implemented suggestions from Copilot review. Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
…icious notebook. Implemented suggestions from the second Copilot review. Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
…icious notebook. Implemented suggestions from the second Copilot review. Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
…icious notebook. Implemented suggestions from the second Copilot review. Signed-off-by: Lorin Lehawany <llehawany@ernw.de> Signed-off-by: Sven Nobis <snobis@ernw.de>
c524949 to
f3cd3e4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Suppressed comments (3)
applications/notebooks-v1/upstream/notebook-controller/manager/manager.yaml:47
- The Notebooks Helm chart vendors a static rendering, but
applications/notebooks-v1/helm/manifests/platform-resources.yaml:2061still proceeds directly fromISTIO_HOSTtoCLUSTER_DOMAINand contains none of these new ConfigMap keys. Helm installations therefore cannot enable subdomain routing, and thekubeflow-notebooks platformparity scenario will fail. Regenerate the chart payload through the synchronization script.
- name: ISTIO_USE_NOTEBOOK_SUBDOMAINS
valueFrom:
configMapKeyRef:
name: config
key: ISTIO_USE_NOTEBOOK_SUBDOMAINS
common/istio/istio-install/overlays/oauth2-proxy/kustomization.yaml:6
- This overlay feeds the static Helm payloads, but
common/istio/helm/manifests/install-oauth2-proxy.yamlandinstall-gke.yamlcontain noEnvoyFilter. Helm installations therefore omit the cookie-stripping security control, and the Helm-to-Kustomize parity scenarios will fail. Runscripts/synchronize-istio-manifests.shand commit the regenerated payloads.
- envoy-filter-gateway.yaml
proposals/20260705-secure-notebook-setup.md:13
- Origin separation does not prevent the browser from sending every API request. Credentialed simple requests and form submissions can still carry the parent-domain session cookie, although the same-origin policy blocks reading responses. The current wording falsely implies that request forgery is eliminated; narrow the claim and retain request-forgery protections on state-changing APIs.
This setup hosts the Kubeflow dashboard and APIs on a separate domain from the notebooks to prevent session hijacking from malicious notebooks through the user’s agent (browser). If an attacker hosts malicious notebooks and convinces a victim to visit the notebook’s URL, the attacker cannot steal session data or make API requests in the victim’s name.
| | `ISTIO_USE_NOTEBOOK_SUBDOMAINS` | Set this value to ``true``. | | ||
| | `ISTIO_HOST_NOTEBOOK` | Domain template used by Istio to host notebooks (e.g., `${NAMESPACE}-notebook.kubeflow.example.org`). `${NAMESPACE}` will be replaced with the Notebook's namespace (Kubeflow profile). | | ||
| | `ISTIO_HOST_AUTH` | Host used by Istio for handling authentication callbacks or login flows (e.g., `kubeflow.example.org`). | | ||
| | `ISTIO_AUTH_PATH` | Optional, defaults to `/oauth2/`; Can be used to change the base URL path used by Istio for authentication callbacks or login flows (e.g. `/oauth2/`). | |
| -- Prefix the header so every cookie has an explicit boundary. | ||
| local new_cookie = string.gsub(";" .. cookie_header, ";%s*" .. target_cookie .. "=[^;]*", "") | ||
| new_cookie = string.gsub(new_cookie, "^;", "") |
✏️ Summary of Changes
This pull request addresses the security issue described in GHSA-qjw6-hpc7-w36h together with the notebook's pull request !562. It prevents session hijacking through a malicious notebook.
This will be achieved by the following changes:
envoy-filter-gateway.yamlin theoauth2-proxyoverlay that strips the authenticating cookie from requests before it is forwarded to backend services like a malicious notebook. This prevents malicious notebooks from accessing other users' authentication credentials. This solution was discussed with @thesuperzapper during a Notebooks WG meeting.proposals/20260705-secure-notebook-setup.mdand the configuration parameter (disabled by default). This setup is required because even without authentication credentials, an attacker can control the user agent (browser) through a malicious notebook to make requests to the Kubeflow APIs.📦 Dependencies
🐛 Related Issues
✅ Contributor Checklist
CC: @lorinl @thesuperzapper @juliusvonkohout