The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui-gateway): tools.* RPCs answer 4064 for traversal-shaped profile params
teknium14ad60ac475d8
diff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.pyindex 0aaeaff758f..7be2157a9af 100644--- a/tests/hermes_cli/test_profiles.py+++ b/tests/hermes_cli/test_profiles.py@@ -105,9 +105,6 @@ class TestGetProfileDir:result = get_profile_dir("default")assert result == tmp_path / ".hermes"- def test_valid_name_resolves_under_profiles_root(self, profile_env):- assert get_profile_dir("coder") == _get_profiles_root() / "coder"-@pytest.mark.parametrize("name", ["..", "../outside", "../../tmp", "a/b", "a\\b", ".hidden", "has space"])def test_traversal_and_invalid_names_rejected(self, name, profile_env):# The name becomes a path component under profiles/; invalid ids mustdiff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.pyindex 34241392672..70161a5a77c 100644--- a/tui_gateway/methods_tools.py+++ b/tui_gateway/methods_tools.py@@ -41,7 +41,10 @@ def _profile_scoped_rpc(token = Noneif profile := _str_arg(params, "profile") if scoped else "":try:- profile_dir = _tools_mod("hermes_cli.profiles").get_profile_dir(profile)+ try:+ profile_dir = _tools_mod("hermes_cli.profiles").get_profile_dir(profile)+ except ValueError: # traversal-shaped name: same answer as a missing dir+ profile_dir = Noneif not profile_dir or not profile_dir.is_dir():return _err(rid, 4064, f"profile '{profile}' not found")token = _tools_mod("hermes_constants").set_hermes_home_override(str(profile_dir))