feat(execution): cross-platform command execution via ShellPlatform abstraction#7
Merged
Conversation
… ShellPlatform Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… into ChatService Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…OutsideWorkspace
- trimEnd('/') on both basePath and token so exact project paths aren't blocked
- skip tokens starting with /dev/ (e.g. /dev/null in 2>/dev/null redirects)
Replace broad /dev/ prefix skip with an explicit allowlist to prevent path traversal bypass via /dev/../../etc/passwd patterns
…olName fallback - Use startsWith(base + separator) to prevent /project-evil bypassing /project check - Replace hardcoded 'run_command' fallback with ShellPlatform.current().toolName()
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.
概要
变更文件
┌──────────────────────────────────────┬────────────────────────────────────────────────┐
│ 文件 │ 变更说明 │
├──────────────────────────────────────┼────────────────────────────────────────────────┤
│ execution/ShellPlatform.kt │ 新增,封装 Unix/Windows 平台差异 │
├──────────────────────────────────────┼────────────────────────────────────────────────┤
│ execution/CommandExecutionService.kt │ 委托给 ShellPlatform.current() │
├──────────────────────────────────────┼────────────────────────────────────────────────┤
│ ChatService.kt │ toolDefinition、toolName、shellHint 走平台抽象 │
├──────────────────────────────────────┼────────────────────────────────────────────────┤
│ settings/PluginSettings.kt │ 默认白名单按平台生成 │
├──────────────────────────────────────┼────────────────────────────────────────────────┤
│ settings/SettingsFormState.kt │ 同上 │
├──────────────────────────────────────┼────────────────────────────────────────────────┤
│ ShellPlatformTest.kt │ 新增,35 个单元测试覆盖两端 │
└──────────────────────────────────────┴────────────────────────────────────────────────┘
测试计划
Checklist