"/v1/health",
"/models",
"/v1/models",
- "/api/tags"
+ "/api/tags",
+ "/",
+ "/index.html",
+ "/bundle.js",
+ "/bundle.css",
};
// If API key is not set, skip validation
return true;
}
- // If path is public or is static file, skip validation
- if (public_endpoints.find(req.path) != public_endpoints.end() || req.path == "/") {
+ // If path is public or static file, skip validation
+ if (public_endpoints.find(req.path) != public_endpoints.end()) {
return true;
}
assert "error" not in res.body
+def test_access_static_assets_without_api_key():
+ """Static web UI assets should not require API key authentication (issue #21229)"""
+ global server
+ server.start()
+ for path in ["/", "/bundle.js", "/bundle.css"]:
+ res = server.make_request("GET", path)
+ assert res.status_code == 200, f"Expected 200 for {path}, got {res.status_code}"
+
+
@pytest.mark.parametrize("api_key", [None, "invalid-key"])
def test_incorrect_api_key(api_key: str):
global server