"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(live): reject the dot broker key that aliases the global halt
Rudy Celekli828e19992b1a
diff --git a/agent/src/live/paths.py b/agent/src/live/paths.pyindex f2c780b82..621a520d4 100644--- a/agent/src/live/paths.py+++ b/agent/src/live/paths.py@@ -41,12 +41,13 @@ def broker_dir(broker: str) -> Path:``<runtime_root>/live/<broker>``. Not created here.Raises:- ValueError: If ``broker`` is empty/whitespace or contains a path- separator or ``..`` segment (a broker key is never a path).+ ValueError: If ``broker`` is empty/whitespace, is ``.``, or contains a+ path separator or ``..`` segment (a broker key is never a path)."""key = broker.strip().lower()if not key:raise ValueError("broker key must not be empty")- if "/" in key or "\\" in key or ".." in key:+ # "." would resolve to the live root itself, aliasing the global HALT.+ if key == "." or "/" in key or "\\" in key or ".." in key:raise ValueError(f"invalid broker key: {broker!r}")return live_root() / keydiff --git a/agent/tests/test_halt.py b/agent/tests/test_halt.pyindex 2f7e10897..3cfdd4f0c 100644--- a/agent/tests/test_halt.py+++ b/agent/tests/test_halt.py@@ -89,6 +89,15 @@ def test_invalid_broker_fails_closed(live_runtime: Path) -> None:assert halt.halt_flag_set("../evil") is True[email protected]("broker", [".", " . "])+def test_dot_broker_cannot_clear_the_global_halt(live_runtime: Path, broker: str) -> None:+ halt.trip_halt(by="cli", reason="global")+ with pytest.raises(ValueError):+ halt.clear_halt(broker=broker)+ assert halt.halt_path().exists()+ assert halt.halt_flag_set(broker) is True++def test_trip_is_idempotent_latest_wins(live_runtime: Path) -> None:halt.trip_halt(by="cli", reason="first")halt.trip_halt(by="frontend", reason="second")