"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(tools): skill remove_file restricted to the same subdirs write_file allows
Lanre Shittu45e381a800c7
diff --git a/agent/src/tools/skill_writer_tool.py b/agent/src/tools/skill_writer_tool.pyindex 899567220..a18f8615d 100644--- a/agent/src/tools/skill_writer_tool.py+++ b/agent/src/tools/skill_writer_tool.py@@ -353,6 +353,15 @@ class SkillFileTool(BaseTool):if Path(rel_path).name == "SKILL.md":return json.dumps({"status": "error", "error": "Cannot remove SKILL.md. Use delete_skill to remove the entire skill."})+ # Validate subdirectory (same allowlist as _write_file, so remove can+ # never touch a file write was never allowed to create)+ parts = Path(rel_path).parts+ if len(parts) < 2 or parts[0] not in _ALLOWED_SUBDIRS:+ return json.dumps({+ "status": "error",+ "error": f"Path must start with one of: {', '.join(sorted(_ALLOWED_SUBDIRS))}. Got: '{parts[0] if parts else ''}'",+ })+target = skill_dir / rel_pathtry:target.resolve().relative_to(skill_dir.resolve())diff --git a/agent/tests/test_skill_writer_tools.py b/agent/tests/test_skill_writer_tools.pyindex fd0d7119e..c515790cd 100644--- a/agent/tests/test_skill_writer_tools.py+++ b/agent/tests/test_skill_writer_tools.py@@ -239,6 +239,15 @@ class TestSkillFileTool:assert result["status"] == "ok"assert not (skill_dir / "assets" / "data.csv").exists()+ def test_remove_invalid_subdir(self, setup) -> None:+ tool, _, skill_dir = setup+ (skill_dir / "LICENSE").write_text("MIT", encoding="utf-8")+ result = json.loads(tool.execute(+ action="remove", skill_name="file-test", path="LICENSE",+ ))+ assert result["status"] == "error"+ assert (skill_dir / "LICENSE").exists()+def test_remove_skill_md_blocked(self, setup) -> None:tool, _, _ = setupresult = json.loads(tool.execute(