[PR #16622] [MERGED] Fix/arbitrary uid #10987

Closed
opened 2025-11-11 19:19:04 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/16622
Author: @SebLz
Created: 8/14/2025
Status: Merged
Merged: 8/15/2025
Merged by: @tjbck

Base: devHead: fix/arbitrary-uid


📝 Commits (2)

  • 4525ac6 feat: add Docker publish workflow for multi-architecture builds
  • c82183f Remove CI workflow (not part of PR)

📊 Changes

1 file changed (+9 additions, -0 deletions)

View changed files

📝 Dockerfile (+9 -0)

📄 Description

Prefix: fix
Target branch: main


Pull Request Checklist

  • Target branch: main
  • Description: Provided below
  • Changelog: Added below
  • Documentation: Not applicable (change is internal to container build process; no public API change)
  • Dependencies: No new dependencies
  • Testing: Verified locally and on OpenShift (restricted SCC)
  • Code review: Self-reviewed
  • Prefix: fix

Changelog Entry

Description

This PR addresses [Discussion #16594](https://github.com/open-webui/open-webui/discussions/16594) and fixes [Issue #16592](https://github.com/open-webui/open-webui/issues/16592) by making the Open WebUI container image arbitrary-UID friendly, ensuring compatibility with OpenShift's restricted Security Context Constraints (SCC) and similar hardened Kubernetes environments.

Currently, running the official image in such environments may fail when the process (running under a random UID with supplemental GID 0) attempts to write to /root, /app or other application directories that are root:root 755. This results in permission errors for Python libraries (e.g., transformers, tiktoken) and application caches.

The proposed change ensures these paths are writable by the injected UID's supplemental GID 0 without introducing additional privileges, following best practices for arbitrary-UID container images.


Added

  • None

Changed

  • Adjusted file system permissions in the Dockerfile:

    • /app and /root are now group-owned by GID 0 and have g+rwX permissions.
    • Applied SGID (g+s) to these directories so new files inherit group 0.

Deprecated

  • None

Removed

  • None

Fixed

  • Fixes inability to write to /root or application directories under OpenShift's restricted SCC with arbitrary UID injection.

Security

  • Improves security posture by:

    • Avoiding reliance on a fixed USER in the image.
    • Enabling least-privilege execution by any UID within the platform’s allowed range.

Breaking Changes

  • None (image remains compatible for Docker and Kubernetes users without OpenShift).

Additional Information


I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.


🔄 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-webui/pull/16622 **Author:** [@SebLz](https://github.com/SebLz) **Created:** 8/14/2025 **Status:** ✅ Merged **Merged:** 8/15/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix/arbitrary-uid` --- ### 📝 Commits (2) - [`4525ac6`](https://github.com/open-webui/open-webui/commit/4525ac687b4219c2e72d8f3c6dc812ce137a4111) feat: add Docker publish workflow for multi-architecture builds - [`c82183f`](https://github.com/open-webui/open-webui/commit/c82183f98566895385416e2e71f47f59f1bf2dee) Remove CI workflow (not part of PR) ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile` (+9 -0) </details> ### 📄 Description **Prefix:** `fix` **Target branch:** `main` --- # Pull Request Checklist * [x] **Target branch:** `main` * [x] **Description:** Provided below * [x] **Changelog:** Added below * [x] **Documentation:** Not applicable (change is internal to container build process; no public API change) * [x] **Dependencies:** No new dependencies * [x] **Testing:** Verified locally and on OpenShift (restricted SCC) * [x] **Code review:** Self-reviewed * [x] **Prefix:** `fix` --- # Changelog Entry ### Description This PR addresses [[Discussion #16594](https://github.com/open-webui/open-webui/discussions/16594)](https://github.com/open-webui/open-webui/discussions/16594) and fixes [[Issue #16592](https://github.com/open-webui/open-webui/issues/16592)](https://github.com/open-webui/open-webui/issues/16592) by making the Open WebUI container image **arbitrary-UID friendly**, ensuring compatibility with OpenShift's **restricted** Security Context Constraints (SCC) and similar hardened Kubernetes environments. Currently, running the official image in such environments may fail when the process (running under a random UID with supplemental GID 0) attempts to write to `/root`, `/app` or other application directories that are `root:root 755`. This results in permission errors for Python libraries (e.g., `transformers`, `tiktoken`) and application caches. The proposed change ensures these paths are writable by the injected UID's supplemental GID 0 without introducing additional privileges, following best practices for arbitrary-UID container images. --- ### Added * None ### Changed * Adjusted file system permissions in the Dockerfile: * `/app` and `/root` are now group-owned by **GID 0** and have `g+rwX` permissions. * Applied SGID (`g+s`) to these directories so new files inherit group 0. ### Deprecated * None ### Removed * None ### Fixed * Fixes inability to write to `/root` or application directories under OpenShift's restricted SCC with arbitrary UID injection. ### Security * Improves security posture by: * Avoiding reliance on a fixed `USER` in the image. * Enabling least-privilege execution by any UID within the platform’s allowed range. ### Breaking Changes * None (image remains compatible for Docker and Kubernetes users without OpenShift). --- ### Additional Information * Related discussion: [[#16594](https://github.com/open-webui/open-webui/discussions/16594)](https://github.com/open-webui/open-webui/discussions/16594) * Related issue: [[#16592](https://github.com/open-webui/open-webui/issues/16592)](https://github.com/open-webui/open-webui/issues/16592) * Change should be fully backward-compatible and transparent for standard Docker/K8s usage. * Tested: * On OpenShift 4.x with **restricted** SCC, ensuring writable /app directories. * Test image: ghcr.io/seblz/open-webui:uidfix --- I confirm that I have read and fully agree to the [[Contributor License Agreement (CLA)](https://chatgpt.com/CONTRIBUTOR_LICENSE_AGREEMENT)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 19:19:04 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#10987