microsoft / microsoft/vscode

Harden sed parsing for terminal auto-approval edge cases

Open
#328,898 0 comments 0 reactions 1 assignee Claimed by @anthonykim1 View on GitHub
terminal-auto-approve
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Follow-up to https://github.com/microsoft/vscode/pull/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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.