Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(remote): reject partial organization claims

Maxvint72232020cf9b
diff --git a/tests/test_remote_access_vibe_cloud.py b/tests/test_remote_access_vibe_cloud.py
index 9d21ee0e5..39a03868b 100644
--- a/tests/test_remote_access_vibe_cloud.py
+++ b/tests/test_remote_access_vibe_cloud.py
@@ -135,6 +135,20 @@ def test_session_claims_reject_external_guest_organization_context() -> None:
)
+def test_session_claims_reject_partial_organization_context() -> None:
+ config = _config()
+
+ with pytest.raises(remote_access.OAuthCodeExchangeError, match="invalid_organization_claims"):
+ remote_access.session_claims_from_oidc(
+ config,
+ {
+ "vibe_instance_id": "inst_123",
+ "vibe_instance_access_source": "owner",
+ "vibe_organization_id": None,
+ },
+ )
+
+
def test_exchange_oauth_code_returns_claims_safe_for_the_local_session(monkeypatch) -> None:
config = _config()
diff --git a/vibe/remote_access.py b/vibe/remote_access.py
index b1cd2a977..49756f606 100644
--- a/vibe/remote_access.py
+++ b/vibe/remote_access.py
@@ -2388,7 +2388,10 @@ def session_claims_from_oidc(config: V2Config, claims: Mapping[str, Any]) -> dic
if instance_id != config.remote_access.vibe_cloud.instance_id:
raise OAuthCodeExchangeError("invalid_instance_id")
access_source_raw = claims.get("vibe_instance_access_source")
- organization_claim_present = any(key in claims and claims.get(key) is not None for key in _ORGANIZATION_SESSION_CLAIM_KEYS)
+ # An explicit null is not equivalent to an omitted organization claim. It
+ # is a malformed frozen-claim shape and must not silently downgrade into a
+ # base-only session.
+ organization_claim_present = any(key in claims for key in _ORGANIZATION_SESSION_CLAIM_KEYS)
if access_source_raw is None:
raise OAuthCodeExchangeError("invalid_instance_access_source")
access_source = _oidc_claim_string(access_source_raw, reason="invalid_instance_access_source")