[PR #142] fix: run notebook kernels as the requesting user in multi-user mode #135

Open
opened 2026-10-18 21:11:06 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-terminal/pull/142
Author: @EllaFr
Created: 7/23/2026
Status: 🔄 Open

Base: main ← Head: fix/notebooks-per-user-kernel


📝 Commits (1)

  • 65584b1 fix: run notebook kernels as the requesting user in multi-user mode

📊 Changes

2 files changed (+64 additions, -16 deletions)

View changed files

📝 open_terminal/main.py (+1 -1)
📝 open_terminal/utils/notebooks.py (+63 -15)

📄 Description

In multi-user mode the file endpoints isolate users through UserFS, but the notebook endpoints don't apply the same boundary. The kernel is started as the server process rather than the requesting user, create_session opens the requested path without the UserFS check the file APIs use, and sessions are keyed by session id with no owner.

Run the notebook kernel as the requesting OS user via sudo -u (mirroring how create_runner runs commands), so cell code executes with that user's OS permissions rather than the server's. The Jupyter connection file is placed in /tmp and made group-readable to that user so the kernel can read it while the server stays its owner. create_session also validates the notebook path through UserFS.is_path_allowed, each session is bound to the requesting X-User-Id so execute, status and delete only work for its owner, and the kernel starts in the user's home so relative paths resolve there. Single-user mode is unchanged.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-terminal/pull/142 **Author:** [@EllaFr](https://github.com/EllaFr) **Created:** 7/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/notebooks-per-user-kernel` --- ### 📝 Commits (1) - [`65584b1`](https://github.com/open-webui/open-terminal/commit/65584b10144f169551d0767b99ee75c46862a556) fix: run notebook kernels as the requesting user in multi-user mode ### 📊 Changes **2 files changed** (+64 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `open_terminal/main.py` (+1 -1) 📝 `open_terminal/utils/notebooks.py` (+63 -15) </details> ### 📄 Description In multi-user mode the file endpoints isolate users through `UserFS`, but the notebook endpoints don't apply the same boundary. The kernel is started as the server process rather than the requesting user, `create_session` opens the requested path without the `UserFS` check the file APIs use, and sessions are keyed by session id with no owner. Run the notebook kernel as the requesting OS user via `sudo -u` (mirroring how `create_runner` runs commands), so cell code executes with that user's OS permissions rather than the server's. The Jupyter connection file is placed in `/tmp` and made group-readable to that user so the kernel can read it while the server stays its owner. `create_session` also validates the notebook path through `UserFS.is_path_allowed`, each session is bound to the requesting `X-User-Id` so execute, status and delete only work for its owner, and the kernel starts in the user's home so relative paths resolve there. Single-user mode is unchanged. **Contributor License Agreement** - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/open-terminal#135
No description provided.