Repository navigation
Replies: 2 comments
|
English summary: On Windows, a test script assigned a scratch directory to $home = Join-Path $env:TEMP "dsh-aura-test" But if (Test-Path $home) { Remove-Item $home -Recurse -Force } recursively deleted the entire user profile. No sandbox denial was raised (all errors were Reproduction notes: Suggested guardrails: block recursive deletes whose resolved target is $HOME / $env:USERPROFILE / |
|
今天早上用创造模式写插件的时候遇到了同款问题,也是给 |
Uh oh!
There was an error while loading. Please reload this page.
摘要
在 Windows 11 上,DSH 会话里执行的一条测试脚本用
Remove-Item $home -Recurse -Force删除"临时测试目录",但$HOME是 PowerShell 的只读自动变量,赋值静默失败,$home保持为真实用户目录,导致整个C:\Users\<user>被递归删除。删除不经过回收站,全部历史会话记录丢失。环境
E:\dp\resources\app.asar;运行时E:\dp\resources\runtime)danger-full-access,审批策略never时间线
session-f0bcf5b0f5a2启动(跑 aurabot 插件 E2E)pwsh-02440470a5914884New-Item (Join-Path $home "profiles")在真实 home 下创建了C:\Users\<user>\profiles.dsh均为新建复现(核心)
实际行为:
证据
工具输出 spill:
%TEMP%\dsh-spill-46xrjl\session-f0bcf5b0f5a2\6c97689ebf1d-pwsh.txt(261,916 字节,20:37:37)C:\Users\<user>\AppData\...的Remove-Item失败记录(占用/拒绝访问)... st"; if (Test-Path $home) { Remove-Item $home -Recurse -Force }; New- ...事件日志
Microsoft-Windows-PowerShell/OperationalEvent ID 4100(20:38:19)保存了完整命令行,其中Remove-Item位于第 196 字符(报错按 1 起算 = 197),与上条逐字吻合。旁证:
C:\Users\<user>\profiles创建于 20:38:18,正是New-Item (Join-Path $home "profiles")落在真实 home 的痕迹。报错类型全部为
IOException/ 「拒绝访问」,没有任何一条是沙箱策略拒绝 —— 说明该删除未被文件沙箱拦截。影响
~/.dsh/sessions全部历史会话、~/.dsh/storages、Electron userData 丢失Remove-Item不进回收站),仅找回 1 个更早导出的会话包建议修复
$HOME/$env:USERPROFILE/C:\Users\*/ 盘符根目录 /%SystemRoot%时直接拒绝-WhatIf预演$HOME、$PWD等)的赋值,视为错误并中止整条命令,不要让脚本带错继续workspace-write+ 审批开启,danger-full-access需逐次显式确认诉求
备注:想复现的人请在隔离虚拟机里做,
$HOME那个赋值一定会失败。All reactions