You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Env-prefix stripping: substitutions with spaces, wrapper ordering, tokenizer and test cleanup #16
Deny/ask side: a leading assignment whose value is a command substitution containing spaces is split into several words, so the real command is not isolated. With deny Bash(rm *), FOO=$(true x) rm -rf x or FOO=`echo a b` rm -rf x returns prompt, not deny. main does the same and the README Limits section states it; reusing the substitution tracking in split_command may fix it without a full shell parser.
explain strips an assignment that came after a wrapper: with allow Bash(git *), nohup LANG=C git status returns allow, while strip_wrappers (and test_env_after_wrapper_is_not_a_prefix) treat it as not a prefix. The real command fails in a shell, so this is not a wrong approval, but the two should agree.
_strip_env_prefix counts words with RAW_WORD.findall, which skips unmatched characters such as an unbalanced quote, while _drop_words stops at the first non-match, so the count can drift (e.g. FOO=' A=1 rm y). Use one tokenizer pass.
Simplify: strip_wrappers now defaults to env="safe" and _normalize opts out with env="none"; calling _strip_env_prefix directly from _match_with_env_forms would remove the three-mode parameter, and computing the all form once per subcommand avoids doing it twice.
Tests: test_safe_env_prefix_is_stripped and test_env_after_wrapper_is_not_a_prefix use 12-space bodies, some new lines have trailing whitespace, and blank lines around the new methods are inconsistent.
lint does not strip env prefixes from rule patterns, so Bash(NODE_ENV=dev python *) escapes PW004 and an allow rule with a prefix is not reported as shadowed (PW007) by a deny rule that matches without one.
Activity