Skip to content

The agent that grows with you

refactor(a2a): collapse duplicated loopback branch in is_trusted_peer

kshitijk4poor9878bf9696c6
diff --git a/plugins/platforms/a2a/security.py b/plugins/platforms/a2a/security.py
index 9b57e9363cc..129670ce81d 100644
--- a/plugins/platforms/a2a/security.py
+++ b/plugins/platforms/a2a/security.py
@@ -114,11 +114,9 @@ class A2ASecurityContext:
binds without an allow-list stay open for backward compatibility."""
if self.allow_all_users:
return True
- if self.is_loopback_bind():
- if not self.trusted_peers:
- return True
- return identity in self.trusted_peers
if not self.trusted_peers:
+ if self.is_loopback_bind():
+ return True
logger.error(
"A2A: adapter exposed on a non-loopback bind (%s) with no A2A_TRUSTED_PEERS; "
"refusing dispatch. Set A2A_TRUSTED_PEERS, or A2A_ALLOW_ALL_USERS=true for a trusted network.",