fix(approval): honor glob command allowlist entries - #43051
Merged
benbarclay merged 2 commits intoJun 18, 2026
Conversation
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?
Honors manual
command_allowlistentries as command text patterns, including shell-style globs such aspodman *.Permanent approvals already store danger-category keys like
recursive delete, while users can also manually configure command text incommand_allowlist. Before this change, manual wildcard entries were loaded but not matched against the actual command in the current guard paths, so a user trying to allow local commands likepodman *still hit approval prompts.The fix adds a small shared matcher for exact command text and
fnmatchglobs, then uses it in both approval entry points after the hardline/sudo floors and before normal Tirith/dangerous-command prompts. That meanspodman *can suppress normal local-command approval prompts, but it cannot bypass catastrophic hardline blocks such asrm -rf /.Related Issue
Support report: local Podman users cannot pre-allow trusted command prefixes such as
podman *for unattended local-terminal work.Related open PR checked: #9163. It has the same general idea, but only patches
check_dangerous_command(); this PR also covers the current combinedcheck_all_command_guards()path.Type of Change
Changes Made
tools/approval.py- Added a shared permanent command allowlist matcher for exact command text and shell-style globs.tools/approval.py- Applied the matcher in bothcheck_dangerous_command()andcheck_all_command_guards()after the hardline/sudo floors.tests/tools/test_command_guards.py- Added regression coverage forpodman *, dangerous-pattern glob allowlisting, and hardline non-bypass behavior.How to Use
After this lands, a user who intentionally wants unattended local Podman commands can add a glob entry to
command_allowlistinconfig.yaml:Then restart the Hermes process/session that is running the agent so the approval module reloads the allowlist.
This is for trusted local command prefixes only. It skips normal approval prompts for matching commands, but it does not bypass hardline blocks such as
rm -rf /, and it does not changeapprovals.modeglobally.How to Test
scripts/run_tests.sh tests/tools/test_command_guards.py -j 4podman *in the permanent allowlist approvespodman run --rm ...through the combined guard path.rm *in the permanent allowlist still does not bypass the hardline block forrm -rf /.Checklist
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/AFor New Skills
N/A
Screenshots / Logs
Focused local validation:
scripts/run_tests.sh tests/tools/test_command_guards.py -j 4Result: 21/21 passed.
Full test suite not run locally; leaving broad coverage to CI.