From e41ac7ca628ac8e29923fa6912a93e1f79836f49 Mon Sep 17 00:00:00 2001 From: zhangx1n Date: Wed, 18 Jun 2025 16:12:43 +0800 Subject: [PATCH] fix: improve plugin installation scope checks for verification --- api/services/plugin/plugin_service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/services/plugin/plugin_service.py b/api/services/plugin/plugin_service.py index eb92b16924..d7fb4a7c1b 100644 --- a/api/services/plugin/plugin_service.py +++ b/api/services/plugin/plugin_service.py @@ -105,16 +105,19 @@ class PluginService: @staticmethod def _check_plugin_installation_scope(plugin_verification: Optional[PluginVerification]): """ - Check the verification of the plugin + Check the plugin installation scope """ features = FeatureService.get_system_features() match features.plugin_installation_permission.plugin_installation_scope: case PluginInstallationScope.OFFICIAL_ONLY: - if plugin_verification.authorized_category != PluginVerification.AuthorizedCategory.Langgenius: + if ( + plugin_verification is None + or plugin_verification.authorized_category != PluginVerification.AuthorizedCategory.Langgenius + ): raise PluginInstallationForbiddenError("Plugin installation is restricted to official only") case PluginInstallationScope.OFFICIAL_AND_SPECIFIC_PARTNERS: - if plugin_verification.authorized_category not in [ + if plugin_verification is None or plugin_verification.authorized_category not in [ PluginVerification.AuthorizedCategory.Langgenius, PluginVerification.AuthorizedCategory.Partner, ]: