zed/crates
Richard Feldman f3fb4e04aa
Reject shell substitutions in terminal tool commands (#51689)
Harden the terminal tool's permission system to reject commands
containing shell substitutions and interpolations (`$VAR`, `${VAR}`,
`$(…)`, backticks, `$((…))`, `<(…)`, `>(…)`) before they reach terminal
creation.

## Changes

### Shell command parser (`shell_command_parser`)
- Added structured terminal command-prefix extraction with env-var
prefix support
- Added parser-backed validation that classifies commands as
Safe/Unsafe/Unknown
- Extended normalized command extraction to include scalar env-var
assignments in order
- Preserved quoted assignment values when they contain whitespace or
special characters

### Pattern extraction (`agent/pattern_extraction`)
- Updated terminal pattern extraction to use structured parser output
- Included env-var prefixes in generated allow patterns
- Normalized regex token boundaries to `\s+` while preserving display
whitespace

### Tool permissions (`agent/tool_permissions`)
- Added invalid-terminal-command rejection for forbidden
substitutions/interpolations
- Added unconditional allow-all bypass (global default Allow, or
terminal-specific Allow with empty patterns)
- Preserved hardcoded denial precedence over allow-all

### Terminal tool (`agent/tools/terminal_tool`)
- Updated tool description and input schema to explicitly prohibit shell
substitutions
- Added comprehensive SEC-264 regression test suite (20 new tests)
covering:
- All forbidden constructs (`${HOME}`, `$1`, `$?`, `$$`, `$@`,
`$(whoami)`, backticks, `$((1+1))`, `<(ls)`, `>(cat)`, env-prefix
variants, multiline, nested)
  - Allow-all exception paths (global and terminal-specific)
  - Hardcoded-denial precedence
- Env-prefix permission flow (matching, value mismatch rejection,
multiple assignments, quoted whitespace)

Closes SEC-264

Release Notes:

- Terminal tool permissions regexes can now match environment variables
(e.g. `FOO=bar cmd arg1 arg2`)
- If terminal tool permissions have active permissions regexes running
on them, then bare interpolations like `$FOO` are disallowed for
security, since regexes wouldn't be able to match on them.
2026-03-16 23:49:34 -04:00
..
acp_thread Store ACP thread metadata (#51657) 2026-03-16 17:23:02 +01:00
acp_tools Store ACP thread metadata (#51657) 2026-03-16 17:23:02 +01:00
action_log agent: Add thread git stats to sidebar (#51287) 2026-03-11 14:52:57 +00:00
activity_indicator Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
agent Reject shell substitutions in terminal tool commands (#51689) 2026-03-16 23:49:34 -04:00
agent_servers agent_ui: Remove special casing for previous built in agents (#51713) 2026-03-16 22:25:04 +00:00
agent_settings agent_ui: Add keybinding to cycle through new thread location options & settings (#51384) 2026-03-12 10:14:10 -03:00
agent_ui Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
ai_onboarding ai_onboarding: Add student plan examples to component preview (#51338) 2026-03-11 23:21:57 +00:00
anthropic Update BYOK to 1m context windows (#51625) 2026-03-16 09:10:01 -07:00
askpass Reduce amount of monomorphizations from FnMut closures (#49453) 2026-02-18 12:00:02 +01:00
assets
assistant_slash_command Handle removed IconName variants in text thread deserialization (#47624) 2026-01-26 23:56:55 +00:00
assistant_slash_commands build: Tear up crate graph (move terminal closer to editor) (#48602) 2026-02-06 20:14:35 +01:00
assistant_text_thread Prevent remote edits from triggering edit predictions when collaborating (#51196) 2026-03-10 15:23:49 +00:00
audio Fix echo canceller not working (#51673) 2026-03-16 17:20:31 +01:00
auto_update auto_update: Always display update progress when requesting manual update (#51087) 2026-03-09 10:10:42 +00:00
auto_update_helper Try to fix auto-updates when Explorer.exe holds Zed.exe (#50332) 2026-03-03 17:47:35 +01:00
auto_update_ui auto_update_ui: Add announcement toast component (#49543) 2026-02-19 10:41:16 -03:00
aws_http_client
bedrock bedrock: Add Claude Sonnet 4.6 (#49439) 2026-02-19 07:23:27 +01:00
breadcrumbs editor: Replace BreadcrumbText with HighlightedText (#51083) 2026-03-13 08:00:22 +00:00
buffer_diff buffer_diff: Fix panic when staging hunks with stale buffer snapshot (#51641) 2026-03-16 09:49:02 +01:00
call Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
channel file_finder: Show collab channels in file search (#51120) 2026-03-13 07:48:35 +00:00
cli zed: Clear the FORCE_CLI_MODE environment variable after reading (#46475) 2026-03-06 19:18:33 +00:00
client client: Populate plans for organizations (#51334) 2026-03-11 22:22:17 +00:00
clock text: Narrow insertion-relative offsets from usize to u32 (#49801) 2026-02-25 08:12:04 +01:00
cloud_api_client cloud_api_client: Send the organization ID in LLM token requests (#50517) 2026-03-04 15:45:33 +01:00
cloud_api_types client: Populate plans for organizations (#51334) 2026-03-11 22:22:17 +00:00
cloud_llm_client ep: Track e2e latency (#51678) 2026-03-16 11:35:51 -04:00
codestral zeta: Allow the server to select the editable and context ranges more flexibly (#50975) 2026-03-09 19:58:31 -04:00
collab editor: Replace BreadcrumbText with HighlightedText (#51083) 2026-03-13 08:00:22 +00:00
collab_ui git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
collections
command_palette Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
command_palette_hooks
component
component_preview gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
context_server Revert "Allow always_allow patterns for Nushell, Elvish, and Rc shells" (#48050) 2026-01-30 21:26:13 +00:00
copilot Add size to DiskState to detect file changes (#49436) 2026-03-10 13:55:57 -05:00
copilot_chat Enable extended reasoning for Anthropic models in Copilot (#46540) 2026-03-08 09:34:46 +00:00
copilot_ui ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
crashes Redact string panics (#51248) 2026-03-11 03:08:39 +00:00
credentials_provider
csv_preview Add CSV preview with live table view and interactive features (#48207) 2026-03-03 15:49:40 +01:00
dap Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
dap_adapters debugger: Fall back to cached adapter binaries when offline (#50928) 2026-03-16 16:29:24 +00:00
db Increase SQLite busy_timeout from 1ms to 500ms (#49039) 2026-02-12 16:26:13 +00:00
debug_adapter_extension Revert "Revert scheduler update (#46659)" (#46671) 2026-01-14 07:19:13 +00:00
debugger_tools Reduce amount of monomorphizations from FnMut closures (#49453) 2026-02-18 12:00:02 +01:00
debugger_ui Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
deepseek
denoise
dev_container Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
diagnostics Truncate long diagnostic messages in the status bar (#51031) 2026-03-12 18:25:52 +02:00
docs_preprocessor docs: Add consent banner (#50302) 2026-03-04 15:38:31 +01:00
edit_prediction ep: Track e2e latency (#51678) 2026-03-16 11:35:51 -04:00
edit_prediction_cli ep: Ensure prompt is always within token limit (#51529) 2026-03-14 13:53:28 -04:00
edit_prediction_context Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
edit_prediction_types Differentiate between explicit rejection and ignored in ep acceptance tracking (#48409) 2026-02-04 17:54:11 -05:00
edit_prediction_ui ep: Track e2e latency (#51678) 2026-03-16 11:35:51 -04:00
editor Fix "Show Edit Predictions For This Buffer" button (#50845) 2026-03-17 02:52:03 +00:00
encoding_selector Revert PRs for landing in main (#48969) 2026-02-12 00:28:17 +00:00
etw_tracing time_format: Add Windows implementation (#50227) 2026-02-28 21:47:30 -05:00
eval Refresh LLM API token on organization change (#50931) 2026-03-06 19:15:21 +00:00
eval_cli Store ACP thread metadata (#51657) 2026-03-16 17:23:02 +01:00
eval_utils gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
explorer_command_injector explorer_command_injector: Avoid COM out-pointer overwrite in class factory exports (#49210) 2026-02-28 22:42:19 -05:00
extension extension_cli: Add tests for semantic token rules and language tasks (#50750) 2026-03-09 11:47:12 +01:00
extension_api extension_api: Add language server schema methods (#48334) 2026-03-07 11:05:10 +01:00
extension_cli extension_cli: Add tests for semantic token rules and language tasks (#50750) 2026-03-09 11:47:12 +01:00
extension_host Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
extensions_ui ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
feature_flags Redact string panics (#51248) 2026-03-11 03:08:39 +00:00
feedback Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
file_finder Fix non-ASCII path:line:column navigation (#51238) 2026-03-16 15:35:59 +00:00
file_icons
fs fs: Fix wrong windows cfg (#51644) 2026-03-16 09:03:22 +00:00
fs_benchmarks gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
fuzzy
git git: Log some more information when opening a git repository and when git show fails (#51495) 2026-03-13 14:53:14 +00:00
git_graph ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
git_hosting_providers Implement extract_pull_request for GitLab provider (#47973) 2026-01-31 21:56:34 +00:00
git_ui git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
go_to_line Fix non-ASCII path:line:column navigation (#51238) 2026-03-16 15:35:59 +00:00
google_ai Remove deprecated Gemini 3 Pro Preview (#50503) 2026-03-04 15:53:26 +00:00
gpui keymap_editor: Remove redundant parentheses when displaying keymap context (#50906) 2026-03-17 02:44:12 +00:00
gpui_linux gpui: Fix busyloop on X disconnect (#41986) 2026-03-13 21:16:56 +05:30
gpui_macos gpui_macos: Skip IME for Cmd+key events on non-QWERTY layouts (#51394) 2026-03-13 12:30:01 -06:00
gpui_macros gpui: Add property_test macro (#50935) 2026-03-06 14:03:45 +00:00
gpui_platform GPUI updates (#51415) 2026-03-12 22:15:12 +00:00
gpui_tokio
gpui_util GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
gpui_web Remove Executor::close() (#50970) 2026-03-07 04:11:45 +00:00
gpui_wgpu Linux: Handle device lost with wgpu (#50898) 2026-03-05 22:59:48 -07:00
gpui_windows Disable the IME on Windows when text input is unexpected (#51041) 2026-03-08 04:54:05 +00:00
html_to_markdown
http_client http_client: Fix GitHub downloads failing if the destination path exists (#51548) 2026-03-14 15:17:09 +01:00
http_client_tls
icons agent_ui: Mask API key input in Add LLM provider modal (#50379) 2026-03-13 19:37:18 -03:00
image_viewer editor: Replace BreadcrumbText with HighlightedText (#51083) 2026-03-13 08:00:22 +00:00
inspector_ui Reduce amount of closure monomorphizations part 2 (#49688) 2026-02-20 08:32:45 +00:00
install_cli Revert PRs for landing in main (#48969) 2026-02-12 00:28:17 +00:00
journal Implement worktree interactions for the sidebar (#51421) 2026-03-12 15:34:09 -07:00
json_schema_store extension_api: Add language server schema methods (#48334) 2026-03-07 11:05:10 +01:00
keymap_editor ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
language Add size to DiskState to detect file changes (#49436) 2026-03-10 13:55:57 -05:00
language_extension extension_api: Add language server schema methods (#48334) 2026-03-07 11:05:10 +01:00
language_model Assign meaningful names to some single-letter bindings (#51432) 2026-03-12 22:49:17 +00:00
language_models language_models: Make subscription text exhaustive (#51524) 2026-03-13 20:18:30 +00:00
language_onboarding ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
language_selector language_selector: Fix language selector query selection (#51581) 2026-03-16 15:53:06 +00:00
language_tools ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
languages lsp: Add clangd readonly token modifier to semantic token rules to highlight constant variables as constant (#49065) 2026-03-16 07:35:29 +00:00
line_ending_selector
livekit_api Update Rust crate jsonwebtoken to v10 [SECURITY] (#48294) 2026-02-03 15:51:40 -05:00
livekit_client Fix echo canceller not working (#51673) 2026-03-16 17:20:31 +01:00
lmstudio ai: Add LMStudio API URL & API key support (#48309) 2026-03-06 16:49:55 +00:00
lsp git: Move diff num stat calculation to repository snapshot layer (#50645) 2026-03-04 18:54:23 +00:00
markdown markdown_preview: Enable parser options individually (#50440) 2026-03-05 14:00:08 +00:00
markdown_preview markdown_preview: Fix not re-rendering issue when editing by agent (#50583) 2026-03-16 14:45:58 +01:00
media
menu
migrator editor: Add support for no auto-indent on enter (#47751) 2026-03-04 20:29:20 +00:00
miniprofiler_ui project_panel: Fix scrolling in empty area below file list (#50683) 2026-03-04 19:13:32 +01:00
mistral mistral: Enable streaming tool calls (#50793) 2026-03-05 08:59:05 +00:00
multi_buffer Fix non-ASCII path:line:column navigation (#51238) 2026-03-16 15:35:59 +00:00
nc acp: Claude Code -> Claude Agent (#49345) 2026-02-17 10:41:10 +00:00
net Add ETW profile recorder action (#49712) 2026-02-20 13:36:04 +00:00
node_runtime util: Always use posix_spawn on macOS even with pre_exec hooks (#49090) 2026-02-13 20:16:11 +01:00
notifications Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
ollama ollama: Remove backwards compatibility for Ollama tool call IDs (#49246) 2026-02-16 14:33:29 +00:00
onboarding ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
open_ai open_ai: Support reasoning summaries in OpenAI Responses API (#50959) 2026-03-09 13:51:22 +00:00
open_path_prompt file_finder: Put collab channel inclusion behind a setting (#51505) 2026-03-13 16:52:50 +00:00
open_router Add user picked model to be used as a default for open router provider when generating comments and thread summary (#47475) 2026-02-12 14:02:16 +00:00
outline Fix outline filtering always selecting last match (#50594) 2026-03-16 12:56:29 +00:00
outline_panel Do not derive symbol highlights if they do not fit into multi buffer (#50948) 2026-03-09 15:50:44 +00:00
panel ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
paths Remove Supermaven-related code from Zed (#50537) 2026-03-02 22:18:49 +00:00
picker picker: Prevent clicking non-selectable entries from confirming selection (#50705) 2026-03-05 18:59:01 +00:00
platform_title_bar Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
prettier Add configurable LSP timeout setting (#44745) 2026-02-07 00:36:37 +00:00
project Store ACP thread metadata (#51657) 2026-03-16 17:23:02 +01:00
project_benchmarks gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
project_panel project_panel: Add horizontal scroll setting (#51143) 2026-03-13 15:25:54 +00:00
project_symbols Re-add MultiWorkspace (#48800) 2026-02-12 01:06:23 +00:00
prompt_store Revert "Allow always_allow patterns for Nushell, Elvish, and Rc shells" (#48050) 2026-01-30 21:26:13 +00:00
proto editor: Fix jumbled auto-imports when completing with multiple cursors (#50320) 2026-03-16 09:52:57 +00:00
recent_projects Fix non-ASCII path:line:column navigation (#51238) 2026-03-16 15:35:59 +00:00
refineable
release_channel
remote Fix a few cases where we weren't escaping shell vars correctly (#50562) 2026-03-02 23:31:11 -07:00
remote_connection build: Decouple git_ui from recent_projects (#48062) 2026-02-02 13:30:07 +01:00
remote_server agent: Re-use ACP connections per project (#51209) 2026-03-10 17:32:51 +00:00
repl ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
reqwest_client Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
rope editor: Prevent panic in lsp_symbols_at_cursor with diff hunks handling (#51077) 2026-03-09 08:35:19 +00:00
rpc Support LSP document symbols in breadcrumbs and outline UI (#48780) 2026-02-11 21:30:03 +02:00
rules_library Revert "Fix window drags when dragging button/input on titlebar in macOS" (#51666) 2026-03-16 13:55:04 +00:00
scheduler Remove Executor::close() (#50970) 2026-03-07 04:11:45 +00:00
schema_generator
search ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
session Re-add MultiWorkspace (#48800) 2026-02-12 01:06:23 +00:00
settings git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
settings_content git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
settings_json
settings_macros
settings_profile_selector Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
settings_ui Fix echo canceller not working (#51673) 2026-03-16 17:20:31 +01:00
shell_command_parser Reject shell substitutions in terminal tool commands (#51689) 2026-03-16 23:49:34 -04:00
sidebar Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
snippet
snippet_provider extension_cli: Validate that all snippets can be parsed (#47649) 2026-01-26 13:49:26 +00:00
snippets_ui Revert PRs for landing in main (#48969) 2026-02-12 00:28:17 +00:00
sqlez sqlez: Open named in-memory databases as SQLite URIs (#50967) 2026-03-10 20:25:12 +00:00
sqlez_macros
story
storybook gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
streaming_diff
sum_tree gpui: Add property_test macro (#50935) 2026-03-06 14:03:45 +00:00
svg_preview Prevent remote edits from triggering edit predictions when collaborating (#51196) 2026-03-10 15:23:49 +00:00
system_specs
tab_switcher Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
task extension_cli: Add tests for semantic token rules and language tasks (#50750) 2026-03-09 11:47:12 +01:00
tasks_ui Limit editors' refresh runnables (#51299) 2026-03-11 15:05:22 +00:00
telemetry
telemetry_events ep_cli: rated-after: query (#47906) 2026-01-28 16:36:44 -08:00
terminal git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
terminal_view git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
text Fix non-ASCII path:line:column navigation (#51238) 2026-03-16 15:35:59 +00:00
theme Add hotkeys and actions for toggle light and dark theme (#49027) 2026-03-12 21:35:42 +02:00
theme_extension
theme_importer vim: Add configurable yank highlight background color (#49517) 2026-02-26 12:01:57 +00:00
theme_selector ui: Refactor the Button component icon methods (#51496) 2026-03-13 14:13:12 -03:00
time_format time_format: Add Windows implementation (#50227) 2026-02-28 21:47:30 -05:00
title_bar Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
toolchain_selector Revert "Added support for dismissing the toolchain path selector via … (#49504) 2026-02-18 17:07:10 -05:00
ui git_ui: Show uncommitted change count badge on git panel icon (#49624) 2026-03-16 12:57:20 -03:00
ui_input agent_ui: Mask API key input in Add LLM provider modal (#50379) 2026-03-13 19:37:18 -03:00
ui_macros
ui_prompt
util Store ACP thread metadata (#51657) 2026-03-16 17:23:02 +01:00
util_macros
vercel project: Move tests to integration layer (#47596) 2026-01-25 21:35:32 +01:00
vim vim: Fix helix select next match panic when search wraps around (#51642) 2026-03-16 11:14:26 +01:00
vim_mode_setting
watch Remove unreferenced dev dependencies (#51093) 2026-03-09 13:22:12 +01:00
web_search
web_search_providers Assign meaningful names to some single-letter bindings (#51432) 2026-03-12 22:49:17 +00:00
which_key which-key: Removed some keys from the filter list that were wrongly filtered (#51543) 2026-03-14 03:29:49 +00:00
workspace Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
worktree worktree: Fix binary files misdetected as UTF-16 (#50890) 2026-03-17 02:51:44 +00:00
worktree_benchmarks gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
x_ai Add support for streaming tool input to more providers (#50682) 2026-03-04 17:36:25 +01:00
zed Move sidebar back out of the panel (#51723) 2026-03-17 03:48:20 +00:00
zed_actions Add hotkeys and actions for toggle light and dark theme (#49027) 2026-03-12 21:35:42 +02:00
zed_env_vars
zeta_prompt ep: Ensure prompt is always within token limit (#51529) 2026-03-14 13:53:28 -04:00
zlog zlog: Fix log file rotation never truncating original file (#50571) 2026-03-03 08:37:58 +00:00
zlog_settings
ztracing ztracing: Annotate more callsites that invoke TreeSitter (#47522) 2026-02-11 11:24:04 +00:00
ztracing_macro