Answer: Codex treats `bash -lc`, `bash -c`, and their `zsh` / `sh` equivalents specially: if the script is a linear chain of plain words joined by safe operators (`&&`, `||`, `;`, or `|`), Codex parses it with tree-sitter and splits it into individual commands before applying rules, with the most restrictive result winning. If the script uses advanced features like redirection, substitutions, environment variables, wildcards, or control flow, Codex doesn't split it and applies rules to the entire invocation as a single command. Status: Confirmed Entry: tool/codex/permissions-and-security/shell-wrappers-compound-commands Revision: 1 Digest: sha256:f903fd0649821cdf (changes whenever the content changes) Timeline: Created: 2026-11-13T03:47:09Z Last changed: 2026-11-13T03:47:09Z Last verified: 2026-11-20T13:34:46Z Next check: 2026-11-21T13:34:46Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of special wrappers | `bash -lc`, `bash -c`, and their `zsh` / `sh` equivalents | [1] | 2026-11-20 safe operators | `&&`, `||`, `;`, or `|` | [1] | 2026-11-20 parser | tree-sitter | [1] | 2026-11-20 result precedence | the most restrictive result wins | [1] | 2026-11-20 unsplit invocation | ["bash", "-lc", ""] | [1] | 2026-11-20 unsplit rule application | single | [1] | 2026-11-20 Sources: [1] OpenAI. "Rules". https://learn.chatgpt.com/docs/agent-configuration/rules.md Role: primary. Accessed: 2026-11-20T13:34:47Z Quote: "Codex treats `bash -lc`, `bash -c`, and their `zsh` / `sh` equivalents specially." (Supports: special wrappers) Quote: "joined by safe operators (`&&`, `||`, `;`, or `|`)" (Supports: safe operators) Quote: "then Codex parses it (using tree-sitter) and splits it into individual commands before applying your rules." (Supports: parser) Quote: "Codex then evaluates each command against your rules, and the most restrictive result wins." (Supports: result precedence) Quote: "["bash", "-lc", ""]" (Supports: unsplit invocation) Quote: "and your rules are applied to that **single** invocation." (Supports: unsplit rule application) Snapshot SHA-256: b2c34d7dc85cff73b3706518370f373620713d4acf51c543aa01df958171e350 (captured 2026-11-13T03:47:08Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:47:09Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:34:46Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:34:46Z Last attempt: 2026-11-20T13:34:46Z Notes and limitations: Extracted automatically from a single official source (section "Shell wrappers and compound commands"). Related: https://latestn.com/tool/codex/permissions-and-security/start-deep-security-scan How do I start a deep security scan in Codex? https://latestn.com/tool/codex/permissions-and-security/start-scan-from-conversation How do I start a security scan from a conversation in Codex? https://latestn.com/tool/codex/permissions-and-security/start-security-scan How do I start a security scan in the Codex Security workbench? https://latestn.com/tool/codex/permissions-and-security/set-approvals-execution-permissions How do I set approval and execution permissions for Codex using requirements.toml? https://latestn.com/tool/codex/permissions-and-security/set-token-expiration-limit How do I set an expiration limit for Codex access tokens? https://latestn.com/tool/codex/permissions-and-security/set-up-daybreak How do I set up Daybreak Defense Factory to scan a GitHub repository with Codex Security? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:47:09Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/codex/permissions-and-security/shell-wrappers-compound-commands/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/codex/permissions-and-security/shell-wrappers-compound-commands POST: https://latestn.com/dispute/tool/codex/permissions-and-security/shell-wrappers-compound-commands with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/codex/permissions-and-security/shell-wrappers-compound-commands?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How does Codex handle shell wrappers and compound commands when matching rules? Revision 1, last verified 2026-11-20T13:34:46Z. https://latestn.com/tool/codex/permissions-and-security/shell-wrappers-compound-commands (accessed 2026-11-21T10:02:37Z). @misc{LatestN_tool_codex_permissions_and_security_shell_wrappers_compound_commands_r1, title = {How does Codex handle shell wrappers and compound commands when matching rules?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/codex/permissions-and-security/shell-wrappers-compound-commands}}, note = {Revision 1; digest sha256:f903fd0649821cdf; last verified 2026-11-20T13:34:46Z; accessed 2026-11-21T10:02:37Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/codex/permissions-and-security/shell-wrappers-compound-commands