Skip to content

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

Open
EllaFr wants to merge 1 commit into
open-webui:mainfrom
EllaFr:fix/session-state-user-binding
Open

fix: bind per-session state to the requesting user in multi-user mode#143
EllaFr wants to merge 1 commit into
open-webui:mainfrom
EllaFr:fix/session-state-user-binding

Conversation

@EllaFr

@EllaFr EllaFr commented Jul 27, 2026

Copy link
Copy Markdown

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.

Multi-user mode namespaces filesystem access per user, but per-session
working-directory state was keyed by X-Session-Id alone and was not
namespaced per user. Key it by (user, session id) so a session id
resolves only within the caller's own namespace.

Also require X-User-Id when multi-user mode is enabled, and validate the
/files/cwd target in all modes rather than in single-user mode only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant