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.

Merge remote-tracking branch 'origin/master' into feature/web-ui-redesign

cyh2948bd5753a8
diff --cc vibe/ui_server.py
index 821b2dd83,a18d98c2b..5e635169b
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@@ -228,43 -228,62 +228,93 @@@ def _is_loopback_host(value: str | None
return False
+def _is_private_peer() -> bool:
+ remote_addr = (request.remote_addr or "").strip()
+ if not remote_addr or remote_addr == "localhost":
+ return False
+ try:
+ address = ipaddress.ip_address(remote_addr)
+ except ValueError:
+ return False
+ if address.is_loopback or address.is_private or address.is_link_local:
+ return True
+ mapped = getattr(address, "ipv4_mapped", None)
+ if mapped is not None:
+ return mapped.is_loopback or mapped.is_private or mapped.is_link_local
+ return False
+
+
+ def _env_flag_enabled(name: str) -> bool:
+ return os.environ.get(name, "").lower() in {"1", "true", "yes", "on"}
+
+
+ def _has_loopback_only_docker_port_binding() -> bool:
+ bind_host = os.environ.get("VIBE_REMOTE_DOCKER_LOOPBACK_BIND_HOST")
+ if not bind_host:
+ return False
+ return _is_loopback_host(bind_host)
+
+
+ def _is_trusted_docker_peer() -> bool:
+ if not _env_flag_enabled("VIBE_REMOTE_ALLOW_DOCKER_LOOPBACK_PEERS"):
+ return False
+ if not _has_loopback_only_docker_port_binding():
+ return False
+
+ remote_addr = (request.remote_addr or "").strip()
+ try:
+ address = ipaddress.ip_address(remote_addr)
+ except ValueError:
+ return False
+ address = getattr(address, "ipv4_mapped", None) or address
+
+ cidrs = os.environ.get("VIBE_REMOTE_DOCKER_LOOPBACK_PEER_CIDRS", "172.16.0.0/12,192.168.65.0/24")
+ for raw_network in cidrs.split(","):
+ raw_network = raw_network.strip()
+ if not raw_network:
+ continue
+ try:
+ network = ipaddress.ip_network(raw_network, strict=False)
+ except ValueError:
+ continue
+ if address in network:
+ return True
+ return False
+
+
+ def _is_trusted_docker_loopback_probe() -> bool:
+ if request.method not in {"GET", "HEAD"}:
+ return False
+ if request.path not in {"/health", "/status"}:
+ return False
+ if _has_cloudflare_forwarded_metadata():
+ return False
+ if not _is_loopback_host(request.host):
+ return False
+ return _is_trusted_docker_peer()
+
+
-def _is_local_request() -> bool:
+def _is_setup_host_request(config: V2Config | None) -> bool:
+ if config is None:
+ return False
+ setup_host = _normalized_host(getattr(config.ui, "setup_host", ""))
+ if not setup_host or setup_host in {"0.0.0.0", "::", "*"}:
+ return False
+ if _is_loopback_host(setup_host):
+ return False
+ if _normalized_host(request.host) != setup_host:
+ return False
if _has_cloudflare_forwarded_metadata():
return False
- if not _is_loopback_host(request.host):
+ return _is_private_peer()
+
+
+def _is_local_request(config: V2Config | None = None) -> bool:
+ if _has_cloudflare_forwarded_metadata():
return False
- return _is_loopback_peer()
+ if _is_loopback_peer() and _is_loopback_host(request.host):
+ return True
+ return _is_setup_host_request(config)
def _normalized_host(value: str | None) -> str:
@@@ -405,12 -428,13 +459,13 @@@ def _redirect_to_vibe_cloud_login(confi
@app.before_request
def enforce_remote_access_cookie():
config = _load_remote_access_config()
- local_request = _is_local_request()
+ local_request = _is_local_request(config)
+ docker_probe_request = _is_trusted_docker_loopback_probe()
if config is None:
- if local_request:
+ if local_request or docker_probe_request:
return None
return jsonify({"ok": False, "error": "remote_access_config_unavailable"}), 503
- if _remote_access_public_url_invalid(config) and not local_request:
+ if _remote_access_public_url_invalid(config) and not (local_request or docker_probe_request):
return jsonify({"ok": False, "error": "remote_access_public_url_invalid"}), 503
remote_request = _is_remote_access_request(config)
if not remote_request: