fix: Windows cmd command argument escaping in open_terminal_with_command - #458
Open
qiangxinglin wants to merge 1 commit into
Open
qiangxinglin wants to merge 1 commit into
qiangxinglin wants to merge 1 commit into
Conversation
qiangxinglin
force-pushed
the
fix/windows-cmd-escaping
branch
from
September 16, 2026 05:52
f08bda2 to
8c736c7
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The CA store changes are out of scope and need migration or dual-store handling for existing installations.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes Windows terminal command escaping by launching cmd /K directly with raw_arg.
Changes:
- Removes nested
cmd /C start cmd /Kinvocation. - Switches Windows CA installation and detection to the per-user certificate store.
File summaries
| File | Summary |
|---|---|
server/src/local_app/ca/windows.rs |
Detects CAs in CurrentUser\Root; existing machine-wide installations may be reported as untrusted. |
server/src/local_app/ca/mod.rs |
Generates a per-user CA installation command, introducing a separate trust-scope change. |
apps/desktop/src-tauri/src/desktop.rs |
Launches Windows commands directly with cmd /K and raw_arg. |
Review details
Suppressed comments (1)
server/src/local_app/ca/windows.rs:48
- This changes the Windows trust scope beyond the command-escaping fix: the previous
certutil -addstoreflow used the machine store, while this line makes detection use onlyCurrentUser(and the paired install command adds-user). Existing users with the CA already installed inLocalMachine\Rootwill therefore be reported asuntrustedand blocked until they reinstall it. Please keep the existing store contract or add an explicit migration/dual-store check and document this behavior change.
CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG;
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }), | ||
| "windows" => Some(format!( | ||
| "certutil -addstore -f Root \"{}\"", | ||
| "certutil -user -addstore -f Root \"{}\"", |
…scaping - Switch CA certificate store from LocalMachine (system) to CurrentUser (user-level) in both certutil fallback and native Win32 API path. This removes the need for admin elevation when installing/checking the local CA cert on Windows. - Fix the Windows open_terminal_with_command path: remove the nested `cmd /C start cmd /K` chain which broke command argument passing, and replace it with `cmd /K` + raw_arg() for correct escaping.
qiangxinglin
force-pushed
the
fix/windows-cmd-escaping
branch
2 times, most recently
from
September 16, 2026 05:59
ec32f39 to
5b63b85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动概要
本 PR 包含两个修复,均在 Windows 平台生效:
1. CA 证书存储从 Machine Level 改为 User Level
原先 CA 证书通过
certutil -addstore(无-user) 和 Win32CERT_SYSTEM_STORE_LOCAL_MACHINE安装/检查在系统级根证书存储中,这要求管理员权限。改为
certutil -user -addstore和CERT_SYSTEM_STORE_CURRENT_USER,将证书操作限定在当前用户级别,无需管理员提权。2. 修复 Windows cmd 命令参数传递
open_terminal_with_command原先使用cmd /C start cmd /K嵌套链,导致命令参数被start二次解析后丢失/错位。改为直接
cmd /K并通过std::os::windows::process::CommandExt::raw_arg()原样传递命令字符串。涉及文件
apps/desktop/src-tauri/src/desktop.rs— Windows 终端打开路径server/src/local_app/ca/mod.rs— certutil 回退路径加-userserver/src/local_app/ca/windows.rs— Win32 API 路径改为CURRENT_USER