Skip to content

[Windows] msiexec called without UAC elevation in combined install path, fails silently for standard users #73

@JasonYang318

Description

@JasonYang318

問題描述

installNodeWithAdmin() 正確使用 PowerShell -Verb RunAs 提權安裝,但在 installNodeAndOpenClaw() 的合併安裝路徑中,msiexec 被直接呼叫,缺少 UAC 提權

檔案electron/main/cli.ts 第 1975–1983 行

```typescript
const nodeResult = await runShell(
'msiexec',
['/i', nodeInstallerPath, '/qn', '/norestart'],
MAIN_RUNTIME_POLICY.node.installNodeTimeoutMs,
'env-setup'
)
```

對比 installNodeWithAdmin() 中有正確提權的版本(第 1829–1832 行):

```typescript
return runShell('powershell', [
'-Command',
Start-Process -FilePath msiexec -ArgumentList '/i','${installerPath}','/qn' -Verb RunAs -Wait
], ...)
```

影響範圍

  • 公司電腦或家庭標準帳號(非系統管理員)的 Windows 使用者
  • 表現為 msiexec 回傳非 0 exit code,但錯誤訊息不明確,使用者無法判斷原因
  • 使用者以為 app 壞了,實際上是權限問題

重現條件

  1. 使用 Windows 標準使用者帳號(非 Administrator)
  2. 觸發同時安裝 Node.js + OpenClaw 的合併安裝流程
  3. 安裝靜默失敗,Node.js 未正確安裝

建議修法

installNodeAndOpenClaw() 中的 msiexec 呼叫應統一改為透過 PowerShell -Verb RunAs 提權,與 installNodeWithAdmin() 一致:

```typescript
await runShell('powershell', [
'-Command',
Start-Process -FilePath msiexec -ArgumentList '/i','${nodeInstallerPath}','/qn','/norestart' -Verb RunAs -Wait
], ...)
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions