Skip to content

feat(ghost): 按 endpoint 收窄凭证注入 - #1719

Open
FIERsity wants to merge 8 commits into
makecindy:mainfrom
FIERsity:fix/ghost-secret-endpoint-allowlist
Open

feat(ghost): 按 endpoint 收窄凭证注入#1719
FIERsity wants to merge 8 commits into
makecindy:mainfrom
FIERsity:fix/ghost-secret-endpoint-allowlist

Conversation

@FIERsity

@FIERsity FIERsity commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

Draft:请勿合并。

本 PR 是 #1714 的 Desktop 运行时配套实现,并依赖 Draft makecindy/cindy-protocol#30

当前 schema-v2 旧客户端会接受但静默丢弃 inject.paths / inject.methods,使原本 endpoint 收窄的凭证退化为整域注入(fail-open)。在维护者确定 schema / capability / distribution rollout 机制前,本 PR 绝不可合并或发布

network.secrets[].inject 增加可选的精确 paths 与 HTTP methods 白名单。宿主仅在 host、URL.pathname、实际请求 method 三者同时命中时注入凭证;省略新字段时,保持旧插件的 host-only 行为。

变更类型

  • feat 新功能
  • fix 缺陷修复
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:#1714;依赖 Draft cindy-protocol#30
  • 本 PR 包含:
    • GhostSecretInjectDeclpaths / methods 校验与规范化;
    • network slot 对初始请求、401 retry、每一跳 redirect 的 endpoint 重新匹配;
    • 未命中 endpoint 时仍剥离插件伪造的宿主管理凭证头;
    • manifest / runtime / redirect 测试;
    • FORGE_GUIDE 作者手册和中英日韩权限文案同步。
  • 明确不包含:
  • 用户可见变化:仅在未来安全 rollout 完成后,插件作者才能选择限制某个 secret 的注入 endpoint;未声明新字段的已安装插件行为不变。
  • 是否存在 breaking change:当前实现对未声明字段的存量 manifest 无;但新字段在旧客户端上的 fail-open 风险尚未消除,故本 PR 保持 Draft。

UI 变化

  • 引用的设计规范:不涉及:仅同步既有权限详情的四语字符串与作者手册,无新增 UI 结构、视觉样式或交互。

设计依据

  • docs/dev-rules/plugin-security-and-authoring.md §3、§4、§5、§6:凭证注入属于授权边界;存量未声明新字段的插件必须无感;作者可见 manifest 契约变更同步 FORGE_GUIDE
  • docs/dev-rules/protocol-and-submodules.md §1:cindy-protocol 是跨仓权威来源;submodule pointer 只能在协议公开可拉取、且服务端同步升级后更新。
  • #1714 的 bot 建议采用 inject.paths / inject.methods 最小扩展,而非引入新的 endpoint profile 抽象。

怎么验证的

自动验证

# 完整 unit tier(使用已缓存、满足 engines 范围的 pnpm 10.26.2;命令期间临时移除 packageManager 以绕过 Corepack 下载失败,trap 自动恢复原 package.json)
node scripts/test-workspaces.mjs --tier unit
结果:所有适用 workspace 通过;6 个无可收集测试的 workspace 正常 skip。

NODE_OPTIONS=--max-old-space-size=8192 ./node_modules/.bin/tsc --noEmit -p apps/desktop/tsconfig.json
结果:通过

./node_modules/.bin/vitest run src/shared/__tests__/ghost.test.ts src/main/cindy-brain/__tests__/networkSlot.test.ts src/main/cindy-brain/__tests__/forge.test.ts
结果:3 files / 284 tests passed

node scripts/check-endpoint-literals.mjs
node scripts/check-i18n.mjs
node scripts/brand-terminology-guard.mjs
node scripts/check-i18n-glossary.mjs
结果:均通过

手工验证

  • 不涉及 Desktop 运行时手工验证。
  • 该设计的原始用户可见故障已在本地 file-converter 插件验证:移除未使用、整域注入的可选 secret 后,免费 /mcpdocx 查询返回 14 条路线,且不再要求该凭证。

