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(auth): remove remote local-only execution gate

Maxb39318b585ac
diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.py
index 508baeb29..cca62cfde 100644
--- a/tests/test_instance_authorization.py
+++ b/tests/test_instance_authorization.py
@@ -3,9 +3,7 @@ import pytest
from vibe.authorization import (
AuthorizationContext,
InstanceAuthorizationError,
- REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER,
REMOTE_HTTP_ALLOWED,
- REMOTE_HTTP_LOCAL_ONLY,
can_receive_workbench_event,
context_from_session_payload,
has_temporary_unrestricted_org_access,
@@ -214,73 +212,20 @@ def test_show_page_email_context_requires_and_matches_one_exact_target() -> None
assert elevated_role.can_use_show_page("session-one") is False
-def test_http_policy_keeps_unknown_routes_fail_closed_and_runtime_matrix_explicit() -> None:
- runtime_routes = (
- ("GET", "/api/harness/bootstrap"),
- ("PATCH", "/api/harness/tasks/task-1"),
- ("POST", "/api/agents"),
- ("POST", "/api/skills"),
- ("PATCH", "/api/vault/secrets/secret-1"),
- ("PATCH", "/api/memory/settings"),
- ("GET", "/api/memory/processing-record"),
- ("GET", "/api/memory/maintenance"),
- ("POST", "/api/memory/runtime/rebuild"),
- ("POST", "/api/memory/runtime/factory-reset"),
- ("POST", "/api/memory/runtime/repair"),
- ("POST", "/api/memory/clear/resume"),
- ("POST", "/api/memory/clear/abort"),
- ("POST", "/api/control"),
+def test_http_policy_uses_role_authorization_without_local_only_transport_gates() -> None:
+ for method, path in (
+ ("GET", "/api/projects"),
+ ("GET", "/api/workbench/projects-bootstrap"),
+ ("GET", "/api/sessions"),
("POST", "/api/config"),
- ("GET", "/api/models/sources"),
- ("POST", "/api/models/runtime/start"),
- ("POST", "/api/backend/codex/restart"),
- ("POST", "/api/backend/claude/auth/oauth/start"),
- ("GET", "/api/dependencies"),
- ("POST", "/api/dependencies/avault/install"),
- ("PUT", "/api/projects/proj-1/agents-md"),
("POST", "/api/files/upload"),
- ("DELETE", "/api/terminal/term-1"),
- ("POST", "/api/show-pages/ses-1/icon"),
- ("POST", "/show/ses-1/api/action"),
- ("GET", "/api/users"),
- ("POST", "/api/users/user-1/admin"),
- ("DELETE", "/api/users/user-1"),
- ("GET", "/api/bind-codes"),
- ("POST", "/api/bind-codes"),
- ("DELETE", "/api/bind-codes/code-1"),
- ("GET", "/api/setup/first-bind-code"),
- ("GET", "/status"),
- )
- for method, path in runtime_routes:
- policy = http_authorization_policy(method, path)
- assert policy.remote_access == REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER, (method, path)
-
- for method, path in (
- ("GET", "/api/future-owner-capability"),
- ("POST", "/api/harness/future-capability"),
- ("GET", "/api/opencode/future-capability"),
- ("GET", "/api/backend/future/runtime"),
- ("GET", "/api/users/user-1"),
- ("POST", "/api/bind-codes/code-1"),
- ):
- policy = http_authorization_policy(method, path)
- assert policy.minimum_role == "owner"
- assert policy.remote_access == REMOTE_HTTP_LOCAL_ONLY
-
- for method, path in (
("POST", "/api/remote-access/vibe-cloud/pair"),
- ("POST", "/api/remote-access/start"),
- ("POST", "/api/remote-access/stop"),
- ("POST", "/api/remote-access/optimize-route"),
- ("POST", "/api/remote-access/settings"),
- ("POST", "/api/remote-access/diagnostics"),
- ("GET", "/api/remote-access/network-interfaces"),
+ ("GET", "/api/future-owner-capability"),
):
- assert http_authorization_policy(method, path).remote_access == REMOTE_HTTP_LOCAL_ONLY
+ assert http_authorization_policy(method, path).remote_access == REMOTE_HTTP_ALLOWED
def test_http_policy_preserves_safe_remote_reads_and_show_routes() -> None:
- assert http_authorization_policy("GET", "/api/projects").remote_access == REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER
assert http_authorization_policy("GET", "/api/org/context").remote_access == REMOTE_HTTP_ALLOWED
assert http_authorization_policy("GET", "/api/cloud-management/session").remote_access == REMOTE_HTTP_ALLOWED
assert http_authorization_policy("GET", "/show/ses-1/").remote_access == REMOTE_HTTP_ALLOWED
diff --git a/vibe/authorization.py b/vibe/authorization.py
index ec8f56f8d..7e2bddc95 100644
--- a/vibe/authorization.py
+++ b/vibe/authorization.py
@@ -57,9 +57,6 @@ _PRIVILEGED_RUNTIME_WORKBENCH_EVENTS = frozenset(
)
REMOTE_HTTP_ALLOWED = "allowed"
-REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER = "active_organization_member"
-REMOTE_HTTP_LOCAL_ONLY = "local_only"
-REMOTE_HTTP_PAYLOAD_FILTERED = "payload_filtered"
@dataclass(frozen=True)
@@ -497,7 +494,7 @@ _EDITOR_HTTP_RULES = tuple(
)
)
-_REMOTE_LOCAL_ONLY_HTTP_RULES = tuple(
+'''_REMOTE_LOCAL_ONLY_HTTP_RULES = tuple(
(method, re.compile(pattern))
for method, pattern in (
("DELETE", r"^/api/sessions/[^/]+(?:/queue/[^/]+)?$"),
@@ -726,7 +723,7 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(
(frozenset({"GET", "HEAD"}), r"^/api/memory/(?:status|profile)$"),
(frozenset({"POST"}), r"^/api/memory/search$"),
)
-)
+)'''
def _http_rule_matches(
@@ -737,26 +734,6 @@ def _http_rule_matches(
return any(rule_method == method and pattern.fullmatch(path) for rule_method, pattern in rules)
-def _owner_http_rule_matches(method: str, path: str) -> bool:
- return any(
- method in methods and pattern.fullmatch(path)
- for methods, pattern in _REMOTE_OWNER_ALLOWED_HTTP_RULES
- )
-
-
-def _temporary_unrestricted_org_rule_matches(method: str, path: str) -> bool:
- return any(
- method in methods and pattern.fullmatch(path)
- for methods, pattern in _TEMPORARY_UNRESTRICTED_ORG_HTTP_RULES
- )
-
-
-def _temporary_organization_app_rule_matches(method: str, path: str) -> bool:
- """Compatibility alias for the previous Apps-only policy matcher."""
-
- return _temporary_unrestricted_org_rule_matches(method, path)
-
-
def http_authorization_policy(
method: str,
path: str,
@@ -765,9 +742,9 @@ def http_authorization_policy(
) -> HttpAuthorizationPolicy:
"""Return role and remote-exposure policy for one HTTP request.
- Explicit viewer/editor and owner-management routes keep their approved remote
- behavior. Unknown API routes fail closed to trusted-local callers so adding a
- new owner-only endpoint cannot silently expose local machine capabilities.
+ Remote requests use the same role and resource authorization as local requests.
+ The former trust-local/local-only transport boundary was transitional and is
+ intentionally removed; unknown API routes still default to owner role.
"""
normalized_method = method.upper()
@@ -785,30 +762,13 @@ def http_authorization_policy(
path,
)
minimum_role = "viewer"
- remote_access = (
- REMOTE_HTTP_ALLOWED
- if is_read or is_safe_human_event
- else REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER
- )
- return HttpAuthorizationPolicy(minimum_role, remote_access)
+ return HttpAuthorizationPolicy(minimum_role)
if path == "/status":
- return HttpAuthorizationPolicy(None, REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER)
+ return HttpAuthorizationPolicy(None)
if not path.startswith("/api/"):
return HttpAuthorizationPolicy(None)
- if _temporary_unrestricted_org_rule_matches(normalized_method, path):
- # The matrix is an identity-independent route classification. The
- # request boundary below admits it only after verifying the signed
- # active-Organization claim; ordinary remote callers still receive
- # ``remote_execution_disabled`` there. The optional keyword is retained
- # for callers from the previous Apps-only rollout, but classification is
- # deliberately context-independent.
- minimum_role = (
- "owner"
- if re.fullmatch(r"^/api/projects/[^/]+/agents-md$", path)
- else "viewer"
- )
- return HttpAuthorizationPolicy(minimum_role, REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER)
-
+ # Route exposure is no longer split into local-only and remote-only
+ # matrices. Every API reaches the role/resource checks below.
minimum_role = "owner"
if _http_rule_matches(normalized_method, path, _VIEWER_HTTP_MUTATION_RULES):
# These mutations enforce Show Page ownership and Organization authority
@@ -825,22 +785,7 @@ def http_authorization_policy(
):
minimum_role = "viewer"
- if _http_rule_matches(normalized_method, path, _REMOTE_LOCAL_ONLY_HTTP_RULES):
- remote_access = REMOTE_HTTP_LOCAL_ONLY
- elif _http_rule_matches(
- normalized_method,
- path,
- _REMOTE_PAYLOAD_FILTERED_HTTP_RULES,
- ):
- remote_access = REMOTE_HTTP_PAYLOAD_FILTERED
- elif minimum_role in {"viewer", "editor"} or _owner_http_rule_matches(
- normalized_method,
- path,
- ):
- remote_access = REMOTE_HTTP_ALLOWED
- else:
- remote_access = REMOTE_HTTP_LOCAL_ONLY
- return HttpAuthorizationPolicy(minimum_role, remote_access)
+ return HttpAuthorizationPolicy(minimum_role)
def required_instance_role(method: str, path: str) -> str | None:
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 5651be207..9a4d756ff 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -2444,9 +2444,6 @@ def enforce_instance_role_capabilities():
return None
from vibe.authorization import (
InstanceAuthorizationError,
- REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER,
- REMOTE_HTTP_LOCAL_ONLY,
- has_temporary_unrestricted_org_access,
http_authorization_policy,
require_instance_role,
)
@@ -2475,30 +2472,6 @@ def enforce_instance_role_capabilities():
try:
if context is None:
raise InstanceAuthorizationError(minimum_role)
- # The temporary Organization rollout admits active members. Other remote
- # principals on API runtime routes fail the active-Organization admission
- # check here, before role rank. Viewer-allowed reads already have
- # origin/org admission and are not subject to this gate.
- if (
- context.is_remote
- and minimum_role == "owner"
- and request.path.startswith("/api/")
- and not has_temporary_unrestricted_org_access(context)
- ):
- # Routes classified for the temporary rollout and existing
- # trusted-local routes retain the remote-execution error contract.
- # Ordinary remotely exposed runtime APIs instead fail the active
- # Organization membership admission check here, before role rank.
- # Resource policy write endpoints defer to the handler so non-members
- # get not_found (no existence leak).
- if policy.remote_access == REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER:
- if _project_resource_policy_write_path(request.path):
- return None
- return _remote_execution_disabled_response()
- if policy.remote_access != REMOTE_HTTP_LOCAL_ONLY:
- if _project_resource_policy_write_path(request.path):
- return None
- raise InstanceAuthorizationError(minimum_role)
require_instance_role(context, minimum_role)
except InstanceAuthorizationError:
return jsonify(
@@ -2622,91 +2595,15 @@ def _remote_mutable_config_payload(payload: dict[str, Any]) -> dict[str, Any]:
def _remote_payload_is_allowed(method: str, path: str, payload: Any) -> bool:
- normalized_method = method.upper()
- if normalized_method == "POST" and path == "/api/config":
- return _remote_config_payload_is_allowed(payload)
- if normalized_method == "POST" and path == "/api/sessions":
- return _payload_has_only_fields(payload, {"project_id", "title"})
- if normalized_method == "PATCH" and re.fullmatch(r"/api/sessions/[^/]+", path):
- return _payload_has_only_fields(payload, {"title"})
- if normalized_method == "PATCH" and re.fullmatch(r"/api/projects/[^/]+", path):
- return _payload_has_only_fields(payload, {"display_name"})
- return False
-
-
-def _is_remote_local_execution_request(method: str, path: str, payload: Any = None) -> bool:
- from vibe.authorization import (
- REMOTE_HTTP_LOCAL_ONLY,
- REMOTE_HTTP_PAYLOAD_FILTERED,
- http_authorization_policy,
- )
-
- remote_access = http_authorization_policy(
- method,
- path,
- ).remote_access
- if remote_access == REMOTE_HTTP_LOCAL_ONLY:
- return True
- if remote_access != REMOTE_HTTP_PAYLOAD_FILTERED:
- return False
- return not _remote_payload_is_allowed(method, path, payload)
+ """Compatibility helper retained for callers; remote payloads are unrestricted."""
+ return True
-async def enforce_remote_local_execution_boundary():
- """Keep unapproved local-machine capabilities on the trusted-local origin."""
- try:
- context = getattr(g, "authorization_context", None)
- except (LookupError, RuntimeError):
- context = None
- if context is None or not context.is_remote:
- return None
- from vibe.authorization import (
- REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER,
- REMOTE_HTTP_LOCAL_ONLY,
- REMOTE_HTTP_PAYLOAD_FILTERED,
- has_temporary_unrestricted_org_access,
- http_authorization_policy,
- )
+def _is_remote_local_execution_request(method: str, path: str, payload: Any = None) -> bool:
+ """Compatibility helper; the transitional local-only boundary is removed."""
- policy = getattr(g, "http_authorization_policy", None)
- if policy is None:
- policy = http_authorization_policy(
- request.method,
- request.path,
- )
- if policy.remote_access == REMOTE_HTTP_ACTIVE_ORGANIZATION_MEMBER:
- if has_temporary_unrestricted_org_access(context):
- if request.method == "POST" and request.path == "/api/config":
- # Runtime configuration is temporarily writable for active
- # Organization members, but remote access identity/tunnel
- # settings remain control-plane owned. Drop that block before
- # it reaches the generic config merge/save path.
- payload = await request.load_json()
- if isinstance(payload, dict):
- payload = dict(payload)
- payload.pop("remote_access", None)
- g.remote_unrestricted_config_payload = payload
- return None
- # Org resource policy writes keep the local-only classification but the
- # handler returns 404 for non-members (no existence leak). Defer to the
- # handler so callers learn not_found instead of remote_execution_disabled.
- if _project_resource_policy_write_path(request.path):
- return None
- return _remote_execution_disabled_response()
- if policy.remote_access == REMOTE_HTTP_LOCAL_ONLY:
- if _project_resource_policy_write_path(request.path):
- return None
- return _remote_execution_disabled_response()
- if policy.remote_access != REMOTE_HTTP_PAYLOAD_FILTERED:
- return None
- payload = await request.load_json()
- if _is_remote_local_execution_request(request.method, request.path, payload):
- return _remote_execution_disabled_response()
- if request.method == "POST" and request.path == "/api/config":
- g.remote_mutable_config_payload = _remote_mutable_config_payload(payload)
- return None
+ return False
_PROJECT_RESOURCE_PATHS = (
@@ -5940,15 +5837,7 @@ async def config_post():
from vibe import internal_client
from vibe import remote_access
- remote_mutable_payload = getattr(g, "remote_mutable_config_payload", None)
- unrestricted_payload = getattr(g, "remote_unrestricted_config_payload", None)
- payload = (
- unrestricted_payload
- if unrestricted_payload is not None
- else remote_mutable_payload
- if remote_mutable_payload is not None
- else request.json or {}
- )
+ payload = request.json or {}
remote_access_runtime = None
try:
(