mirror of
https://github.com/open-webui/open-terminal.git
synced 2026-11-05 01:27:28 +00:00
[PR #128] security: strip OPEN_TERMINAL_* from subprocess env #130
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/open-terminal#130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-terminal/pull/128
Author: @mazzz1y
Created: 5/19/2026
Status: 🔄 Open
Base:
main← Head:security/sanitize-subprocess-env📝 Commits (1)
d349c51security: strip OPEN_TERMINAL_* from subprocess env📊 Changes
3 files changed (+25 additions, -7 deletions)
View changed files
📝
open_terminal/env.py(+18 -0)📝
open_terminal/main.py(+4 -4)📝
open_terminal/utils/runner.py(+3 -3)📄 Description
User-spawned shells and commands inherited the full parent environment, including
OPEN_TERMINAL_API_KEY. A user runningenv | grep OPEN_TERMINAL_inside an/executecommand or/api/terminalssession could read internal configuration meant only for the server process.This is the minimal, conservative fix:
OPEN_TERMINAL_*keys are stripped. Other variables such asPATH,HOME,USER,SHELL,TERM,LANG, etc pass through unchanged, so user shells continue to feel normal.envinPOST /executestill wins on collision — authenticated callers can explicitly re-add any variable.Tested in my environment — REST API with OpenWebUI
Another option was introducing a prefix convention to fully separate server variables from sandbox variables — e.g.
SANDBOX_API_KEYon the server side becomesAPI_KEYinside the user's shell. This would give stronger isolation but is likely a breaking change: operators currently set env vars in their Dockerfile / compose / launch scripts and expect them to pass through to user commands. For that reason I did not choose this approach.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.