未执行的验证

  • 未运行 Desktop GUI / Electron 手工流程;本 PR 为 Draft,且安全 rollout 尚未确定。
  • 上游 CI 尚未运行;首次贡献者的 workflow 需要维护者批准。

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:插件运行时基座改动,需 gatekeeper review

影响与回滚

  • 影响范围:shared/ghost.ts manifest 校验、networkSlot.ts 凭证注入、作者手册和权限详情。
  • 存量插件影响:无。未声明 paths / methods 的 manifest 仍是既有 host-only 语义,安装、批准、指纹、布局和包格式均不改变。
  • 已知阻塞风险:旧 schema-v2 消费者会静默忽略这两个新字段,导致 endpoint 限制失效并扩大凭证注入范围。这是 fail-open,不可接受;故 PR 是 Draft,不能 merge。
  • 回滚 / 降级方式:在 rollout 方案确定并经验证前,不发布含新字段的插件,也不合入本 PR / protocol [Bug] create_branch 未传 from_ref 时错误固定使用 main,导致非 main 默认分支仓库返回 404 #30。若实现需撤销,撤回两个 PR 的独立 feature commit;不影响现有插件或 submodule pointer。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO
  • UI 改动已在「UI 变化」注明引用的设计规范章节(不涉及 UI 则跳过)
  • 未提交凭证、令牌或授权文件
  • 已补充必要文档(FORGE_GUIDE 与权限文案)
  • 已确认测试结果或说明未执行原因

Copilot AI lite review requested due to automatic review settings August 4, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 为 Desktop 侧 Ghost 插件运行时补齐 network.secrets[].inject 的 endpoint 级收窄能力:在注入凭证时同时按 host、精确 URL.pathname 以及 HTTP method 三者匹配(省略新字段时保持旧的 host-only 语义),并在重定向/401 重试链路中逐跳重新匹配注入范围;同时同步相关校验、测试、文档与权限文案。

Changes:

  • 在 manifest 校验与共享逻辑中引入 inject.paths / inject.methods(含规范化与 fail-closed 校验)以及 endpoint 匹配函数。
  • networkSlot 注入链路中把注入判定从 host-only 扩展到 host+path+method,并在重定向与 401 重试中逐跳重算注入。
  • 补充/更新单测、FORGE_GUIDE 文档示例及四语权限说明文案。

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/desktop/src/shared/ghost.ts 新增 endpoint allowlist 校验/匹配逻辑,并将 scope 信息纳入权限展示 detail(仅在显式声明 paths/methods 时)。
apps/desktop/src/main/cindy-brain/networkSlot.ts 调整凭证注入与重定向/401 重试链路,按 host/path/method 逐跳重新判定注入。
apps/desktop/src/shared/tests/ghost.test.ts 覆盖 inject.paths/methods 的校验、归一化与权限 diff 行为。
apps/desktop/src/main/cindy-brain/tests/networkSlot.test.ts 覆盖 endpoint allowlist 注入、未命中时头剥离、同域重定向逐跳重算与 302 POST→GET 降级场景。
apps/desktop/src/main/cindy-brain/forge.ts 更新 FORGE_GUIDE 中 inject.paths / inject.methods 用法与语义说明。
apps/desktop/src/renderer/i18n/locales/zh-CN/common.json 更新凭证注入权限说明文案,提及可选 path/method 范围。
apps/desktop/src/renderer/i18n/locales/en/common.json 同步英文权限说明文案更新。
apps/desktop/src/renderer/i18n/locales/ja/common.json 同步日文权限说明文案更新。
apps/desktop/src/renderer/i18n/locales/ko/common.json 同步韩文权限说明文案更新。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src/main/cindy-brain/networkSlot.ts
Comment thread apps/desktop/src/main/cindy-brain/networkSlot.ts Outdated
Comment thread apps/desktop/src/shared/ghost.ts
Copilot AI review requested due to automatic review settings August 6, 2026 12:34
@FIERsity
FIERsity force-pushed the fix/ghost-secret-endpoint-allowlist branch from f0663e1 to ab8fc98 Compare August 6, 2026 12:34
@FIERsity
FIERsity marked this pull request as ready for review August 6, 2026 12:34
@FIERsity
FIERsity requested a review from a team as a code owner August 6, 2026 12:34
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 为 Ghost 凭证注入增加按 host、精确 pathname 与 HTTP method 联合匹配的 endpoint 范围,并通过 schemaVersion 3 阻止旧客户端静默降级。

  • 初始请求、401 认证刷新与每一跳重定向都会按实际 URL 和 method 重新计算凭证注入
  • manifest 校验会规范化 paths、methods 及新范围的权限详情,同时保持旧 host-only 清单的摘要兼容
  • 同步补充运行时、manifest、重定向测试以及中英日韩权限说明

Confidence Score: 5/5

在本次跟进审查范围内,既有权限详情顺序问题已修复,未发现仍阻塞合并的代码故障。

既有线程指出的 Hosts 顺序抖动已通过稳定排序消除,没有剩余的阻塞性失败。

Important Files Changed

Filename Overview
apps/desktop/src/shared/ghost.ts 新增 schemaVersion 3、endpoint 范围校验与权限详情归一化,并已修复既有 Hosts 顺序抖动。
apps/desktop/src/main/cindy-brain/networkSlot.ts 将凭证匹配扩展到 URL pathname 和实际 method,并在重定向与 401 流程中逐次重算和失效认证缓存。
apps/desktop/src/shared/tests/ghost.test.ts 覆盖新字段校验、版本门控、权限 diff、旧摘要兼容和 Hosts 稳定排序。
apps/desktop/src/main/cindy-brain/tests/networkSlot.test.ts 覆盖 endpoint 匹配、伪造头剥离、逐跳重定向和 method 降级后的 401 行为。
apps/desktop/src/main/cindy-brain/forge.ts 更新插件作者手册,说明 schemaVersion 3、精确 endpoint 范围及逐跳匹配语义。
apps/desktop/src/renderer/i18n/locales/en/common.json 更新英文凭证权限说明以反映可选路径和方法范围。
apps/desktop/src/renderer/i18n/locales/ja/common.json 更新日文凭证权限说明以反映可选路径和方法范围。
apps/desktop/src/renderer/i18n/locales/ko/common.json 更新韩文凭证权限说明以反映可选路径和方法范围。
apps/desktop/src/renderer/i18n/locales/zh-CN/common.json 更新中文凭证权限说明以反映可选路径和方法范围。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[插件网络请求] --> B{host 命中?}
  B -- 否 --> F[剥离宿主管理凭证头后发送]
  B -- 是 --> C{pathname 命中或未声明?}
  C -- 否 --> F
  C -- 是 --> D{method 命中或未声明?}
  D -- 否 --> F
  D -- 是 --> E[读取并注入凭证]
  E --> G[发送请求]
  G --> H{重定向?}
  H -- 是 --> B
  H -- 否 --> I{401 且允许安全重试?}
  I -- 是 --> J[失效缓存并重新注入]
  J --> G
  I -- 否 --> K[返回响应]
Loading

Reviews (8): Last reviewed commit: "fix(ghost): 401 且 method 降级时仍失效被拒令牌缓存;FO..." | Re-trigger Greptile

Comment thread apps/desktop/src/shared/ghost.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab8fc9857f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/shared/ghost.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (2)

apps/desktop/src/main/cindy-brain/networkSlot.ts:1128

  • 这里先 new Map(initial*) 但紧接着每次请求后都会用 current* 覆盖 response* 引用,导致不必要的拷贝分配。可以直接用 initial* 引用初始化,减少分配并让语义更清晰。
        let responseUsedExchange = initialUsedExchange;
        let responseOauthInjected = new Map(initialOauthInjected);
        let responseConnectionInjected = new Map(initialConnectionInjected);

apps/desktop/src/shared/ghost.ts:1791

  • endpointScope 作为 permission item 的 detail 会在所有语言环境原样展示;这里硬编码的英文前缀 "Hosts/Paths/Methods" 会导致中文/日文/韩文界面出现混排。建议改成语言无关的键值格式(例如 hosts=/paths=/methods=)或避免英文前缀。
        ? [
            `Hosts: ${(secret.inject.hosts ?? manifest.network?.hosts ?? []).join(', ')}`,
            `Paths: ${secret.inject.paths?.join(', ') ?? '*'}`,
            `Methods: ${secret.inject.methods?.join(', ') ?? '*'}`,
          ].join('\n')

