ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(extensions): reject dictionary port mappings without loopback host binding (#8145)
Vaibhav Srivastava66adf4cc53ad
diff --git a/ods/extensions/services/dashboard-api/routers/extensions.py b/ods/extensions/services/dashboard-api/routers/extensions.pyindex 1fca5611b..11aab593e 100644--- a/ods/extensions/services/dashboard-api/routers/extensions.py+++ b/ods/extensions/services/dashboard-api/routers/extensions.py@@ -1385,7 +1385,7 @@ def _scan_compose_content(if isinstance(port, dict):# Dict-form: {target: 80, published: 8080, host_ip: ...}host_ip = port.get("host_ip", "")- if port.get("published") and not _host_part_is_loopback(host_ip):+ if not _host_part_is_loopback(host_ip):raise HTTPException(status_code=400,detail=(diff --git a/ods/extensions/services/dashboard-api/tests/test_extensions.py b/ods/extensions/services/dashboard-api/tests/test_extensions.pyindex 70e7fe4d4..c7dd5bf15 100644--- a/ods/extensions/services/dashboard-api/tests/test_extensions.py+++ b/ods/extensions/services/dashboard-api/tests/test_extensions.py@@ -2668,6 +2668,26 @@ class TestComposeScanEdgeCases:assert resp.status_code == 400assert "GPU passthrough" in resp.json()["detail"]+ def test_scan_rejects_dict_port_omitting_published_without_loopback(+ self, test_client, monkeypatch, tmp_path,+ ):+ """400 when compose dictionary port omits published and host_ip (Issue #6907)."""+ compose = (+ "services:\n svc:\n image: test\n"+ " ports:\n - target: 80\n"+ )+ lib_dir = _setup_library_ext(tmp_path, "dict-port-ext", compose_content=compose)+ _patch_mutation_config(monkeypatch, tmp_path, lib_dir=lib_dir)++ resp = test_client.post(+ "/api/extensions/dict-port-ext/install",+ headers=test_client.auth_headers,+ )+ assert resp.status_code == 400+ assert "dict port binding" in resp.json()["detail"]+ assert "127.0.0.1" in resp.json()["detail"]++# --- Direct unit tests for the port-binding helpers ---