@leiyi-works/dsh-session-tmpdir 0.9.5 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +2 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -221,3 +221,5 @@ v0.9.4 变更(2026-11-16):**命令守卫减少误拦**(不影响正常
221
221
  3. 行为回归:`ffmpeg`/`pandoc`/`Export-*`/`[IO.File]::WriteAllText` 等程序级写盘、`New-Item`/`Set-Content`/重定向/管道写文件仍照旧判定;已存在文件仍按"改写放行"。
222
222
 
223
223
  v0.9.5 变更(2026-11-16):**复制/移动类命令不再判源路径**。`Copy-Item`、`Move-Item`、`cp`、`mv`、`rsync`、`scp`、`robocopy`、`xcopy`、`Expand-Archive`、`Compress-Archive` 的源参数是"读",只有目标才是写落点:有 `-Destination`/`-DestinationPath`/`-Dest`/`-Target` 时只判该目标,否则位置参数形式下判**最后一个路径**(目标),其余按源跳过。这样"源文件缺失 + 检查/写入已存在目标"的命令不会再被误拦;目标新建未审批仍照常拦截。
224
+
225
+ v0.9.6 变更(2026-11-16):**`Start-Process` 不再默认算写命令**。它只是启动外部程序,参数里的路径通常是程序要打开的文件(读)。现在只有带 `-RedirectStandardOutput` / `-RedirectStandardError`(真正写文件)时才参与路径判定;`Start-Process notepad C:\缺失.txt` 这类不再误拦。
package/index.js CHANGED
@@ -135,7 +135,7 @@ const CREATE_VERB_PATTERN =
135
135
  * `Invoke-RestMethod …` / `curl https://…` without `-OutFile`/`-o` are pure reads.
136
136
  */
137
137
  const DOWNLOAD_WRITE_PATTERN =
138
- /\bInvoke-(?:WebRequest|RestMethod)\b[^;|&\n]*\s-(?:OutFile|OutFileList)\b|\bcurl\b[^;|&\n]*\s(?:-o|--output|-O)\b|\bwget\b[^;|&\n]*\s(?:-O|--output-document)\b/i
138
+ /\bInvoke-(?:WebRequest|RestMethod)\b[^;|&\n]*\s-(?:OutFile|OutFileList)\b|\bcurl\b[^;|&\n]*\s(?:-o|--output|-O)\b|\bwget\b[^;|&\n]*\s(?:-O|--output-document)\b|\bStart-Process\b[^;|&\n]*\s-(?:RedirectStandardOutput|RedirectStandardError)\b/i
139
139
  /** v0.9.4: judge a script statement by statement, so a read-only segment cannot be misread as a write. */
140
140
  const COMMAND_SEGMENT_SPLIT = /(?:\r?\n|;|&&|\|\||\|)+/
141
141
  /**
@@ -152,7 +152,7 @@ const DESTINATION_FLAG_PATTERN = /-(?:Destination|Dest|DestinationPath|Target)\b
152
152
  * entirely, so a "new long-term artifact" could land without asking.
153
153
  */
154
154
  const WRITE_PROGRAM_PATTERN =
155
- /\b(?:ffmpeg|ffmpeg\.exe|pandoc|soffice|libreoffice|wkhtmltopdf|magick|convert|gs|zip|rar|Export-Csv|Export-Clixml|Export-Pdf|WriteAllText|WriteAllBytes|WriteAllLines|AppendAllText|AppendAllBytes|CreateText|OpenWrite|Start-Process)\b/i
155
+ /\b(?:ffmpeg|ffmpeg\.exe|pandoc|soffice|libreoffice|wkhtmltopdf|magick|convert|gs|zip|rar|Export-Csv|Export-Clixml|Export-Pdf|WriteAllText|WriteAllBytes|WriteAllLines|AppendAllText|AppendAllBytes|CreateText|OpenWrite)\b/i
156
156
  /** Redirection source shared by the global form. */
157
157
  const REDIRECT_SOURCE =
158
158
  '(?:^|[\\s;&|])(?:>>|\\d?>>?)\\s*(?:"([^"]+)"|\'([^\']+)\'|([^\\s;&|]+))'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leiyi-works/dsh-session-tmpdir",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Per-session task temp folder with a long-term write guard. v0.9 (方案3): creating a new file outside _tmp requires the user's approval (per file by default, per directory with mode=dir), overwriting an existing file is allowed without asking, every write channel is guarded (write/edit, shell including ffmpeg/pandoc/Export-*/IO APIs, publish copies, code runtimes, unknown tools), and the persisted whitelist is shown in a left-sidebar panel「临时目录」 where entries can be removed. Every session also gets _tmp/<session title>/ in its working directory, cleaned 7 days after the session is deleted; the same tick reclaims the attachment store.",
6
6
  "exports": {