The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(platforms): the terminal secret blocklist reads no plugin files at import (safe mode)
Teknium073a3af50363
diff --git a/hermes_cli/profile_channels.py b/hermes_cli/profile_channels.pyindex e8d74bcdd37..ac04c4a71a2 100644--- a/hermes_cli/profile_channels.py+++ b/hermes_cli/profile_channels.py@@ -144,21 +144,11 @@ def _cred_row_envs(row) -> set[str]:def config_env_table_keys(entries: Iterable = ()) -> dict[str, str]:"""``{ENV_KEY: platform_id}`` for the names the gateway env overrides read outright: core's- enable-credential sets plus, for each given registry entry and every bundled platform plugin- (its ``gateway_env.py`` read from file, no adapter import), its ``env_enable_credentials`` and- every ``EnvCred`` row of its ``env_overrides``. Registry-free without *entries*, so it stays- cheap at import time; raises if the core table cannot be read."""- from types import SimpleNamespace-+ enable-credential sets plus, for each given registry entry, its ``env_enable_credentials`` and+ every ``EnvCred`` row of its ``env_overrides``. With no *entries* it is registry-free (core rows+ only), so it stays cheap at import time; raises if the core table cannot be read."""from gateway import config_env- from gateway.config import Platform- from gateway.platform_env import _BUNDLED_ENV_SIBLINGS, EnvCred, bundled_env_rows- entries = list(entries)- given = {getattr(entry, "name", "") for entry in entries}- for name in sorted((set(Platform._scan_bundled_plugin_platforms()[0]) | set(_BUNDLED_ENV_SIBLINGS)) - given):- rows = bundled_env_rows(name)- if rows:- entries.append(SimpleNamespace(name=name, env_overrides=rows[0], env_enable_credentials=rows[1]))+ from gateway.platform_env import EnvCredkeys: dict[str, str] = {}for platform, names in config_env._ENV_ENABLE_CREDENTIALS.items():keys.update(dict.fromkeys(names, platform.value))diff --git a/tools/environments/local_env_policy.py b/tools/environments/local_env_policy.pyindex 64e12c38b68..3dfb9988171 100644--- a/tools/environments/local_env_policy.py+++ b/tools/environments/local_env_policy.py@@ -110,10 +110,12 @@ def _build_adapter_secret_env() -> frozenset:CORE_DECLARED_ENV_NAMES, OPTIONAL_ENV_VARS, PLATFORM_SECRET_ENV_SUFFIXES, platform_manifest_secret_envs)from hermes_cli.profile_channels import config_env_table_keys# Read in code only, declared nowhere else: the Microsoft Graph app secret and webhook- # clientState and the QQ bot's speech-to-text key. Secrets only a plugin's ``env_overrides``- # reads (Feishu webhook keys, Yuanbao's legacy app key) come from config_env_table_keys(),- # which reads every bundled plugin's gateway_env.py without importing its adapter.- names: set[str] = {"MSGRAPH_CLIENT_SECRET", "MSGRAPH_WEBHOOK_CLIENT_STATE", "QQ_STT_API_KEY"}+ # clientState, the QQ bot's speech-to-text key, and secrets only a plugin's ``env_overrides``+ # reads (Feishu webhook keys, Yuanbao's legacy app key). Those rows live on the adapter's+ # PlatformEntry, which this import-time policy cannot load without importing every adapter;+ # tests/gateway/test_platform_env_overrides.py pins that every such secret is listed here.+ names: set[str] = {"MSGRAPH_CLIENT_SECRET", "MSGRAPH_WEBHOOK_CLIENT_STATE", "QQ_STT_API_KEY",+ "FEISHU_ENCRYPT_KEY", "FEISHU_VERIFICATION_TOKEN", "YUANBAO_APP_KEY"}names.update(name.upper() for name, meta in OPTIONAL_ENV_VARS.items()if name in CORE_DECLARED_ENV_NAMESand meta.get("category") == "messaging" and meta.get("password"))