插件市场 GitHub 插件页报「插件包无效」:服务层清单校验器落后于协议层,不认 1.2.6 清单的 network.secrets[].source: "gh-cli"
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: Vincent
**客户端版本**: 0.1.36
---
## 现象
在插件市场打开 GitHub 插件(`cindy-github`)详情页,界面显示「该插件包无效,或当前 Cindy 版本不支持它」;从市场安装/重装同样失败。其他插件正常。
主进程日志(`logs/main-2026-08-07.log`,每次打开该详情页都会出现):
```
[2026-08-07T16:10:48.669+08:00] [ERROR] [console] Error occurred in handler for 'plugin-market:detail': Error: [GHOST_FILE_INVALID] This Plugin manifest is not supported
at throwIpcError (.../app.asar/.vite/build/bootstrap-electron-D4gXw7mE.js:895:13639)
at async PluginMarketService.runForOwner (...)
```
## 根因分析(已在本机逐环验证)
1. 市场当前下发的 `cindy-github` currentRelease 为 **1.2.6**(releaseId `cmsg9cvim0001xt01g8fwknbt`,publishedAt 2026-08-05T15:44:51Z),其 manifest 声明了新凭证来源:`network.secrets[0].source: "gh-cli"`(可通过 `GET https://plugin.cindy.app/api/plugins/cdba4fd373fb1cc88f83ed575` 复核)。
2. 0.1.35 的 `bootstrap-electron-D4gXw7mE.js` 中,同一个 ghost manifest 校验模块被打包了**两份版本不一致的拷贝**:
- 旧拷贝 `validateGhostManifest`:`GHOST_SECRET_SOURCES=["user","login-email","oauth","oidc-token"]`,不认识 `gh-cli` / `login-feishu-token`。**PluginMarketService 的 detail 与 install 路径调用的是这份**。
- 新拷贝 `validateGhostManifest$1`:`GHOST_SECRET_SOURCES$1=["user","login-email","oauth","login-feishu-token","oidc-token","gh-cli"]`,被市场协议解析层 `parseReleaseDetail` 调用——所以 API 响应解析能通过,随后服务层复检被旧拷贝拒绝。
3. 把旧拷贝校验器从 bundle 中提取出来、对市场返回的真实 manifest 运行,拒绝理由精确复现:
`network.secrets[].source 仅支持 user / login-email / oauth / oidc-token(缺省 user)`
4. detail/install 处理器把任何校验失败统一映射为 `GHOST_FILE_INVALID`("This Plugin manifest is not supported"),前端 i18n 文案即 `invalidPackage`「该插件包无效,或当前 Cindy 版本不支持它」。
即:插件 1.2.6 使用的清单特性超前于 stable 宿主服务层所支持的 schema,属于模块拷贝漂移 / 发布超前问题,并非包损坏。
## 复现步骤
1. Cindy 0.1.35(stable)→ 插件市场 → GitHub 插件详情页;
2. 页面报「该插件包无效…」,主进程日志出现上述 `GHOST_FILE_INVALID`;
3. 请求 `GET /api/plugins/cdba4fd373fb1cc88f83ed575` 可见 currentRelease 1.2.6 manifest 中 `network.secrets[0].source === "gh-cli"`。
## 影响
- 详情页无法查看;从市场安装/重装 `cindy-github` 必然失败(install 路径同用旧校验器);
- 已装 1.2.2 的用户一旦卸载(例如排查时)就无法再装回;
- stable 更新通道最新仍为 0.1.35,用户侧无任何自救途径。
## 建议修复方向
1. 去重 bundle 内两份 ghost-schema 拷贝,让市场服务层与协议解析层使用同一份(新版)校验器;
2. 服务端为插件 release 增加最低宿主版本门槛,避免向不支持的 stable 宿主下发超前清单;
3. 短期缓解:将 `cindy-github` 重发为 0.1.35 兼容清单(source 回退 user/oauth),或允许详情页/安装回落到旧 release(1.2.2 清单可通过旧校验器)。
---
**OS**: darwin arm64 (27.0.0)
**界面语言**: zh-CN
Contributor guide
Research direction
Start by tracing validateGhostManifest and validateGhostManifest$1 in bootstrap-electron-D4gXw7mE.js, then follow their callers in PluginMarketService and parseReleaseDetail. Reproduce the detail and install requests against the reported plugin API endpoint and compare both validation paths. Done means supported 1.2.6 manifests are handled consistently while invalid manifests still produce the intended error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100