#10570: feat(plugins): TOFU integrity verification for plugins
stale
size: L
Cluster:
OpenClaw Plugin Enhancements
## Human View
### Summary
- Adds Trust-On-First-Use (TOFU) integrity verification for plugins via `src/plugins/integrity.ts`
- On first load a plugin's manifest + tool descriptions are SHA-256 hashed and stored as a "pin"
- On subsequent loads the current manifest is compared against the pin — version bumps, added/removed/modified tools are flagged so the user can review before trusting
### Motivation
Plugin supply-chain attacks are a growing concern. A malicious plugin update could silently add/modify tools to exfiltrate data. TOFU provides a lightweight trust model (similar to SSH `known_hosts`) that alerts users to changes without requiring a central registry or code signing infrastructure.
### Design
- **Pin store**: File-backed JSON (`Map<pluginId, PluginPin>`) — portable, human-readable
- **Hashing**: SHA-256 of normalized tool descriptors (name + description + inputSchema), order-independent
- **Lifecycle**: `pinPlugin` → `verifyPlugin` → `approvePlugin` / `unpinPlugin`
- **Change detection**: Returns typed `IntegrityChange[]` — `version_changed`, `tool_added`, `tool_removed`, `tool_modified`
### Test plan
- [x] Auto-pin on first use
- [x] Trust unchanged manifest
- [x] Detect modified tool description
- [x] Detect added/removed tools
- [x] Detect version changes
- [x] Multiple simultaneous changes
- [x] Approve re-pins after review
- [x] Unpin removes entry
- [x] Persistence round-trip (save/load)
- [x] Corrupted pin file graceful fallback
- [x] Tool order independence (sorted hashing)
---
## AI View (DCCE Protocol v1.0)
### Metadata
- **Generator**: Claude (Anthropic) via Cursor IDE
- **Methodology**: AI-assisted development with human oversight and review
### AI Contribution Summary
- Code analysis and solution design
- Implementation and testing
### Verification Steps Performed
1. Analyzed source code to identify root cause
2. Implemented and tested the fix
### Human Review Guidance
- Core changes are in: `src/plugins/integrity.ts`, `src/plugins/integrity.test.ts`
- Review the breaking change implications
Made with M7 [Cursor](https://cursor.com)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Introduces a new TOFU-style plugin integrity system (`src/plugins/integrity.ts`) that hashes a plugin manifest + tool descriptors, stores a local “pin”, and reports version/tool diffs on subsequent loads.
- Adds a Vitest suite (`src/plugins/integrity.test.ts`) covering first-use pinning, unchanged trust, change detection (version/tool add/remove/modify), approval re-pin, unpin, persistence, and tool order independence.
- Stores pins in a file-backed JSON map keyed by plugin id and computes SHA-256 hashes for manifest/tool snapshots.
<h3>Confidence Score: 3/5</h3>
- This PR is close to merge-ready but has correctness issues that can trigger false integrity-change reports or ambiguous hashing behavior.
- Core approach and tests look coherent, but hashing `inputSchema` via plain JSON.stringify is not canonical (can flag changes when none exist), and duplicate tool names are silently collapsed/overwritten, breaking integrity semantics if such manifests occur.
- src/plugins/integrity.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#10559: feat(security): add plugin output scanner for prompt injection dete...
by DukeDeSouth · 2026-02-06
72.4%
#2556: fix(plugin-install): handle existing plugins and filter workspace deps
by longmaba · 2026-01-27
70.3%
#11032: fix(security): block plugin install/load on critical source scan fi...
by coygeek · 2026-02-07
69.9%
#20338: feat: add daedalus-memory plugin — trust-gradient memory with tri-c...
by CmdrFALCO · 2026-02-18
69.5%
#21964: Security: harden gateway and plugin trust boundaries
by Elormyevu · 2026-02-20
69.0%
#11071: Plugins: add tool_result_received hook for output interception
by ThomasLWang · 2026-02-07
68.6%
#14704: Add PIC Standard plugin for intent verification
by madeinplutofabio · 2026-02-12
68.5%
#6405: feat(security): Add HTTP API security hooks for plugin scanning
by masterfung · 2026-02-01
68.5%
#20424: Fix plugin extension path traversal in discovery/install
by markmusson · 2026-02-18
68.5%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
68.5%