Copilot AI review requested due to automatic review settings August 6, 2026 12:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da67e4b88d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/shared/ghost.ts
Comment thread apps/desktop/src/shared/ghost.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (1)

apps/desktop/src/shared/ghost.ts:1791

  • endpointScope 目前通过 GhostPermissionItem.detail 直接拼出 Hosts/Paths/Methods 英文标签字符串;但 renderer 会把 detail 原样展示给用户(apps/desktop/src/renderer/cindy-brain/GhostPermissionList.tsx:116-120),因此在所有语言界面里都会出现英文技术标签。同时 detail 又参与权限 baseline/diff(ghostPermissionBaselineKey / diffGhostPermissionItems),后续若仅想调整展示文案也会被视作“权限变化”触发复核。建议把展示与指纹用途解耦:要么将 endpointScope 改成稳定、语言无关且更易读的机器格式(例如结构化/可解析的多行 key=value 或 JSON),要么在 GhostPermissionItem 上新增专用于 diff 的稳定字段,detail 保持面向用户的本地化文本。
    const endpointScope =
      secret.inject.paths !== undefined || secret.inject.methods !== undefined
        ? [
            `Hosts: ${[...(secret.inject.hosts ?? manifest.network?.hosts ?? [])].sort().join(', ')}`,
            `Paths: ${secret.inject.paths?.join(', ') ?? '*'}`,
            `Methods: ${secret.inject.methods?.join(', ') ?? '*'}`,
          ].join('\n')

@MagicLizi

Copy link
Copy Markdown
Contributor

本 PR 触发了维护者确认门(product: feat 类型,新增插件凭证注入收窄策略)。

已创建讨论 issue,等待维护者确认。确认方式:

  • ✅ 直接在本 PR 上 Approve
  • 🔄 需要修改请 Request Changes,作者改完后重新 Approve 即放行

讨论 issue:#1948

@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 6, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@FIERsity 👋 这个 PR 还有 6 条 review conversation 没 resolve(apps/desktop/src/main/cindy-brain/networkSlot.ts / apps/desktop/src/shared/ghost.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi

Copy link
Copy Markdown
Contributor

@FIERsity 👋 这个 PR 目前与 main 有合并冲突,auto-review 因此暂时跳过、没法继续审查 / 合并。

请在本地 merge 最新的 origin/main 解决冲突后推送;冲突解除后,下一轮 auto-review 会自动重新处理这个 PR。

FIERsity and others added 3 commits August 8, 2026 09:55
为 network.secrets[].inject 增加可选 paths 与 methods 白名单;凭证仅在
host、pathname、method 同时命中时注入。缺省字段保持既有 host-only 行为。

初始请求、401 重试和每一跳重定向均按实际 URL 与 method 重新匹配;未命中
endpoint 时仍会剥除插件伪造的 Host 托管凭证头。同步 Forge 编写手册及四语
权限文案,并覆盖 manifest、运行时与重定向路径。

注意:这是 Draft 预览提交,尚不可合并/发布。旧 schema-v2 客户端会静默丢弃
未知 paths/methods,退回整域注入(fail-open)。必须先由维护者确定兼容发布
机制,并待 cindy-protocol#30 合入默认分支后再单独升级 submodule 指针。

验证:
- pnpm test:unit(通过本地缓存 pnpm 10.26.2 运行;所有适用 workspace 通过)
- desktop tsc --noEmit → 通过
- ghost/networkSlot/forge 定向测试 → 284 passed
- check:endpoints / check:i18n / check:brand-terminology / check:i18n-glossary → 通过

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: SAN <fierushio@gmail.com>
- 401 整链重试仅当最终响应 method 与原始请求 method 一致时进行:
  3xx 把 POST 降级为 GET 并丢 body 后不再重放原始副作用请求。
- 每跳注入注释更新为按 host / pathname / method 重算的实际行为。
- inject.hosts 排序归一化,与 paths / methods 同款,权限 detail / diff
  不再随声明顺序抖动。

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: SAN <fierushio@gmail.com>
manifestDigest 按数组原始顺序计算(canonicalJson 不排序);对旧
host-only 清单排序会让已装插件的账本摘要永久失配,触发市场所有权
检查与 OIDC 签发拒绝(AGENTS.md 存量插件兼容红线)。

改为:仅当同一凭证声明 inject.paths / inject.methods 时排序 hosts
(此时权限 detail 需要稳定);旧清单归一化输出与升级前逐字节一致。
权限 detail 的 Hosts 列表同样排序(Greptile P2),避免省略 hosts 时
按 network.hosts 声明顺序抖动。

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: SAN <fierushio@gmail.com>
Copilot AI review requested due to automatic review settings August 8, 2026 01:58
@FIERsity
FIERsity force-pushed the fix/ghost-secret-endpoint-allowlist branch from da67e4b to 3df6c69 Compare August 8, 2026 01:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9e71edc77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/cindy-brain/forge.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

…n fail-closed)

