Skip to content

Strengthen forced rm command detection - #33464

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e1fabc55324e788bae00ab24aae50d089eb7b058
Jul 16, 2026
Merged

Strengthen forced rm command detection#33464
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e1fabc55324e788bae00ab24aae50d089eb7b058

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 16, 2026

Copy link
Copy Markdown

Strengthen forced rm command detection

Why

Forced rm commands can appear inside complex shell syntax or use option and wrapper variants that the existing dangerous-command heuristic does not recognize.

What changed

  • Detect literal forced rm invocations in control flow, substitutions, pipelines, traps, nested shells, and sudo or env wrappers.
  • Recognize combined, separate, and long-form force options, including when they follow operands.
  • Require approval for these commands, or reject them with a safer-alternative explanation when approvals are disabled, even when the sandbox is disabled.
  • Preserve existing rejection reasons for other dangerous commands and explicit policy rules.

Testing

Add unit, policy, and end-to-end coverage for forced rm variants, complex shell scripts, approval requests, and rejection messages.

## Why

Forced `rm` commands can appear inside complex shell syntax or use option and wrapper variants that the existing dangerous-command heuristic does not recognize.

## What changed

- Detect literal forced `rm` invocations in control flow, substitutions, pipelines, traps, nested shells, and `sudo` or `env` wrappers.
- Recognize combined, separate, and long-form force options, including when they follow operands.
- Require approval for these commands, or reject them with a safer-alternative explanation when approvals are disabled, even when the sandbox is disabled.
- Preserve existing rejection reasons for other dangerous commands and explicit policy rules.

## Testing

Add unit, policy, and end-to-end coverage for forced `rm` variants, complex shell scripts, approval requests, and rejection messages.

GitOrigin-RevId: e1fabc55324e788bae00ab24aae50d089eb7b058
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/e1fabc55324e788bae00ab24aae50d089eb7b058 branch from d2c4e9a to be39aab Compare July 16, 2026 01:13
@copyberry
copyberry Bot merged commit be39aab into main Jul 16, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/e1fabc55324e788bae00ab24aae50d089eb7b058 branch July 16, 2026 01:14
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants