fix: validate control panel runtime paths

This commit is contained in:
gti
2026-09-22 16:23:51 -03:00
parent 66b5888d80
commit 6bdac245b9
12 changed files with 42 additions and 20 deletions
+2 -1
View File
@@ -11,4 +11,5 @@ def test_fixture_creates_one_hundred_varied_installations_and_events():
assert session.query(Installation).count() == 100
assert session.query(AgentEvent).count() == 500
assert session.query(Job).count() == 100
assert {row.agent_health for row in session.query(AgentSnapshot).all()} == {"ONLINE", "DEGRADED", "OFFLINE", "FAILED"}
assert {row.agent_health for row in session.query(AgentSnapshot).all()} == {"ONLINE", "DEGRADED", "OFFLINE", "FAILED", "UNKNOWN"}
assert {row.version_drift for row in session.query(AgentSnapshot).all()} == {"CURRENT", "OUTDATED", "UNKNOWN"}
+3
View File
@@ -64,6 +64,7 @@ def test_human_login_and_dashboard_are_separate_from_agent_bearer():
response = client.post("/login", data={"username": "operator", "password": "a-secure-password"}, follow_redirects=False)
assert response.status_code == 303
assert client.get("/v1/dashboard/summary").status_code == 200
assert client.get("/v1/jobs/global").status_code == 200
assert TestClient(create_app(database_probe=lambda: True, session_factory=session_factory, bootstrap_token=None)).get("/v1/dashboard/summary", headers={"Authorization": "Bearer x"}).status_code == 401
assert client.get("/v1/agents").json()["items"][0]["installation_id"]
csrf = client.cookies.get("gti_csrf")
@@ -71,3 +72,5 @@ def test_human_login_and_dashboard_are_separate_from_agent_bearer():
assert action.status_code == 200 and action.json()["status"] == "PENDING"
denied = client.post("/v1/agents/1/actions/reprocess", json={"confirm": True, "csrf_token": "wrong", "kind": "REPROCESS_ALL"})
assert denied.status_code == 403
assert client.post("/logout").status_code == 403
assert client.post("/logout", data={"csrf_token": csrf}, follow_redirects=False).status_code == 303