hermes-agent/tools
Teknium 62348cffbe
fix(acp): wire approval callback + make it thread-local (#13525)
Two related ACP approval issues:

GHSA-96vc-wcxf-jjff — ACP's _run_agent never set HERMES_INTERACTIVE
(or any other flag recognized by tools.approval), so check_all_command_guards
took the non-interactive auto-approve path and never consulted the
ACP-supplied approval callback (conn.request_permission). Dangerous
commands executed in ACP sessions without operator approval despite
the callback being installed. Fix: set HERMES_INTERACTIVE=1 around
the agent run so check_all_command_guards routes through
prompt_dangerous_approval(approval_callback=...) — the correct shape
for ACP's per-session request_permission call. HERMES_EXEC_ASK would
have routed through the gateway-queue path instead, which requires a
notify_cb registered in _gateway_notify_cbs (not applicable to ACP).

GHSA-qg5c-hvr5-hjgr — _approval_callback and _sudo_password_callback
were module-level globals in terminal_tool. Concurrent ACP sessions
running in ThreadPoolExecutor threads each installed their own callback
into the same slot, racing. Fix: store both callbacks in threading.local()
so each thread has its own slot. CLI mode (single thread) is unaffected;
gateway mode uses a separate queue-based approval path and was never
touched.

set_approval_callback is now called INSIDE _run_agent (the executor
thread) rather than before dispatching — so the TLS write lands on the
correct thread.

Tests: 5 new in tests/acp/test_approval_isolation.py covering
thread-local isolation of both callbacks and the HERMES_INTERACTIVE
callback routing. Existing tests/acp/ (159 tests) and tests/tools/
approval-related tests continue to pass.

Fixes GHSA-96vc-wcxf-jjff
Fixes GHSA-qg5c-hvr5-hjgr
2026-04-21 06:20:40 -07:00
..
browser_providers feat: ungate Tool Gateway — subscription-based access with per-tool opt-in 2026-04-16 12:36:49 -07:00
environments
neutts_samples
__init__.py
ansi_strip.py
approval.py
binary_extensions.py
browser_camofox.py
browser_camofox_state.py
browser_cdp_tool.py
browser_tool.py
budget_config.py
checkpoint_manager.py
clarify_tool.py
code_execution_tool.py
credential_files.py
cronjob_tools.py
debug_helpers.py
delegate_tool.py
discord_tool.py
env_passthrough.py
feishu_doc_tool.py
feishu_drive_tool.py
file_operations.py
file_tools.py
fuzzy_match.py
homeassistant_tool.py fix: clean up description escaping, add string-data tests 2026-04-13 04:45:07 -07:00
image_generation_tool.py
interrupt.py
managed_tool_gateway.py
mcp_oauth.py
mcp_oauth_manager.py
mcp_tool.py
memory_tool.py
mixture_of_agents_tool.py
neutts_synth.py
openrouter_client.py
osv_check.py
patch_parser.py
path_security.py
process_registry.py
registry.py
rl_training_tool.py
send_message_tool.py
session_search_tool.py
skill_manager_tool.py
skills_guard.py
skills_hub.py
skills_sync.py
skills_tool.py
terminal_tool.py fix(acp): wire approval callback + make it thread-local (#13525) 2026-04-21 06:20:40 -07:00
tirith_security.py
todo_tool.py
tool_backend_helpers.py
tool_result_storage.py
transcription_tools.py
tts_tool.py
url_safety.py
vision_tools.py
voice_mode.py
web_tools.py
website_policy.py
xai_http.py