Repository navigation
fix(exec-shell): add zsh/dash/ash/ksh/fish to V1 POSIX shell recognizer - #377
Conversation
V2 (ExecShellWrapperNormalizer) already recognised these shells; V1 (ExecShellWrapperParser), which is the live exec-approval gate, did not. Policy rules like `Allow: bash *` would not match a zsh invocation. Fixes openclaw#366. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Thanks for tightening the V1 shell wrapper vocabulary. One gap before merge: the legacy parser uses On Windows those are the executable names we are most likely to see from PATH, so the V1 path can still fail to unwrap the same shells this PR is trying to cover. Suggested fix: either add the |
…automatically Switch TryExtractWrappedPayload from Path.GetFileName + OrdinalIgnoreCase comparisons to ExecCommandToken.NormalizedBasename, which strips the path, lowercases, and removes the .exe suffix in one step. This closes the gap where zsh.exe/dash.exe/ash.exe/ksh.exe/fish.exe (the names most likely to appear on Windows PATH) were not recognised as shell wrappers. All existing cmd/powershell/pwsh/bash/sh .exe variants are now covered by the same path without enumerating them. Add .exe theory rows for the five new POSIX shells. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Thanks for the review! Switched |
Summary
ExecShellWrapperParser(V1, the live exec-approval gate) only recognisedbashandshas POSIX shell wrappers. V2 (ExecShellWrapperNormalizer) already includedzsh,dash,ash,ksh, andfish, but V1 never received the update.As a result, a policy with
Allow: bash *would not match azsh -c "..."invocation — the command reached the policy evaluator unwrapped, so neither Allow nor Deny rules for known shells applied reliably.Changes
ExecShellWrapperParser.cs: addzsh,dash,ash,ksh,fishto the POSIX shell branchExecShellWrapperParserTests.cs: extend the existingExpand_Bash_C_ExtractsPayloadtheory with the five new shellsFixes #366.
Co-Authored-By: Claude Sonnet 4.6 [email protected]