Skip to content

plugins: require an explicit approve fingerprint for RPC plugin grants - #36279

Merged
nwparker merged 1 commit into
mainfrom
nwparker/plugin-cli-agents
Oct 30, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/plugin-cli-agents

Conversation

@nwparker

@nwparker nwparker commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​262 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​262
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​414 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​396

ELI5

Before this change, any program holding the local Orca CLI connection could turn on a plugin that runs code by copying a value out of the plugin list. Nothing told anyone, and nothing was logged. Now, turning on anything that runs code or acts in Orca over the CLI/RPC connection needs a separate approval code. Orca gives that code out only in an "approval required" answer that spells out exactly what would be granted. Each use is written to the plugin audit log as "approved via CLI".

What Changed

  • plugins.consent and plugins.setEnabled(enabled: true) over runtime RPC now go through one host function, approvePluginFromCli:
    • Content-only plugins (themes, icon themes, syntaxes, language packs) are enabled with no extra step. Main decides this from the verified manifest, not from what the caller says.
    • Anything else fails with approval_required unless the call carries a matching approvalFingerprint. The error's data lists the execution level, each capability with its consent text, the contributions, why approval is needed, and the exact --approve <fingerprint> flag. The error message carries the same thing as readable text.
    • The fingerprint (ap1-…) binds plugin key + version + consent fingerprint (capabilities, execution level, worker flag, and the content hash for code or instructions) + install content hash / dev-folder identity + the contribution list. A fingerprint shown for a different plugin, version, set of files, or access set is rejected with approval_stale, and that error carries the new grants.
    • Every grant is audit-logged before and after the write as cli:local / cli:paired-device:<id>, with the summary "approved via CLI --approve …".
    • Disabling and "keep disabled" never need approval.
  • The owner-token runtime socket now explicitly stamps callers as local-cli. Before, it relied on "no client kind means CLI". The resolved identity is the same.
  • New optional RPC fields: approvalFingerprint on plugins.setEnabled and plugins.consent. reviewedFingerprint is now optional over RPC. The desktop review dialog uses IPC and is unchanged.

Why

This is Phase 0 of the plugin CLI for agents. The approval model is the CEO's: an explicit approve flag, and the calling agent decides whether to ask its user. We could not trust caller identity alone. An agent's CLI reaches a remote Orca server as a paired device, so no transport proves that a person is behind a call. Binding the grant to a fingerprint that Orca shows together with the full grant list makes every grant explicit, specific, and auditable. It also means reading plugins.list can never quietly approve anything. Later orca plugin enable/dev load/install/update commands reuse this one function.

Linked Issue

N/A (maintainer).

Visual Proof

N/A: there is no UI change. This only changes RPC behavior; desktop IPC dialogs are untouched.

Testing

  • Automated tests added/updated
  • src/main/plugins/plugin-cli-approval.test.ts: content-only passes without a flag; code without the flag gives approval_required with grants; the right fingerprint grants and is audited; a fingerprint from another version, content hash, capability set, or plugin gives approval_stale; access that is already approved needs no flag; the dev-folder warning is shown.
  • src/main/runtime/rpc/methods/plugins.test.ts: a consent fingerprint read from plugins.list is refused; a paired-device caller is refused too; disabling and keep-disabled always work.
  • pnpm tc:node, pnpm run check:code-quality:changed, and the plugin and runtime-rpc test folders pass locally (macOS).

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Remote wire compatibility: the new fields are optional. Older hosts strip them, so they behave as before. No in-repo client (desktop, mobile, web) calls these two RPCs, so nothing in Orca regresses. An old CLI-style caller that approved code using only reviewedFingerprint is now refused on purpose.
  • SSH/remote: the approval is decided and logged on the host that runs the plugin.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A for visuals with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered
  • Typecheck, lint, tests pass locally for changed areas; CI covers the rest

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The changes add plugin approval requests and fingerprints, then use them to gate CLI and RPC approval of plugins that require CLI approval. The approval flow records audit attempts and outcomes and reports structured approval errors. RPC consent and enablement handlers pass caller identity and approval fingerprints into the flow. Disabling plugins and choosing keep-disabled remain direct decisions. Tests cover approval outcomes, stale fingerprints, RPC rejection cases, and disabling.

Priority: Normal

Merge Risk: Low · up to 0bf46

The approval flow appears mergeable, but its successful RPC path lacks direct test coverage. Add that coverage to reduce regression risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: requiring an explicit approval fingerprint for RPC plugin grants.
Description check Passed The description covers the required sections and explains the user-facing behavior, implementation, rationale, testing, compatibility, security, and remote-operation impact. The maintainer-specific Li…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description covers the required sections and explains the user-facing behavior, implementation, rationale, testing, compatibility, security, and remote-operation impact. The maintainer-specific Linked Issue exception is addressed, and the lack of UI changes is documented.

Full details: Docstring Coverage

Explanation

Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 10 functions across 11 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Nitpick comments: 1
src/main/runtime/rpc/methods/plugins.test.ts: 1

80-173: Trivial · Maintainability & Code Quality · Quick win

Add a positive RPC test with a matching fingerprint.

The tests cover only refusal and reduce-access paths. No test shows that plugins.setEnabled or plugins.consent succeeds when approvalFingerprint is correct. No test covers the approval_stale path from the handler at lines 96-101 of plugins.ts. A test with a matching fingerprint would also catch the enable-state question above, if it uses a real or more faithful consent writer.

Source: Learnings


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3717d1d2-1c54-406a-9ebf-cb56d72f04da
Commits

Reviewing files that changed from the base of the PR and between 7358da2 and 0bf46ea.

Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 11
  • src/main/plugins/plugin-audit-log.ts
  • src/main/plugins/plugin-cli-approval.test.ts
  • src/main/plugins/plugin-cli-approval.ts
  • src/main/plugins/plugin-service.ts
  • src/main/runtime/rpc/errors.ts
  • src/main/runtime/rpc/methods/plugins.test.ts
  • src/main/runtime/rpc/methods/plugins.ts
  • src/main/runtime/rpc/rpc-caller-identity.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-request-admission.ts
  • src/shared/plugins/approval/plugin-cli-approval.ts
  • src/shared/rpc-contract/plugins-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@nwparker
nwparker merged commit 9470b46 into main Oct 30, 2026
54 checks passed
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.

1 participant