Skip to content

Harden sed parsing for terminal auto-approval edge cases #328898

Description

@anthonykim1

Follow-up to #328882.

The immediate fix reuses the existing workbench SedFileWriteParser to block canonical sed -i / --in-place forms in Agent Host. Broader parsing and destination-aware alignment should be handled separately so the initial fix stays small.

Potential follow-up areas:

  • Shell-dialect-aware executable matching, quoting, and backslash handling.
  • Quoted, escaped, abbreviated, and runtime-expanded option words.
  • GNU versus BSD sed -i interpretation and PATH-selected implementations.
  • Backup suffix destinations, including suffixes containing *.
  • Glob/runtime-expanded targets and --follow-symlinks behavior.
  • Destination-aware Agent Host approval for statically resolvable in-place edits, aligned with workbench behavior.
  • Ensure forwarded and full-command allow rules cannot bypass ambiguous or rejected writes.

Add focused cross-platform tests before expanding the parser.

Metadata

Metadata

Assignees

Labels

terminal-auto-approveRelated to the terminal's auto approve logic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions