Files
open-webui/backend/open_webui/utils
Classic298 dc4b828852 fix: correct async import hook that disables the code-interpreter module blocklist (#27245)
The middleware code-interpreter path defines `restricted_import` as `async def` and assigns it to `builtins.__import__`, which Python's import machinery calls synchronously. Calling an async function returns a coroutine without running its body, so the blocklist check never executes and `_real_import` is never called. When `CODE_INTERPRETER_BLOCKED_MODULES` is set, blocked modules are therefore not blocked, and every subsequent import inside the interpreter binds a dangling coroutine instead of the module, breaking legitimate imports as well.

Define the hook as a regular `def`, matching the working implementation in `tools/builtin.py`. A blocked top-level import now raises `ImportError`, and all other imports pass through to the real importer.
2026-07-23 12:33:44 -05:00
..
2026-07-20 22:11:42 -04:00
2026-07-01 02:48:29 -05:00
2026-06-29 11:56:00 -05:00
2026-07-23 04:16:14 -04:00
2026-07-23 12:48:23 -04:00
2026-07-16 01:34:50 -04:00
2026-03-17 17:58:01 -05:00
2026-07-23 02:54:56 -04:00
2026-07-23 02:54:56 -04:00
2026-07-23 12:48:14 -04:00
2026-06-01 13:56:55 -07:00
2026-07-01 03:35:46 -05:00
2026-06-29 13:03:14 -05:00
2026-07-16 01:37:21 -04:00
2026-07-01 02:57:29 -05:00
2026-06-29 00:18:40 -05:00
2026-07-09 17:28:34 -05:00
2026-06-23 23:35:44 +02:00
2026-03-17 17:58:01 -05:00
2026-07-20 22:11:42 -04:00
2026-06-19 00:16:06 +02:00
2026-07-10 18:32:21 -05:00
2026-07-20 22:11:42 -04:00
2026-07-16 00:58:34 -04:00
2026-06-01 13:56:55 -07:00
2026-06-29 12:29:10 -05:00
2026-06-29 13:03:14 -05:00