Support contains/regex rules in execpolicy
Open 💬 3 comments Opened May 27, 2026 by axelcursive
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
It looks like prefix_rule only matches the beginning of the submitted argv. That works for direct commands, but misses cases where the sensitive command is embedded inside a shell string, e.g. bash -c "... some-command ...".
Could execpolicy support a simple contains_rule or regex_rule over the full submitted command/argv?
I know this would not be a perfect security boundary and would not replace sandboxing or runtime interception, but it would catch many practical cases without forcing users to prompt on every bash -c.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This seems worth treating as an ergonomics / defense-in-depth feature, but I would keep the rule semantics very explicit so users do not mistake it for shell-aware security parsing.
One possible shape:
prefix_ruleas the canonical precise argv-prefix matcher;command_text_ruleorargv_contains_rulethat matches against a normalized display string or against individual argv tokens;bash -c,sh -lc, package-manager scripts, or small repo-local wrappers.Acceptance tests I would expect:
some-commandstill matches the existing prefix rule;bash -c "some-command --flag"can trigger the contains/regex rule;That framing would make the feature useful without weakening the current prefix-rule model.
I’m open to this suggestion.
For example, in Maven you can chain lifecycle phases, such as
mvn clean testormvn clean test deploy, with any number of phases betweentestanddeploy. If I allow anymvncommand to be auto-approved, Codex could simply appenddeployto the command, causing my code to be accidentally deployed to a remote server.For me I hope at least they add the
exact_match_rule.