[PR #11160] [CLOSED] chore: Improve config.json migration #38301

Closed
opened 2026-04-25 11:23:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/11160
Author: @tidely
Created: 3/4/2025
Status: Closed

Base: devHead: configmigrate


📝 Commits (3)

  • 3e8a115 chore: improve config.json migration
  • f5422ec chore: remove unused imports
  • ce70139 Revert "chore: remove unused imports"

📊 Changes

1 file changed (+13 additions, -10 deletions)

View changed files

📝 backend/open_webui/config.py (+13 -10)

📄 Description

Description

Fixed a Time-of-Check Time-of-Use (TOCTOU) bug by handling exceptions instead of checking for a file existing beforehand. While this is extremely unlikely to occur naturally we should fix it anyway.

load_json_config was only being used by the migration, so we can remove it.

We previously saved the loaded config in the data variable. This has a global scope and would not get removed by the gc. We can fix this by moving the migration into its own function.

Future

We should probably add a comment on how long of a migration period we want to have. This project moves very fast and the migration started 7 months ago already.


🔄 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/11160 **Author:** [@tidely](https://github.com/tidely) **Created:** 3/4/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `configmigrate` --- ### 📝 Commits (3) - [`3e8a115`](https://github.com/open-webui/open-webui/commit/3e8a11555e6f80bcf72dd1dd1cfa971cd086bb90) chore: improve config.json migration - [`f5422ec`](https://github.com/open-webui/open-webui/commit/f5422ecca9f2c73bf368454156bfe1217749fa79) chore: remove unused imports - [`ce70139`](https://github.com/open-webui/open-webui/commit/ce701393bdc65988def16b699e4a75683f6b533a) Revert "chore: remove unused imports" ### 📊 Changes **1 file changed** (+13 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+13 -10) </details> ### 📄 Description # Description Fixed a Time-of-Check Time-of-Use (TOCTOU) bug by handling exceptions instead of checking for a file existing beforehand. While this is extremely unlikely to occur naturally we should fix it anyway. `load_json_config` was only being used by the migration, so we can remove it. We previously saved the loaded config in the `data` variable. This has a global scope and would not get removed by the gc. We can fix this by moving the migration into its own function. ## Future We should probably add a comment on how long of a migration period we want to have. This project moves very fast and the migration started 7 months ago already. --- <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 2026-04-25 11:23:05 -05: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#38301