[PR #143] fix: bind per-session state to the requesting user in multi-user mode #136

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

📋 Pull Request Information

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

Base: main ← Head: fix/session-state-user-binding


📝 Commits (1)

  • 584efbb fix: bind per-session state to the requesting user in multi-user mode

📊 Changes

1 file changed (+31 additions, -15 deletions)

View changed files

📝 open_terminal/main.py (+31 -15)

📄 Description

In multi-user mode the file endpoints isolate users through UserFS, but per-session working-directory state isn't namespaced the same way. _session_cwds is keyed by X-Session-Id alone with no owner, so the same entry is addressed regardless of who sends the request, POST /files/cwd writes to whatever session id the request names, and its target validation is skipped whenever multi-user mode is active. get_filesystem also falls back to an unscoped UserFS when X-User-Id is absent, which skips per-user path validation entirely.

Key _session_cwds by (user, session id), taking the user from the server-derived X-User-Id the Open WebUI proxy already sends, so a reused session id resolves within the caller's own namespace rather than reaching another user's state. X-User-Id is now required when multi-user mode is enabled instead of silently falling back to an unscoped filesystem, and the POST /files/cwd target is validated in all modes through UserFS.isdir rather than in single-user mode only. 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/143 **Author:** [@EllaFr](https://github.com/EllaFr) **Created:** 7/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/session-state-user-binding` --- ### 📝 Commits (1) - [`584efbb`](https://github.com/open-webui/open-terminal/commit/584efbb3b2eea1eb0d2bb703412ab5e2e931ecab) fix: bind per-session state to the requesting user in multi-user mode ### 📊 Changes **1 file changed** (+31 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `open_terminal/main.py` (+31 -15) </details> ### 📄 Description In multi-user mode the file endpoints isolate users through `UserFS`, but per-session working-directory state isn't namespaced the same way. `_session_cwds` is keyed by `X-Session-Id` alone with no owner, so the same entry is addressed regardless of who sends the request, `POST /files/cwd` writes to whatever session id the request names, and its target validation is skipped whenever multi-user mode is active. `get_filesystem` also falls back to an unscoped `UserFS` when `X-User-Id` is absent, which skips per-user path validation entirely. Key `_session_cwds` by `(user, session id)`, taking the user from the server-derived `X-User-Id` the Open WebUI proxy already sends, so a reused session id resolves within the caller's own namespace rather than reaching another user's state. `X-User-Id` is now required when multi-user mode is enabled instead of silently falling back to an unscoped filesystem, and the `POST /files/cwd` target is validated in all modes through `UserFS.isdir` rather than in single-user mode only. 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#136
No description provided.