Skip to content

The agent that grows with you

fix(buzz): fail closed on multiplex credential discovery

Alex P. Günsberg29ee8230be74
diff --git a/plugins/platforms/buzz/adapter.py b/plugins/platforms/buzz/adapter.py
index af3b3d8823b..2af4d5e7074 100644
--- a/plugins/platforms/buzz/adapter.py
+++ b/plugins/platforms/buzz/adapter.py
@@ -52,6 +52,7 @@ from urllib.parse import urlsplit, urlunsplit
from agent.secret_scope import UnscopedSecretError as _UnscopedSecretError
from agent.secret_scope import current_secret_scope as _current_secret_scope
from agent.secret_scope import get_secret as _scoped_get_secret
+from agent.secret_scope import is_multiplex_active as _is_multiplex_active
def _get_scoped_secret(name, default=None):
@@ -340,6 +341,8 @@ def _credentials_candidates(extra: Optional[dict] = None) -> List[Path]:
).strip()
if configured:
return [Path(configured).expanduser()]
+ if _is_multiplex_active():
+ return []
try:
return sorted(_DEFAULT_CREDENTIALS_DIR.glob("*credentials*.json"))
except OSError:
diff --git a/tests/gateway/test_buzz_adapter.py b/tests/gateway/test_buzz_adapter.py
index d1f0d0681c1..013e310df7e 100644
--- a/tests/gateway/test_buzz_adapter.py
+++ b/tests/gateway/test_buzz_adapter.py
@@ -970,6 +970,23 @@ class TestCredentialResolution:
assert _resolve_private_key() == "nsec1fromfile"
assert json.loads(_resolve_auth_tag()) == tag
+ def test_empty_multiplex_scope_never_autodiscovers_ambient_credentials(self, monkeypatch, tmp_path):
+ from agent import secret_scope as ss
+
+ tag = ["auth", "a" * 64, "", "d" * 128]
+ (tmp_path / "general_credentials.json").write_text(
+ json.dumps({"nsec": "nsec1ambient", "auth_tag": tag}), encoding="utf-8"
+ )
+ monkeypatch.setattr(_buzz_mod, "_DEFAULT_CREDENTIALS_DIR", tmp_path)
+ ss.set_multiplex_active(True)
+ token = ss.set_secret_scope({})
+ try:
+ assert _resolve_private_key() == ""
+ assert _resolve_auth_tag() == ""
+ finally:
+ ss.reset_secret_scope(token)
+ ss.set_multiplex_active(False)
+
# ── Env enablement / registration / standalone send ──────────────────────