v2 清单声明 inject.paths/methods 直接拒装:旧客户端不识别这两个字段,
放行会让收窄静默退化为整域注入(fail-open)。声明新字段即升级版本,
旧客户端对 v3 整包拒装(schemaVersion 严格相等检查),形成 fail-closed
边界。normalize 输出保留输入版本,v3 清单 manifestDigest 与打包时一致。

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: SAN <fierushio@gmail.com>
Copilot AI review requested due to automatic review settings August 8, 2026 02:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de7d319064

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/cindy-brain/forge.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (2)

apps/desktop/src/shared/ghost.ts:623

  • ghostSecretInjectMatchesmethod 入参当前是 string,内部再用 method as GhostFetchMethod 做断言。这里的调用方(networkSlot.handleFetchRequest)已经把 method 校验并收窄到 GhostFetchMethod,建议把该函数签名也收窄到 method: GhostFetchMethod 并移除断言,避免未来出现未校验调用方传入任意字符串导致的静默不匹配。
  method: string,

apps/desktop/src/shared/ghost.ts:1828

  • 这里的 endpointScope 是主机生成的固定事实说明,但当前通过 detail 字段以硬编码英文 Hosts/Paths/Methods 输出。按本文件对 GhostPermissionItem 的约定(ghost.ts:1602-1605),detail 主要用于作者自由文本,主机固定说明应走 i18n(detailKey/detailArgs),否则会出现未本地化的用户可见文案,也会把“主机政策说明”和“作者说明”混在同一渲染通道里。建议把 endpointScope 改为结构化字段或新增一个 detailKey(例如 networkSecretEndpointScopeDetail)并用 i18n 模板渲染 Hosts/Paths/Methods 行;OAuth scopes 仍可继续放在 detail
    const endpointScope =
      secret.inject.paths !== undefined || secret.inject.methods !== undefined
        ? [
            `Hosts: ${[...(secret.inject.hosts ?? manifest.network?.hosts ?? [])].sort().join(', ')}`,
            `Paths: ${secret.inject.paths?.join(', ') ?? '*'}`,

@MagicLizi

Copy link
Copy Markdown
Contributor

@FIERsity 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/shared/ghost.ts / apps/desktop/src/main/cindy-brain/forge.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

- gh-cli 分支此前丢弃 endpointScope,扩大/替换限制不会进入权限 diff 与
  更新确认(P1);现与其它来源一致把规范化事实写进 detail。
- FORGE_GUIDE:paths 注明 1–16 条上限;声明 paths/methods 必须
  schemaVersion 3(主示例、network 段、拒装速查三处同步)。

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: SAN <fierushio@gmail.com>
Copilot AI review requested due to automatic review settings August 8, 2026 05:42
@FIERsity

FIERsity commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

已处理:全部 10 条 review conversation 现已 resolve(0 未解决)。

本轮新出现的 3 条(codex 02:03–02:53 评论)已修复并推送(HEAD 04c8b72):

  1. gh-cli 凭证 endpoint 范围进权限 detail(P1)— gh-cli 分支此前丢弃 endpointScope,扩大/替换限制不会进入权限 diff 与更新确认;现与其它来源一致把规范化事实写进 detail,并补了回归断言。
  2. FORGE_GUIDE 写明 paths 1–16 条上限(P2)— 手册同步注明。
  3. FORGE_GUIDE endpoint 示例切换 schemaVersion 3(P2)— 主示例、network 段、拒装速查三处同步"声明 paths/methods 必须 v3"。

验证:ghost.test.ts(含新断言)178 个 + forge.test.ts 35 个全过,desktop tsc 0 错误。CI 将随新 push 重跑。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04c8b72432

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/cindy-brain/networkSlot.ts
Comment thread apps/desktop/src/main/cindy-brain/forge.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

- P1:POST 经 3xx 降级为 GET 后 401,重放分支被 responseMethod ===
  originalRequestMethod 拦截,但 exchange/OAuth 令牌缓存此前不清,后续
  相同调用会一直复用被拒令牌、永远 401 无法刷新。新增对称失效分支
  (与 Connection 分支同语义),并补两次调用回归测试:第二次必须重新
  走交换端点取新令牌。
- P2:上轮 FORGE_GUIDE 加注释时多留了一个 }},导致示例 JSON 非法;
  删除重复闭合括号。

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: SAN <fierushio@gmail.com>
Copilot AI review requested due to automatic review settings August 8, 2026 05:57
@FIERsity

