You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugin file access exists today (requestDirectory, consent, manifest.fs, deny-list) but cannot honestly state what a grant means while raw Node remains reachable in the plugin process. This issue collects direction only: trust tiers, two user-visible resource kinds (pluginData / other), structured read-only APIs (pi.db.* / pi.document.*) vs native Node for trusted plugins, grant lifetimes (and whether to supersede ADR 0088 §4), consent UX for consecutive prompts, and a non-bypassable deny-list. Discussion first; no implementation here. Source importers (#134) and the session write contract (#169) are tracked separately.
Summary / 摘要
插件已有文件能力,但没有一套能同时回答「用户看见什么、插件实际能碰什么、离 OS 隔离还差多少」的模型。
本 issue 只对齐设计方向,不排实现;具体来源导入见 #134,会话写入契约见 #169。
现状 / Current state
pi.plugin.getDataPath()→plugins/data/<pluginId>pi.fs.requestDirectory():用户选目录,内存 grant,随插件进程结束manifest.fs(workspace/userSelected+ scope)04-plugin-security.md§6)require("node:fs")/node:sqlite"(ADR 0008 D009)pi.*权限管的是 API,不是 进程。这是下面所有困局的根。困局 / Dilemma
授权 ≠ 隔离
对恶意插件,
requestAccess/ Always allow 可被 raw Node 绕过。若 UI 不说明,就是在误导用户。「目录」答不好「文件型资源」
用户真正要同意的是「读这个 SQLite 库」「读这个 PDF」,不是「读整个
~/.zcode/cli/db」。目录 grant 过宽,单文件 grant 又撑不起解析器。持久授权与 ADR 0088 冲突
ADR 0088 §4:consent never more durable than the session,nothing is persisted。
Always allow 必须显式取代该条,并配套查看 / 撤销 UI。
连续弹窗伤害体验
批量操作会连环确认。需要单飞队列、同 target 合并、拒绝冷却,而不是简单多弹几次。
用户心智只有两类
「插件自己的数据」和「其他文件」。现有
workspace/userSelected是实现细节,不应作为第三种资源展示。需要讨论收敛的点 / Open questions
信任分级
bundled / 受信插件与 marketplace 第三方,能力是否相同?sandbox 前对外表述应是「用户同意 + 审计」还是别的?
资源分类
是否确认用户可见只有
pluginData/other;workspace/userSelected降为路径解析细节。结构化只读 API
是否引入
pi.db.*(SQLite)、pi.document.*(PDF);还是受信插件继续用原生 Node([Feature] 支持从 ZCode 导入本地会话 / Add ZCode session import support #134 现行方案)。授权生命周期
once / process / persistent;persistent 是否本期做;撤销 UI 最小形态。
连续审批 UX
单飞队列、同 target 合并、拒绝冷却;错误码是否引入
USER_DENIED(与PERMISSION_DENIED区分)。不可绕过清单
deny-list 与 host-reserved 必须继承现行规范,且 grant 不得绕过——是否有人反对。
非目标 / Non-goals
关联 / Related
English summary
Plugin file access exists today (
requestDirectory, consent,manifest.fs, deny-list) but cannot honestly state what a grant means while raw Node remains reachable in the plugin process. This issue collects direction only: trust tiers, two user-visible resource kinds (pluginData/other), structured read-only APIs (pi.db.*/pi.document.*) vs native Node for trusted plugins, grant lifetimes (and whether to supersede ADR 0088 §4), consent UX for consecutive prompts, and a non-bypassable deny-list. Discussion first; no implementation here. Source importers (#134) and the session write contract (#169) are tracked separately.