fix(security): register shell hooks in TUI gateway and ACP adapter entry points - #41555
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(security): register shell hooks in TUI gateway and ACP adapter entry points#41555liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…try points Shell hooks (pre_tool_call block hooks) were silently ignored in the desktop app (TUI gateway) and ACP adapter (IDE integration) because register_from_config() was never called. This created a security gap where hook-configured tool vetoes were bypassed in those surfaces. Mirror the gateway/run.py registration pattern in both entry points.
Collaborator
Contributor
Author
|
Thanks for the flag @alt-glitch. Comparing the two PRs:
The production code changes are equivalent, but this PR includes comprehensive test coverage that #41464 lacks. Keeping open — happy to consolidate if #41464 is preferred by maintainers. |
Contributor
Author
|
Update: #41464 by @EdderTalmor has been APPROVED by @tonydwb. Both PRs address the same issue (#41457) with equivalent production code changes. #41464 was opened first and has already received maintainer approval, so closing this PR in favor of #41464. Thanks for the review @tonydwb — looking forward to seeing #41464 merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Registers declarative shell hooks from
config.yamlin the TUI gateway (desktop app) and ACP adapter (IDE integration) entry points, mirroring the existing registration incli.pyandgateway/run.py. Without this fix,pre_tool_callblock hooks are silently ignored when driving the agent from the desktop app or IDE — a security-relevant gap.Related Issue
Fixes #41457
Type of Change
Changes Made
tui_gateway/entry.py: Callregister_from_config(load_config(), accept_hooks=False)after_install_sidecar_publisher(), wrapped in try/except to never block startupacp_adapter/entry.py: Callregister_from_config(load_config(), accept_hooks=False)after_load_env(), same try/except patterntests/tui_gateway/test_shell_hook_registration.py: 4 tests verifying registration is called and failures don't crash startup in both entry pointsHow to Test
pre_tool_callshell hook to~/.hermes/config.yamlhermes hooks doctor— should show all greenhermes desktop) or an IDE via ACPpytest tests/tui_gateway/test_shell_hook_registration.py -v— all 4 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
tui_gateway/entry.py,acp_adapter/entry.py(mirroringgateway/run.py:4486-4494pattern)register_from_config()is idempotent and already called from 3 other entry points