mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-08 08:11:38 +00:00
fix(feishu): require webhook auth secret and honor config extras (#30746)
This commit is contained in:
parent
bdb97b8573
commit
197f63f454
2 changed files with 42 additions and 2 deletions
|
|
@ -3191,6 +3191,39 @@ class TestWebhookSecurity(unittest.TestCase):
|
|||
response = asyncio.run(adapter._handle_webhook_request(request))
|
||||
self.assertEqual(response.status, 401)
|
||||
|
||||
@patch.dict(os.environ, {}, clear=True)
|
||||
def test_webhook_connect_requires_inbound_auth_secret(self):
|
||||
from gateway.config import PlatformConfig
|
||||
from gateway.platforms.feishu import FeishuAdapter
|
||||
|
||||
adapter = FeishuAdapter(
|
||||
PlatformConfig(
|
||||
enabled=True,
|
||||
extra={"app_id": "cli_app", "app_secret": "secret_app", "connection_mode": "webhook"},
|
||||
)
|
||||
)
|
||||
self.assertFalse(asyncio.run(adapter.connect()))
|
||||
|
||||
@patch.dict(os.environ, {}, clear=True)
|
||||
def test_webhook_loads_auth_secrets_from_platform_extra(self):
|
||||
from gateway.config import PlatformConfig
|
||||
from gateway.platforms.feishu import FeishuAdapter
|
||||
|
||||
adapter = FeishuAdapter(
|
||||
PlatformConfig(
|
||||
enabled=True,
|
||||
extra={
|
||||
"app_id": "cli_app",
|
||||
"app_secret": "secret_app",
|
||||
"connection_mode": "webhook",
|
||||
"verification_token": "token_from_extra",
|
||||
"encrypt_key": "encrypt_from_extra",
|
||||
},
|
||||
)
|
||||
)
|
||||
self.assertEqual(adapter._verification_token, "token_from_extra")
|
||||
self.assertEqual(adapter._encrypt_key, "encrypt_from_extra")
|
||||
|
||||
@patch.dict(os.environ, {}, clear=True)
|
||||
def test_webhook_url_verification_challenge_passes_without_signature(self):
|
||||
"""Challenge requests must succeed even when no encrypt_key is set."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue