Repository navigation
feat(plugins): one consent screen for plugin capabilities, bound to the reviewed artifact - #130168
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 5:42 AM ET / 09:42 UTC. ClawSweeper reviewWhat this changesAdds artifact-derived capability consent for managed plugin install, update, and enable flows across the Gateway, CLI, setup flows, and Control UI. Merge readinessKeep open for maintainer review: this MEMBER-authored, protected-label PR introduces a security-sensitive activation contract and still needs explicit compatibility sponsorship plus exact-head CI before merge. The latest redaction and accepted-reenable repairs are present in the reviewed PR head, and no discrete patch defect was established. Priority: P1 Review scores
Verification
How this fits togetherManaged plugin lifecycle actions enter through the CLI, setup flows, or Control UI and inspect the installed or staged plugin manifest before changing configuration. The consent owner records a reviewed declared surface and the Gateway permits later activation only when that surface remains current. flowchart LR
A[CLI, setup, or Control UI] --> B[Managed plugin action]
B --> C[Read staged or installed artifact]
C --> D[Build declared capability surface]
D --> E{Current operator acceptance?}
E -- no --> F[Show review and require token]
E -- yes --> G[Persist activation or update]
F --> G
G --> H[Gateway reload and plugin runtime]
Decision needed
Why: This is an intentional security-versus-automation compatibility decision, not a mechanical correction: the new CLI flags and fail-closed behavior can interrupt established unattended workflows. Before merge
Agent review detailsSecurityNone. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Confirm the fail-closed consent contract for existing automation, retain the server-side artifact/token revalidation design, and merge only after the exact head completes its required checks. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug report: this PR introduces a new consent capability. Its PR body and latest comment describe isolated Gateway before/after checks, but this read-only review did not execute them. Is this the best way to solve the issue? Unclear until a maintainer confirms the intended upgrade policy. The inspected owner design appropriately keeps acceptance server-side and revalidates the artifact after the acknowledgement yields. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1c80cf86cfd0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
2b093f2 to
9ec8081
Compare
2b56ab8 to
d312e4a
Compare
d312e4a to
c849c41
Compare
|
The activation and package-inspection findings are addressed in this branch. Setup/onboarding, required runtimes, doctor repair/adoption, managed links, updates, provider/inference activation, and chat enablement now use the shared artifact-consent owner. Inspection and acceptance use canonical package discovery, including configured entry precedence and physical-source deduplication. Staged config publication also rechecks the accepted artifact after asynchronous setup work. The focused verification before rebase passed 1,401 tests across 50 files plus a runtime rebuild and real isolated CLI/Gateway tests. Those live tests exercised linked-install refusal/acceptance, package-wide inspect/enable token agreement, and refusal of a stale token after widening the artifact without changing config or acceptance. After integrating current main, another 341 focused tests passed, including both consent outcomes with beta-release selection; core types and scoped lint passed. Fresh Codex review of the full feature and final integration changes reported no blocking findings. All requested activation-coverage, consistent noninteractive behavior, package-surface, and final-effect test moves from the latest review are implemented. The existing before/after UI media remain in the PR. New browser recording is unavailable because the Chrome relay cannot connect; reconnect and stale-response behavior have component regression coverage. Final CI and the smoke rerun against main's updated plugin-index storage are in progress and are not yet claimed as passed. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…he reviewed artifact (openclaw#130168) * feat(plugins): surface plugin capability consent in Control UI and CLI Adds plugins.inspect (declared manifest surface, operator grants, install provenance/integrity, ClawHub trust), a Control UI consent dialog on install and external-plugin enable, a server-side acceptance gate persisted on the install record, artifact-anchored widen diffing, and --accept-capabilities for non-interactive CLI use. NOT READY TO LAND: autoreview found critical gaps (see PR notes) — the declared surface omits 20 of 21 contract families, native plugins always report zero hooks, several install/enable paths bypass the gate, and the acknowledgment is not bound to the reviewed surface. * refactor(plugins): bind capability consent to the reviewed surface Collapses the consent error payload to the fields the client cannot fetch (reviewToken, widened, acceptedAt) and pulls identity/declared/grants/source/ trust from plugins.inspect, shrinking the registry-free protocol reader from 395 to 91 lines and removing its divergence from the closed schema. Acknowledgment now carries the SHA-256 reviewToken of the surface the operator saw; the server recomputes the final staged artifact's surface and rejects any mismatch before persisting acceptance. That closes review-then-swap, laundering of forged acceptance through an unchanged update, and cross-artifact replay. All 22 manifest contract families are now declared, hashed and diffed, so a privileged family such as gatewayMethodDispatch can no longer be added without re-consent. Consent reads the manifest runtime discovery will execute, ambiguous install ownership fails closed, integrity resolution has one owner and no longer labels npm SHA-1 shasums as SHA-256, and code plugins disclose that hooks register at runtime instead of rendering an empty "no hooks" row. * fix(gateway): register plugins.inspect in method inventories and regenerate protocol Adds plugins.inspect to the advertised-method inventories (widening the fixed-size slice windows so older indices stay stable), regenerates the Kotlin protocol bindings, drops an unused exported type, and replaces two nested conditional spreads with a plain conditional. * refactor(plugins): split oversized consent modules and clear lint findings Extracts the MCP controller out of the plugins page, unchanged-install reconciliation out of update-installed, and the install lifecycle suite out of the management-service tests, bringing all three back under the max-lines limit without suppressions. Also renames a shadowed binding, drops an unnecessary generic, removes a spread-to-modify in a map, and types catch callbacks as unknown. * chore(protocol): regenerate Kotlin bindings after rebase * feat(plugins): let chat /plugins install review and accept capabilities The consent gate applies to chat installs too, but the command had no way to give consent, so external installs dead-ended on a CLI-only flag. Chat now replies with the plugin's declared capability surface and the exact command to rerun, and accepts a trailing --accept-capabilities mirroring the existing --force acknowledgement. ClawHub trust acknowledgement stays CLI-only. Staged-artifact verification is unchanged: the reviewToken is still checked against the final artifact before acceptance is recorded. * refactor(plugins): single-source the declared-surface groups and manifest precedence The ordered capability group list was defined independently in the consent engine, the protocol error reader, the CLI formatter and the Control UI, so a new contract family had to be added in four places with nothing enforcing it. All four now derive from one canonical list in the protocol schema with a compile-time exhaustiveness guard. Native-versus-bundle manifest precedence is centralized in one helper that both discovery and staged consent call, so the two cannot drift again — that divergence was a real bug where consent read one manifest and the runtime executed another. Also documents that carrying acceptance forward requires pinned artifact integrity, so integrity-less sources such as local paths ask on every install. * fix(plugins): enforce reviewed consent across activation flows Route setup, repair, linked installs, updates, and chat activation through artifact-bound capability consent. Reuse canonical package discovery and recheck staged activation before config publication. Invalidate stale Control UI review requests on reconnect. Verified focused owner and sibling tests, runtime rebuild, and real isolated CLI/Gateway install, inspect, enable, widening, and stale-token rejection flows. * test(plugins): cover beta installs through capability consent * test(plugins): align consent fixtures with staged artifacts * fix(ui): review staged plugin capabilities once * test(ui): inline the remaining plugin consent confirmation * test(plugins): verify consent with deferred install transactions * refactor(setup): share inference execution plan construction * test(ui): settle applied config before deferring refresh * fix(plugins): protect consent provenance and reuse acceptance
What Problem This Solves
Installing or enabling a plugin in OpenClaw gives it real authority — it can register tools, own providers and channels, contribute MCP servers, and request hooks that read conversation content or mutate prompts. Today an operator sees none of that at the moment they decide. The enforcement exists and is strong (manifest declarations validated fail-closed at registration, per-plugin capability grants, integrity-pinned install records, ClawHub trust verdicts), but it is spread across config, install records and registration diagnostics, and none of it surfaces in the Control UI plugin flow. The operator clicks Enable and something happens.
This adds one legible consent moment, on every surface where a plugin gains authority.
Why This Change Was Made
A source-audited comparison found this is the one plugin-security area where a competing agent is ahead, and that the gap is presentation rather than enforcement. That comparison also pointed at the right mechanism: show the declared set once, pin it, and re-prompt when it widens.
The design difference here is what the acceptance is anchored to. Re-consent that trusts a plugin to honestly re-declare its own surface can be defeated by a plugin that lies. This implementation hashes the surface read from the artifact on disk and verifies it again at the moment of acceptance, so the operator approves declared capabilities derived from the actual artifact rather than catalog metadata. The review token hashes that declared surface, not executable-file bytes; installer-provided artifact integrity is recorded separately.
User Impact
Installing a managed external plugin, or enabling one without current acceptance, now shows a single screen: identity and version, install source with pinned artifact integrity, the manifest-declared capability surface in human terms, the operator-granted capability flags with their effective values, and the ClawHub trust verdict when one exists. Confirmation is explicit. Re-enabling an unchanged, already accepted plugin does not prompt again.
Updates only re-prompt when the declared surface widens, and the prompt shows exactly what was added. Unchanged or narrowed surfaces refresh the stored acceptance silently.
Non-interactive contexts (automation, CI) fail closed with a typed error naming
--accept-capabilities, mirroring the existing install-policy acknowledgment pattern. Bundled plugins are exempt — they ship with the release rather than arriving as separately installed artifacts — and get the same capability visibility in the plugin detail overlay without a blocking gate.Before / after
Plugin detail overlay — before it showed only Category and Plugin ID:
After, with a Capabilities section fed by the new
plugins.inspect:Enabling an external plugin — before, the Enable button acted immediately:
After, one consent screen. Note the
Contractsrow surfacinggatewayMethodDispatchandtrustedToolPolicies, and the explicit disclosure that code plugins register hooks at runtime rather than an empty "no hooks" row:Evidence
Original feature verification: live-tested against a real gateway (isolated
OPENCLAW_STATE_DIR, own port, never the operator's) with a real plugin artifact installed from disk:--accept-capabilities.--accept-capabilitiesinstalls and persists acceptance into the install record: exact surface, SHA-256 hash, timestamp — read back directly from SQLite.gatewayMethodDispatchandtrustedToolPolicieswhile leavingtoolsunchanged is blocked. Before this change those two families were not part of the hashed surface at all, so that update produced an identical hash and no prompt.docs/plugins/manage-plugins.md.plugins.inspecton dialog open, thenplugins.setEnabledcarryingacknowledgeCapabilities: { reviewToken: "8a84c182…" }on confirm, captured from the WebSocket frames; acceptance rewritten server-side afterwards.Automated: 7 Vitest shards green (10,379 UI tests plus the plugin/gateway/protocol/CLI suites).
pnpm buildgreen including the Control UI performance gate with zero violations (startup JS gzip 340819 Bagainst a 340900 B limit, no baseline raised).tsgoclean acrosssrc/,ui/,packages/.pnpm ui:i18n:verifygreen. Swift protocol generation check green.A note on the bundle budget
An earlier revision imported the typebox validator registry from a module the Control UI loads, pulling every protocol schema into the browser startup bundle (+149 KiB gzip, blowing the budget by 45%). Fixed by following the existing
install-policy-warning-error-detailsconvention — a registry-free structural reader, with types still single-sourced from the schema via type-only imports — plus moving consent-only code off the boot-path barrel and registering the consent copy as a lazily loaded catalog likeen-activity. No performance baseline was raised.Review response
An independent review of the first revision found the acknowledgment was not bound to what the operator reviewed, and that only 1 of 22 manifest contract families reached the consent surface. Both are fixed here, and the fix for the first collapsed the error payload (the registry-free reader went 395 → 91 lines) because it was duplicating
plugins.inspectfield-for-field.Maintainer review follow-through
The previously listed activation and inspection gaps are closed. Onboarding and required runtime installation, provider/inference activation, channel/search setup, doctor repair/adoption, managed linked installs, updates, and chat enablement now use the shared artifact-consent owner. Noninteractive setup cannot silently approve capabilities. Bare unmanaged configured load paths remain outside managed-install consent and are documented explicitly; already-enabled legacy plugins do not receive a retroactive prompt.
Artifact inspection now uses canonical discovery and manifest precedence, so installation, the review screen, and enablement agree on the package-owned surface. It preserves explicit entry overrides and lexical symlink behavior, deduplicates physical package sources, and refuses missing sibling metadata. Setup holds the existing lifecycle lease through runtime resolution and revalidates staged activation at config publication, so a widened replacement installed during asynchronous login cannot inherit an older review. Update refusal leaves the old enabled plugin intact.
Control UI installs now use one canonical flow for catalog and search results: the server stages the requested package, the UI inspects that artifact after consent is required, and the operator confirms exactly once with its review token. There is no preliminary capability-less confirmation. Trust-policy acknowledgements survive the token retry. Three regression cases failed before this fix; the repair removed 61 net production lines. Consent and detail state are also invalidated on reconnect, and late responses cannot overwrite a reopened detail panel.
The final rebase preserves main's deferred install transactions from #122984. Artifact consent composes with the existing stage hook, while the transaction owner controls rollback before persistence and retention after commit. The five-source transaction matrix now uses actual staged payloads and retains explicit capability acceptance. Three tests of the superseded inferred-cleanup path were removed.
Verification: the integrated branch passed 599 focused tests across 14 files (129 plugin, 252 CLI, 73 UI, 145 inference), core production/test types, and scoped lint. Earlier owner/sibling runs passed 1,401 tests across 50 files; these counts overlap. Fresh isolated Codex reviews of the repairs, complete feature, UI flow, and final integration reported no accepted actionable findings.
At commit 1472351, the full build passed every compiler, runtime, SDK and UI performance stage. Startup JS was 341054 bytes gzip against the 343506-byte enforcement limit; no baseline was raised. Fresh real CLI/Gateway smoke tests used the rebuilt runtime and disposable state: declined linked/package installs published no install record or artifact; accepted installs recorded the canonical package surface; inspection matched acceptance; widening the installed manifest invalidated the old token; rejection left config and acceptance unchanged; fresh consent enabled the plugin. Both owned Gateways were stopped afterward.
The final CI repairs consolidate duplicate inference execution-plan construction (six fewer production lines) and make a cloud-worker settings fixture wait for its previous applied-config refresh before deferring the next read (five test lines, no product change). The 145 inference tests and all 7 cloud-worker browser tests passed afterward, along with types, lint and fresh independent review. All 6 plugin-page browser E2E tests also passed on the pushed head, including staged capability review. Hosted CI for the preceding head passed all 145 selected jobs (11 skipped). The subsequent review repairs passed fresh exact-head CI on 3945231: all 145 selected jobs passed, with 11 skipped. CodeQL, dependency checks, and separate mobile code-analysis workflows also passed.
The latest ClawSweeper findings are repaired at their owners in 394523172ab. Inspection and shared consent-review construction now use the existing URL redactor for display-facing provenance; the operational Git source remains unchanged for update/install use. The Control UI no longer predicts consent from external origin: it attempts enablement and opens review only on the server's typed consent-required response. This removes the redundant prompt for accepted external plugins and deletes the duplicate controller wrapper (ten fewer net production lines across both repairs).
Three backend and four UI assertions failed before these repairs. The repaired paths passed 121 focused tests across seven files, plus all seven browser E2E tests across the plugin page and config-mutation files. Core, UI and test types, scoped type-aware lint, formatting, the max-lines ratchet, and independent Codex review passed; one missing test-fixture field caught by the type gate was corrected and its seven inspection tests rerun.
A fresh real Gateway before/after probe seeded synthetic credentials into the existing disposable plugin's Git provenance through the canonical install-record writer. The previous built Gateway reproduced the raw response. The patched source-entry Gateway returned only the redacted URL, preserved the operational record and review token, and accepted disable/re-enable without a new acknowledgement. The probe restored the original disposable record and stopped both owned Gateways. This proves the real RPC projection, not an authenticated Git clone or a fresh local packaged build. Rendered-dialog and browser tests separately cover safe provenance display and accepted external enablement.
Classified net LOC versus the integration base: runtime/UI production +3,592; authored localization +72; tests and test support +5,263; generated protocol +280; tooling/config +22; docs +85. Pure module moves cancel in these net counts. The feature growth provides the shared declaration/token contract, protocol and consent UI, and missing activation boundaries; the last UI and inference simplifications remove 67 net production lines, and the final review repairs remove another ten.
The original sanitized before/after screenshots above remain applicable. A fresh real-profile browser recording was unavailable because the Chrome relay could not connect; no new recording is claimed. Hosted browser E2E and component checks provide supporting UI evidence. The earlier local full macOS installer fixture run was stopped after prolonged execution and is not counted as a pass.
Acceptance records are explicit consent facts: if a later enable-config write fails, the plugin remains disabled but the prior explicit acceptance may remain recorded. Staged install/config publication has compensation and regression coverage. This PR does not introduce a SQLite schema-version change; main's independently landed storage migration is preserved.
Maintainer decision on the latest exact-head review: retain explicit capability acknowledgement for noninteractive managed activation as the intended public contract. This follows the maintainer-author's explicit landing request for this feature. Existing current acceptance is reused; already-enabled legacy plugins are not retroactively blocked; the flag and upgrade behavior are documented. The latest ClawSweeper review reports no actionable code or security finding and accepts the real Gateway proof. Its incomplete-checkout limitation was resolved independently: the lead inspected the complete merge base, PR head, and current main at 1c80cf8. A conflict-free three-way merge preserves main's unrelated Cron fields and cloud-worker changes alongside this PR's consent and fixture repairs. Exact-head hosted CI is now green; native prepare and merge will revalidate the head and required gate.
Release-note context: add artifact-bound declared capability review to managed plugin installation and activation across CLI, chat, Control UI, setup, and repair, with re-consent for widened updates. Root CHANGELOG.md is release-owned and is not edited in this PR.