Repository navigation
fix(plugin-devkit): warn on every permission the matrix marks high - #1467
Conversation
pi-plugin check warned on a hand-kept list of ten high-risk permissions. The comment said it followed PERMISSION_RISK in the desktop model, which in turn mirrors the permissions matrix, but neither copy was ever read back, so twelve declarable grants the matrix and the install dialog both mark high were never named in permission.high-risk: agent.complete, agent.extension, renderer.extension, provider.register, provider.oauth, desktop.control, project.create, session.read, session.import, session.delete.own, mcp.server.local, and mcp.server.remote. The legacy fs.write.workspace / fs.delete.workspace rows were missing as well. Take the list from the matrix's high rows and add a test that reads docs/spec/07-plugins/13-plugin-permissions-matrix.md and requires the two sets to be equal, so a permission added to the matrix later fails the devkit test instead of drifting silently. The warning stays a warning; no check result changes from pass to fail. Fixes vastsa#1463
muzimu217
left a comment
There was a problem hiding this comment.
Verified locally on macOS (worktree off current main): pnpm --filter @pi-desktop/plugin-devkit exec vitest run check → 7/7 pass, including the new parity test.
The design is the right fix for #1463: instead of hand-adding the 12 missing entries and waiting for the next drift, a test now parses the permissions matrix's high rows and pins HIGH_RISK_PERMISSIONS to equal that set — the two lists can no longer diverge silently. The warning-message test covering desktop.control and session.read matches the issue's examples.
One non-blocking observation for a possible follow-up: this pins devkit ↔ matrix, but the install dialog's copy (PERMISSION_RISK in apps/desktop/src/features/plugins/model.ts) is still a separate list. Today the behavior lines up — the four matrix-high permissions the dialog doesn't enumerate (project.create, provider.register, session.delete.own, session.import) fall through its ?? "high" default — but background.service is dialog-high without a matrix high row, and nothing tests dialog ↔ matrix. A second parity test (or a one-line matrix touch-up) would close that seam too. Not blocking this PR.
Merge-order note: same two doc files as #1468 — whoever lands second rebases.
…/pr1467-high-risk-warning-landing
…k-warning-landing
…k-warning-landing
|
Thanks for the permission-matrix reproducer and focused fix. I verified that the CLI warns for the matrix’s full set of high-risk permissions, the devkit tests pass (51/51), and the warning is visible in the CLI against the UI slots example. All required CI checks passed, and the PR merge ref matched the validated candidate tree. Merged. |
…permissions fix(plugin-devkit): warn on every permission the matrix marks high (cherry picked from commit c9e85a1)
Summary
pi-plugin checknames high-risk permissions in itspermission.high-riskwarning, but it used a hand-kept list of ten that had drifted from the permissions matrix. Twelve declarable grants that the matrix and the install dialog both mark high were never named:agent.complete,agent.extension,renderer.extension,provider.register,provider.oauth,desktop.control,project.create,session.read,session.import,session.delete.own,mcp.server.local, andmcp.server.remote. This PR takes the list from the matrix and adds a test that keeps the two equal.Fixes #1463
Root cause
HIGH_RISK_PERMISSIONS(packages/plugin-devkit/src/check.ts:22-38on779e16d9c) carried a comment saying it was kept in sync withPERMISSION_RISKinapps/desktop/src/features/plugins/model.ts. That file says in turn that it mirrors the risk column ofdocs/spec/07-plugins/13-plugin-permissions-matrix.md.renderer.extensionin docs(plugins): document the renderer slot contract #1456, which updated the matrix andmodel.tsonly) was missed.Change
HIGH_RISK_PERMISSIONSnow lists exactly the matrix's high rows: the twelve above plus the legacyfs.write.workspace/fs.delete.workspacerows. The legacy names still get their existingpermission.legacy-fsadvice as well.| \` | high |row, and requires the set to equalHIGH_RISK_PERMISSIONS`. A permission added to the matrix later fails the devkit test instead of drifting silently.packis unaffected.Out of scope, and raised as a question in #1463: the install dialog's own
PERMISSION_RISKtable disagrees with the matrix forui.view,ui.window.appearance,ui.settings,session.read.own,session.update.own, andbackground.service. That is desktop code and is left for a separate change once the intended tiers are confirmed.Production diff: +17 / −3 in
check.ts; the rest is tests (+24) and spec text.Specs / E2E docs
docs/spec/07-plugins/10-plugin-devex.md(en + zh-CN): the high-risk warning is defined as "every permission the matrix marks high".06-delivery/04-e2e-test-plan.mdE2E-022C status (en + zh-CN) mentions the parity test.Evidence
Tested commit
5bd79c034(fix/devkit-high-risk-permissions), based on main779e16d9c.pnpm check:pr-basepasses. Environment: Linux x64, Node 22.23.packages/plugin-devkit/src/check.test.ts:779e16d9c(10 entries vs 24 high rows) and passes with the fix;desktop.controlandsession.readgets both names inpermission.high-risk: fails on779e16d9c(no warning at all) and passes with the fix.pnpm --filter @pi-desktop/plugin-devkit test: 51 passed (main: 49).examples/plugins/ui-slots-lab, which declaresrenderer.extensionandagent.tool.register:examples/plugins/*and both bundled plugins still check with 0 errors.pnpm build:js,pnpm --filter @pi-desktop/desktop typecheck,pnpm lint,node scripts/check-architecture.mjs, andpnpm check:agent-policy: pass.pnpm -r --if-present test: every package suite passes. Theapps/desktopfailures I see are the same on a branch without this change:chat-error-message.test.mjs: a nested subtest is cancelled.*-user-pathtests need an installed Electron binary, which this worktree did not have.plugin-websocket/jev-api-key-checktests pass when run alone.pnpm docs:check(85 en/zh pairs, 559 pages): pass.git diff --check: clean.