Skip to content

armgit / strix

Public Imported from GitHub
0

Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.

fix: address review feedback on tool registration gating

0xallamc9d2477144f8
diff --git a/strix/tools/registry.py b/strix/tools/registry.py
index 329db132..614197aa 100644
--- a/strix/tools/registry.py
+++ b/strix/tools/registry.py
@@ -195,7 +195,6 @@ def register_tool(
requires_web_search_mode: bool = False,
) -> Callable[..., Any]:
def decorator(f: Callable[..., Any]) -> Callable[..., Any]:
- sandbox_mode = _is_sandbox_mode()
if not _should_register_tool(
sandbox_execution=sandbox_execution,
requires_browser_mode=requires_browser_mode,
@@ -203,6 +202,7 @@ def register_tool(
):
return f
+ sandbox_mode = _is_sandbox_mode()
func_dict = {
"name": f.__name__,
"function": f,
diff --git a/tests/tools/test_tool_registration_modes.py b/tests/tools/test_tool_registration_modes.py
index 1336a482..b50d2672 100644
--- a/tests/tools/test_tool_registration_modes.py
+++ b/tests/tools/test_tool_registration_modes.py
@@ -58,7 +58,7 @@ def test_sandbox_registers_sandbox_tools_but_not_non_sandbox_tools(
assert "web_search" not in names
-def test_load_skill_does_not_register_agents_graph_when_imported_directly(
+def test_load_skill_import_does_not_register_create_agent_in_sandbox(
monkeypatch: Any,
) -> None:
monkeypatch.setenv("STRIX_SANDBOX_MODE", "true")
@@ -75,7 +75,6 @@ def test_load_skill_does_not_register_agents_graph_when_imported_directly(
registry = importlib.import_module("strix.tools.registry")
names_before = set(registry.get_tool_names())
- assert "python_action" in names_before
assert "load_skill" not in names_before
assert "create_agent" not in names_before