Skip to content

Commit ee8b313

Browse files
author
SqlRush
committed
Classify PowerShell more.com as read-only
1 parent 43abfd6 commit ee8b313

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ M5 补充:PowerShell command canonicalization 现在补齐 `Compare-Object`
219219

220220
M5 补充:PowerShell native read-only classifier 现在覆盖 Windows `sort.exe <path>`/`sort.exe /R <path>` 的安全相对路径读取子集,并拒绝空输入、`/O` 输出文件、pass-through 和越界路径。
221221

222+
M5 补充:PowerShell native read-only classifier 现在覆盖显式 `more.com <path>` 的安全相对路径读取子集,并拒绝裸 `more`、空输入、pass-through 和越界路径。
223+
222224
M5 补充:Bash 前台输出和 `BashOutput` 现在都走统一 tool-result budget 截断/落盘路径;`BashOutput` 增加 100k 最大结果限制,大后台输出会保存完整内容并返回 `full_output_path` 元数据。
223225

224226
M5 补充:Bash/PowerShell 后台任务现在会发 `*_background_started``*_background_finished` tool progress 事件,包含后台 ID、shell/status、exit/timed_out/cancelled、duration、时间戳和输出字节数,不携带 command 文本;completed、timed_out、cancelled 终态均已覆盖测试。

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ test/parity/ # golden tests against TS/official behavior
221221
- 本轮补充:PowerShell native read-only classifier 现在覆盖 Windows `fc.exe``comp.exe` 的双文件比较安全子集,要求刚好两个安全相对路径,并拒绝空/单路径、裸 `comp`、越界路径、pass-through 和动态 `/n` 参数。
222222
- 本轮补充:PowerShell command canonicalization 现在补齐 `Compare-Object` 的常见 `compare`/`diff` alias,同时继续保留 `diff.exe` 这类原生命令后缀,避免外部命令误套 cmdlet 分类。
223223
- 本轮补充:PowerShell native read-only classifier 现在覆盖 Windows `sort.exe <path>`/`sort.exe /R <path>` 的安全相对路径读取子集,并拒绝空输入、`/O` 输出文件、pass-through 和越界路径。
224+
- 本轮补充:PowerShell native read-only classifier 现在覆盖显式 `more.com <path>` 的安全相对路径读取子集,并拒绝裸 `more`、空输入、pass-through 和越界路径。
224225
- 本轮补充:`BashOutput` 现在设置 100k 最大结果大小,和前台 `Bash` 一起覆盖大输出 tool-result preview 截断、完整输出落盘及 `full_output_path` 元数据。
225226
- 本轮补充:Bash/PowerShell 后台命令现在会通过 tool progress 通道发 started/finished 事件,记录后台 ID、shell/status、exit/timed_out/cancelled、duration、时间戳和 stdout/stderr byte count,且 completed、timed_out、cancelled 终态测试确保 progress 不携带 command 文本。
226227
- 本轮补充:WebSearch domain filters 现在在 schema 层声明 array `items:string`,通用 tool schema validator 同步支持 `items` 校验;`allowed_domains`/`blocked_domains` 会拒绝空字符串、URL/port、非法 wildcard 和非域名 label。

internal/tools/powershell/tools.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,8 @@ func readOnlyWords(words []string) bool {
16171617
return readOnlyNativeTwoPathCompare(words[1:], powerShellCompReadOnlyFlags, powerShellCompValueFlags)
16181618
case "sort.exe":
16191619
return readOnlyNativeOnePathCommand(words[1:], powerShellNativeSortReadOnlyFlags, nil)
1620+
case "more.com":
1621+
return readOnlyNativeOnePathCommand(words[1:], nil, nil)
16201622
case "docker":
16211623
return readOnlyDocker(words[1:])
16221624
case "dotnet":
@@ -2135,7 +2137,7 @@ func stripPowerShellExecutableSuffix(name string) (string, bool) {
21352137

21362138
func preservePowerShellNativeExecutableStem(name string) bool {
21372139
switch name {
2138-
case "comp":
2140+
case "comp", "more":
21392141
return true
21402142
default:
21412143
return false

internal/tools/powershell/tools_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ func TestPowerShellCommandClassification(t *testing.T) {
220220
"comp.exe old.bin new.bin /d",
221221
"sort.exe README.md",
222222
"sort.exe /R README.md",
223+
"more.com README.md",
223224
"dotnet --info",
224225
"dotnet --list-runtimes --list-sdks",
225226
"docker ps",
@@ -367,6 +368,10 @@ func TestPowerShellCommandClassification(t *testing.T) {
367368
"sort.exe README.md /O out.txt",
368369
"sort.exe README.md /O:out.txt",
369370
"sort.exe --% README.md",
371+
"more.com",
372+
"more README.md",
373+
"more.com /etc/passwd",
374+
"more.com --% README.md",
370375
"diff.exe README.md /etc/passwd",
371376
"dotnet build",
372377
"dotnet --info $env:SECRET",

0 commit comments

Comments
 (0)