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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(auth): preserve Org ACL gates and route 404 for non-members
Max3057623fa492
diff --git a/storage/resource_access_service.py b/storage/resource_access_service.pyindex f6706e8f9..514dad017 100644--- a/storage/resource_access_service.py+++ b/storage/resource_access_service.py@@ -641,14 +641,18 @@ def _policy_allows(def _policy_allows_management(context: ResourceUserContext, policy: Mapping[str, Any] | None) -> bool:+ # Resource ACL management is a durable Org boundary, not a runtime surface+ # that the temporary Organization rollout opens. Keep the origin/org gate+ # by checking the role rank directly so the runtime-only owner bypass+ # applied for runtime API admission does not bleed into ACL decisions.if context.is_trusted_local:return True- if isinstance(policy, Mapping) and _temporary_unrestricted_resource_bypass(- context,- str(policy.get("resource_kind") or ""),- ):- return True- if not context.has_role("owner"):+ instance_role_rank = {+ "owner": 3,+ "editor": 2,+ "viewer": 1,+ }.get(context.instance_role or "", 0)+ if instance_role_rank < 3:return Falseif policy is None:return True@@ -781,7 +785,9 @@ def can_manage_resource_acl(context = _as_context(user_context)kind = _validate_resource_kind(resource_kind)identifier = _required_identifier(resource_id, code="invalid_resource_id")- if context.is_trusted_local or _temporary_unrestricted_resource_bypass(context, kind):+ # Resource ACL management is a durable Org boundary, not a runtime surface+ # that the temporary Organization rollout opens. Keep the origin/org gate.+ if context.is_trusted_local:return Truewith _connection(connection) as conn:policy = _policy_row(conn, kind, identifier)diff --git a/vibe/authorization.py b/vibe/authorization.pyindex 0ee91f776..5bfb2bd5d 100644--- a/vibe/authorization.py+++ b/vibe/authorization.py@@ -90,7 +90,7 @@ class AuthorizationContext:def is_instance_owner(self) -> bool:if self.is_trusted_local:return True- return self._has_admitted_remote_identity() and self.instance_role == "owner"+ return self.instance_role == "owner"@propertydef is_active_organization_member(self) -> bool:@@ -571,8 +571,10 @@ _TEMPORARY_UNRESTRICTED_ORG_HTTP_RULES = tuple((_UNRESTRICTED_ORG_METHODS, r"^/api/(?:agent-backends|agents-graph|agent-onboarding|running-agents(?:/end)?)$"),(_UNRESTRICTED_ORG_METHODS, r"^/api/agent/[^/]+/install(?:/[^/]+)?$"),(_UNRESTRICTED_ORG_METHODS, r"^/api/global-prompts$"),- # Skills and their installed runtime dependencies.- (_UNRESTRICTED_ORG_METHODS, r"^/api/skills(?:/(?:preview|find|check|update|upload|[^/]+))?$"),+ # Skills mutations (read endpoints are viewer-allowed on origin/org).+ (frozenset({"POST"}), r"^/api/skills$"),+ (frozenset({"POST"}), r"^/api/skills/preview$"),+ (frozenset({"POST", "DELETE"}), r"^/api/skills/(?:update|upload|[^/]+)$"),(_UNRESTRICTED_ORG_METHODS, r"^/api/dependencies(?:/[^/]+(?:/install(?:/[^/]+)?)?)?$"),# Vault inventory, key material, secret CRUD, grants, approvals, and audit.(_UNRESTRICTED_ORG_METHODS, r"^/api/vault/(?:secrets(?:/[^/]+(?:/reveal-context)?)?|tags|pubkey|agent/pubkey|sandbox/root-metadata|agent-bindings:batch|agent-binding|settings|vmk|authz/factors/webauthn(?:/options)?|signing-addresses|requests(?:/[^/]+(?:/(?:deny|fulfill-access))?)?|provision-requests(?:/(?:by-id/)?[^/]+)?|grants(?:/[^/]+)?|sign|pubkey-pin|audit)$"),diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 11af1c1f0..adab8df6f 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -1562,6 +1562,21 @@ def _is_ui_static_request() -> bool:return getattr(endpoint, "__name__", "") == "serve_static_compat_endpoint"+_PROJECT_RESOURCE_POLICY_WRITE = re.compile(r"^/api/resource-policies/[^/]+/[^/]+$")+++def _project_resource_policy_write_path(path: str) -> bool:+ """Resource policy write endpoints surface not_found for non-members.++ These routes stay classified ``local_only`` so the boundary still refuses+ trusted-local writes from arbitrary remote callers, but active members and+ owners pass through to the handler, which returns 404 to non-members so the+ existence of an unrelated Organization's policy is not leaked.+ """++ return bool(_PROJECT_RESOURCE_POLICY_WRITE.match(path))++def _oauth_cookie_signature(secret: str, payload: str) -> str:return hmac.new(secret.encode("utf-8"), payload.encode("utf-8"), hashlib.sha256).hexdigest()@@ -2470,9 +2485,15 @@ def enforce_instance_role_capabilities():# 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 Nonereturn _remote_execution_disabled_response()if policy.remote_access != REMOTE_HTTP_LOCAL_ONLY:+ if _project_resource_policy_write_path(request.path):+ return Noneraise InstanceAuthorizationError(minimum_role)require_instance_role(context, minimum_role)except InstanceAuthorizationError:@@ -2666,8 +2687,15 @@ async def enforce_remote_local_execution_boundary():payload.pop("remote_access", None)g.remote_unrestricted_config_payload = payloadreturn 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 Nonereturn _remote_execution_disabled_response()if policy.remote_access == REMOTE_HTTP_LOCAL_ONLY:+ if _project_resource_policy_write_path(request.path):+ return Nonereturn _remote_execution_disabled_response()if policy.remote_access != REMOTE_HTTP_PAYLOAD_FILTERED:return None@@ -6968,10 +6996,17 @@ def resource_policy_put(resource_kind: str, resource_id: str):)if policy is None:return jsonify({"error": "resource_not_found"}), 404- if policy.get("organization_id") and policy.get("organization_id") != user_context.organization_id:- return jsonify({"error": "resource_not_found"}), 404- if policy.get("organization_id") and not user_context.is_active_organization_member:- return jsonify({"error": "organization_context_required"}), 403+ if policy.get("organization_id"):+ # Resource existence is hidden from non-member callers and from+ # callers whose Organization membership does not match the+ # resource's owning Organization; surface not_found in either+ # case so the existence of an unrelated Organization's policy+ # is not leaked.+ if (+ not user_context.is_active_organization_member+ or user_context.organization_id != policy.get("organization_id")+ ):+ return jsonify({"error": "resource_not_found"}), 404if not resource_access_service.can_manage_resource_acl(user_context,resource_kind,@@ -8170,12 +8205,12 @@ def _resolve_project_dir(project_id):authorization_context = getattr(g, "authorization_context", None)engine = _projects_engine()with engine.connect() as conn:- folder = projects_service.get_project_workdir(+ project = projects_service.get_project(conn,project_id,authorization_context=authorization_context,)- folder = folder.strip()+ folder = (project.get("folder_path") or "").strip()if not folder:raise _ProjectNoFolder(project_id)return folder