FIERsity commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

本轮 2 条新 P1 评论已修复并推送(HEAD 502cde7),thread 已全部 resolve(12/12):

  1. 401 且 method 降级时被拒令牌缓存未失效(P1)— POST 经 3xx 降级为 GET 后 401,重放分支被 method 匹配拦截,但 exchange/OAuth 令牌缓存此前不清,后续相同调用会一直复用被拒令牌、永远 401 无法刷新。新增与 Connection 分支同语义的对称失效分支,并补回归测试(两次相同调用,第二次必须重新走交换端点取新令牌——已验证修复前测试失败、修复后通过)。

  2. FORGE_GUIDE 示例多余闭合括号(P1)— 上轮加注释时多留了一个 },导致示例 JSON 非法、照抄无法打包。已删除重复括号。

验证:ghost 178 + networkSlot 99(含新测试)+ forge 35 = 312 全过,desktop tsc 0 错误。CI 随新 push 重跑。

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (1)

apps/desktop/src/main/cindy-brain/networkSlot.ts:1244

  • 这里在“Connection 401 且不允许重放”的分支里会直接 break,只作废了 Connection token 缓存;如果同一次请求同时注入了 exchange 凭证或 OAuth access token(responseUsedExchange / responseOauthInjected),它们的本地缓存不会被作废,后续调用可能持续复用被服务端拒绝的令牌并反复 401。建议在 break 前一并按本次实际注入情况失效 exchange / oauth 缓存。
          this.deps.log?.info('ghost fetch-request Connection 401 cache invalidated without replay', {
            ghostId, callId, method: responseMethod, host: url.hostname,
          });
          break;
        }

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 502cde7089

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2806 to +2807
if (raw.schemaVersion !== 2 && raw.schemaVersion !== 3) {
return { ok: false, reason: `schemaVersion 必须是 2 或 3,得到 ${JSON.stringify(raw.schemaVersion)}(v1 声明型已于 2026-07-12 移除)` };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 同步 schemaVersion 3 的权威规则说明

这里开始接受 schemaVersion: 3,但权威规则 docs/dev-rules/plugin-security-and-authoring.md:240-244 仍明确写着版本不等于 2 就会整份判无效,并据此分析降级行为;这会让后续作者和 reviewer 按已经失真的兼容性前提作判断。请在本次契约变更中同步该规则正文,说明 v2/v3 的接受范围及 v3 的降级结果。 docs/dev-rules/plugin-security-and-authoring.mdL29-L39

Useful? React with 👍 / 👎.

@MagicLizi

Copy link
Copy Markdown
Contributor

@FIERsity 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/shared/ghost.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi

Copy link
Copy Markdown
Contributor

@FIERsity 👋 这个 PR 目前与 main 有合并冲突,auto-review 因此暂时跳过、没法继续审查 / 合并。

请在本地 merge 最新的 origin/main 解决冲突后推送;冲突解除后,下一轮 auto-review 会自动重新处理这个 PR。

@MagicLizi MagicLizi removed touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 10, 2026
@MagicLizi MagicLizi added touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-discussion 等待维护者讨论(review-pr) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants