Skip to content

docs(plugins): align permissions matrix with host behavior - #2024

Merged
vastsa merged 2 commits into
vastsa:mainfrom
zszz3:docs/plugin-permissions-matrix-audit
Oct 31, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
zszz3:docs/plugin-permissions-matrix-audit

Conversation

@zszz3

@zszz3 zszz3 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Related to #2000

P1 第 3 项:13-plugin-permissions-matrix.md 对照 SDK 权限定义与宿主权限检查。只改文档,中英文成对。

检查的文档

  • docs/spec/07-plugins/13-plugin-permissions-matrix.md
  • docs/zh-CN/spec/07-plugins/13-plugin-permissions-matrix.md

对照的代码

已核对一致

  • §2 矩阵的权限行与 PLUGIN_PERMISSIONS 45 项一一对应(另含 3 个 legacy fs.*.workspace)。
  • §2 Risk 列与 PERMISSION_RISK 逐项一致(48 项,无差异)。
  • §2 中“Allowed API”与运行时 assertPermission 抽查一致(clipboard、shell、keyboard、session.*、models、usage、speech、project、net.websocket 等)。
  • §5 升级新增权限:审核对话框标出新增权限;自动更新跳过新增权限的更新(install.rs#L254-L257),与文档一致。

发现与修改

# 文档原文 代码实际 修改
1 §2 “Default policy” 列按权限给出 “Confirm on first use” / “Deny by default” / “Granted at install” 等 安装授权是整体的:授权集合缺少任何声明权限时 PLUGIN_PERMISSION_DENIED: missing grant for …;运行时没有首次使用确认,clipboard.* / shell.openExternal 只调用 assertPermission 矩阵后加一段说明:该列是预期策略,并写明当前实际行为
2 §2A net.domains 约束的出网路径未列 websocket plugin-websocket.ts#L8-L9 对不在 manifest.net.domains 的主机拒绝连接;§2 net.websocket 行本身也这样写 补 pi.net.websocket
3 §3 “缺权限的贡献校验失败” 只列 themes、mcpServers、services、bus 宿主还会因缺权限拒绝 views、providers、OAuth providers、agentExtensions、composerTransforms、globalShortcuts、windowAppearance;scenicThemes 缺 ui.settings/ui.theme 时只是 不显示 补全列表
4 §3 无需权限的事件只列 4 个 03-plugin-api §5 中 appearance:changed、session:activated 同样无需权限、走同一通道 补这两个
5 §4 文案表与语言包不符:6 条文案不同(如 fs.read 文档为 “Read the files it lists”,实际 “Read files”;net.fetch 为 “Use the network”);5 条写了语言包里不存在的文案(ui.settings、session.import、session.*.own);缺 8 条语言包已有的权限(ui.panel、ui.microphone、clipboard.write、provider.register、provider.oauth、desktop.control、net.anyHost、session.autoTitle) 文案以语言包为准;无条目时 回退为原始权限名 表格改为语言包实际文案(38 条),列出 7 个没有文案的权限;说明文件范围实际显示在已安装插件行的“Files”一栏

发现但未在本 PR 处理

  • 安装/更新审核不显示 fs.* 的声明范围,与 §7 验收第 2 条不符;7 个权限没有显示文案。这是代码问题,已另开 plugins: permission review lacks copy for 7 permissions and does not show fs scope #2023。§7 验收条件保持不变。
  • §2 中 agent.extension / renderer.extension / provider.register 写的 “local imports and development plugins only in v1.1”:桌面宿主安装路径里没有找到对应限制(install.rs、marketplace.rs)。市场目录是否另有限制不在本仓库,无法核实,所以没改。

验证

  • git diff --check 通过
  • 未改标题和锚点;新加的 “§5” 引用指向现有章节
  • 分支基于 upstream/main c85251b

The matrix read as if each permission had its own default policy, with
some prompting at first use, while the installer grants the declared set
as a whole and no runtime path prompts again. The display copy table no
longer matched the i18n catalogs, listed copy for permissions that have
no catalog entry, and omitted eight that do. The dependency list also
named only four of the contributions the host rejects without their
permission.

Record the current grant behavior, take the copy from the catalogs,
complete the dependency and no-permission event lists, and add
pi.net.websocket to the net.domains bound, in both the English and
zh-CN documents.

Related to vastsa#2000

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

已独立对照安装/更新授权、运行时 assertPermission、贡献校验、scenicThemes 显示过滤、事件通道和权限审核 UI。另逐项验证中英文文档的 48 项风险等级、38 条显示文案、7 个原始权限名回退与 SDK、PERMISSION_RISK 和语言包完全一致,未发现阻塞问题。

最新 main:e93d50efdecf2733bf8ded32ae6641e103b21c5c;已验证的 GitHub 合并候选:fa858cd3cd1619da82a49bb8a4f5b666c89cd591。diff --check、base ancestry、86 组中英配对、599 个文档页面、agent-policy sync、VitePress 生产构建及 GitHub Docs checks / Head contains latest base 全部通过。仅文档改动,应用 E2E 不适用。

@vastsa
vastsa merged commit f0cdf59 into vastsa:main Oct 31, 2026
2 checks passed
@Tioit-Wang

Copy link
Copy Markdown
Collaborator

Merged. Thanks!

The permissions matrix is the highest-stakes document in the set, and you audited it against both the SDK permission definitions and the host-side assertPermission call sites rather than one of the two. Splitting the review-UI defect into #2023 kept the doc PR factual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants