🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
ADR 509: trust for the ruflo plugin marketplace — signing, scan before install, refusing project auto-approve keys
Status: Accepted (implemented in PR #4593, 2026-10-29)
Issue: #4581 follow-up 7. Builds on: the modTrust gate (ADR-404), settings-risk-scanner.ts, the helpers signing key (ruflo-helpers-signing-key), and metaharness mcp-scan.
1. Context
ruflo's marketplace (ruvnet/ruflo) is third-party. Claude Code reserves the official and community tier names for marketplaces sourced from github.com/anthropics/. Every plugin or mod installed from ruflo's marketplace runs with the user's privileges.
Three gaps remain.
- Nothing proves a plugin's files are the ones the maintainers reviewed. The marketplace clone follows the default branch. A compromised branch, a malicious PR that slipped through, or a tampered local clone all load the same way. The ruflo CLI's helpers are already signed with Ed25519 (
helpers.manifest.json,scripts/sign-helpers.mjs); plugins are not. - No scan runs before install.
ruflo mods installandruflo initcallclaude plugin installwithout checking what the plugin's MCP servers and hooks will run.metaharness mcp-scanexists, but nothing calls it on that path. - Project settings can pre-approve things. CVE-2025-59536 showed that a repository's
.claude/settings.jsonwithenableAllProjectMcpServers: truestarted an MCP server before the user could read the trust dialog.settings-risk-scanner.tsalready flags hook payloads andpermissions.allowentries thatruflo initcarries forward, but it is advisory only, and it does not cover the auto-approve keys.
2. Decision
2.1 Signed plugin manifests
At release, a new script, scripts/sign-plugins.mjs, writes plugins/<name>/.claude-plugin/signature.json for every plugin in .claude-plugin/marketplace.json:
- a SHA-256 of every file in the plugin, as a sorted list of path and digest;
- the plugin's version;
- an Ed25519 signature over that canonical JSON.
The signing uses the existing helpers signing key pair, so no new secret is created. The public key is already pinned in the CLI.
ruflo mods doctor and a new ruflo plugins verify [name] check the marketplace clone (and the install cache) against the signatures:
| Result | When |
|---|---|
verified |
Every file matches and the signature is valid. |
modified |
Lists the files that differ. |
unsigned |
No signature file. |
bad-signature |
The signature does not verify. |
With modTrust: refuse-risky, ruflo-mods refuses to trust a ruflo plugin whose clone is modified or bad-signature. Its plugin.register gate already sees the plugin id; it gains the verify result through a status file that ruflo mods doctor writes at install time. Without that setting the result is reported, not enforced, because a contributor running from a local checkout is always modified.
2.2 Scan before install
ruflo mods install, ruflo init (mods path) and ruflo plugins install run a static scan of each plugin's .mcp.json, hooks/hooks.json and hook modules before claude plugin install. It reuses metaharness mcp-scan rules when that package is present, and the mods trust classifier (hooks/trust.ts capability list) otherwise.
- A
highfinding stops the install and names the plugin, file and rule.--accept-risk <plugin>overrides it for that one plugin and records the override in.claude-flow/mods/install.json. mediumfindings are printed and the install continues.
2.3 Refuse project-level auto-approve keys
settings-risk-scanner.ts gains these keys when they appear in project settings (.claude/settings.json, .claude/settings.local.json):
enableAllProjectMcpServers: true;- non-empty
enabledMcpjsonServers; permissions.defaultMode: "bypassPermissions";permissions.allowentries with a bareBashor a*wildcard;hooksentries whose command is not a ruflo helper.
When ruflo init or init --upgrade would carry such a key forward, it now stops and prints the key and the reason. Two flags continue past it:
--keep-risky-settingskeeps the key;--drop-risky-settingswrites the merged file without it.
ruflo doctor reports these keys as a warning in any project.
3. Limits
- Signing proves the files match a release. It does not prove the release is safe; review still does that.
- A user who points the marketplace at a fork gets
unsignedormodified, by design. - The scan is static. A hook that downloads code at run time is caught only by the rules that flag network and process use, which the trust classifier already names.
4. Verification
sign-pluginsandverifyround-trip, including tamper, missing-file, extra-file and bad-signature cases.- The install path stops on a
highfinding and records--accept-risk. - The risk scanner covers each new key.
initstops and--drop-risky-settingsremoves the key.- Live:
ruflo plugins verify ruflo-modsreportsverifiedon a published release clone.
Implementation notes
What shipped, and where it differs from §2.
§2.1 signing.
v3/@claude-flow/cli/scripts/sign-plugins.mjssigns every plugin listed in.claude-plugin/marketplace.json. It writessignature.jsoninto the plugin's marketplacesourcedirectory:plugins/<name>for most plugins, a subdirectory such asplugins/ruflo-ai-team/directoryfor the few whose source points there.It resolves the key exactly as
scripts/sign-helpers.mjsdoes:RUFLO_HELPERS_SIGNING_SECRET+RUFLO_HELPERS_SIGNING_PROJECT;RUFLO_HELPERS_SIGNING_KEY;~/.ruflo/helpers-signing.key;--stdin-key.
It never prints the key, and it refuses a non-Ed25519 key without echoing it.
Inside a git checkout it signs only the files git tracks. A stray untracked file in the release checkout then verifies as
extraand is never vouched for.This PR signs nothing with the real key. The tests use a generated key pair. Every plugin reports
unsigneduntil the first signed release.Release step (after the tree is final, before tagging):
RUFLO_HELPERS_SIGNING_SECRET=ruflo-helpers-signing-key RUFLO_HELPERS_SIGNING_PROJECT=ruv-dev \ node v3/@claude-flow/cli/scripts/sign-plugins.mjs node v3/@claude-flow/cli/bin/cli.js plugins verify --clone . --strict # every plugin must print verifiedCommit the
signature.jsonfiles with the release. Re-sign whenever a plugin file changes: a stale signature reads asmodified.Verifier (
src/plugins/marketplace-trust/signature.ts). It uses the pinnedRUFLO_HELPERS_PUBKEY.- A signature whose
pluginfield is not the marketplace name isbad-signature, so a valid signature cannot be copied onto another plugin. - Symlinks are digested as
link:<target>and never followed. .gitandnode_modulesare not signed content.
- A signature whose
Status file location. The status file is
~/.claude-flow/mods/plugin-verify.json, keyed by Claude Code config dir. It lives under home rather than in the project, so a repository cannot ship a file that says its own tampered clone verified. These commands write it:ruflo mods install, after the claude step;ruflo mods doctor;ruflo plugins verify, unless--cloneis given.
Mod gate. The
plugin.registergate (plugins/ruflo-mods/hooks/trust.ts,marketplaceRefusal) refuses a user-tier<name>@ruflomodule whose result ismodifiedorbad-signature. It does so only undermodTrust: refuse-risky.modTrustAllowdoes not exempt the check: a tampered clone shares the allow-listed provenance.- A missing or unreadable result,
unsigned, orverifiedis not enforced, because unknown is not a refusal. - A verified module still goes through the existing risk judge.
Exit and doctor behaviour.
ruflo mods doctorreportsunsignedas a pass that says "unsigned", somods doctor --strictCI gates do not fail before the first signed release.modifiedandbad-signaturewarn.ruflo plugins verifyexits 1 onmodifiedandbad-signature. With--strictit also exits 1 onunsigned.
§2.2 scan before install.
src/plugins/marketplace-trust/scan.tsis a built-in static scan.metaharness mcp-scanis not called: it is an optional subprocess, and it reads a harness layout (.mcp/servers.json), not a plugin layout. The scan reuses two existing rule sets:- the settings-risk-scanner command rules, for
.mcp.jsonserver commands andhooks/hooks.jsoncommand hooks; - the capability names from the ruflo-mods trust classifier (
$.process,$.http.fetch,$.mcp,$.tool.call,$.config.set), for hook modules.
- the settings-risk-scanner command rules, for
- Severity.
- High: a dangerous command, or a hook module that imports
child_processor useseval/new Function. - Medium: a capability use, an unpinned
npx -yserver, or a remote plain-http MCP URL. - Measured on this tree: 0 high and 17 medium across all 47 marketplace plugins, so no ruflo plugin is blocked.
- High: a dangerous command, or a hook module that imports
ruflo mods installandruflo init(mods path). The scan runs after the marketplace refresh and before anyclaude plugin install. It is wired in through a newbeforeInstallhook inrepairPluginInstall.- A blocked plugin's install step does not run. The step output names the file and the rule.
--accept-risk <plugin>onruflo mods installoverrides the block. The override is recorded underacceptedRiskin.claude-flow/mods/install.json.ruflo inithas no--accept-riskof its own. A plugin it blocks is reported, andruflo mods install --accept-risk <name>completes it.- A
--source localdirectory marketplace has no install step, so nothing is gated there.
ruflo plugins install.- A local-path install is scanned the same way, with
--accept-risk <dir-name>. - An npm or registry install is not scanned before it is registered: the package lands inside the plugin manager. That path keeps its existing checksum and trust gates.
- A local-path install is scanned the same way, with
§2.3 project auto-approve keys.
settings-risk-scanner.tsgainsscanProjectAutoApproveKeysanddropAutoApproveKeys.What counts as a ruflo helper. A hook counts as one when
isRufloHelperCommand(inhelper-commands.ts) recognises it, with nothing chained onto it. That covers:- every form ruflo generates;
- the older
npx @claude-flow/cli@… hooks|memory …hooks thatinit upgrademigrates.
ruflo's own generated settings produce no finding, so a re-init never stops on itself.
Where it stops. The check runs before anything is written, so a stop leaves the project untouched. These commands can stop:
ruflo initand its wizard, when merging into an existing.claude/settings.json;init hooks;init upgrade --settings.
--force, and an upgrade without--settings, carry nothing forward and never stop.Flags.
--keep-risky-settingskeeps the keys and still reports them.--drop-risky-settingswrites the merged file without them. Passing both is an error.Doctor.
ruflo initmerges onlysettings.json.ruflo doctor(componentauto-approve) warns on bothsettings.jsonandsettings.local.json.Behaviour change for existing projects. If a project's settings carry any hook ruflo did not write (for example a formatter),
init upgrade --settingsnow stops until one of the two flags is given. Two existing test fixtures carry such a hook. Both now pass--keep-risky-settingsand assert the stop:mods-commands.test.ts, case--add-missing and --settings;doctor-2677-stale-settings.test.ts.
Live validation.
Setup. Claude Code 2.1.289 with haiku and
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1.--plugin-dirpointed at this branch'splugins/ruflo-mods, andmodTrust: refuse-riskywas set through--settings pluginConfigs. A temporary status file marked three marketplace-installed plugins:ruflo-docsasmodified;ruflo-jujutsuasbad-signature;ruflo-testgenasverified.
Mod gate result. The debug log showed:
ruflo-docs@ruflorefused with "marketplace clone is modified (ADR-509 signature check)";ruflo-jujutsu@ruflorefused asbad-signature;ruflo-testgen@ruflopassed through to the risk judge.
The temporary file was removed afterwards.
Init result. The scratch project's settings held
enableAllProjectMcpServers: trueand a bareBashallow.ruflo initstopped with exit 1 and wrote nothing. The same run with--drop-risky-settingswrote merged settings without either key.
Not done here. §4 asks for a live ruflo plugins verify ruflo-mods that reports verified on a published release clone. That needs the first signed release; until then it reports unsigned.
Review fix pass (same PR)
- §2.3 classifier is an exact match.
isRufloHelperCommandno longer reusespinToUserHelpers(a rewriter that acceptednode -ebodies naming a helper, and any node flags before the helper path). It compares the command by string equality against the closed set ruflo generates or has generated: each helper (hook-handler.cjs,auto-memory-hook.mjs) × an allow-list of subcommands × scope × platform, the statusline forms, the legacy sh / cmd /IF EXIST/ git-rootnode -e/ relative forms, andnpx @claude-flow/cli@<tag|version> hooks|memory <sub>(never a bare package name, which a project'snode_modules/.bincould answer).node -ewith extra code,-r/--require,--import, aNODE_OPTIONS=prefix and a helper path in a comment are now findings. - §2.3 project-shipped helpers.
initkeeps an existing.claude/helpers/*without--force, and project-scope hooks prefer the project copy, so an exact ruflo hook could still run repository code.initnow also stops when a critical helper (the signed set) is neither the copy this ruflo ships nor in a helpers manifest signed with ruflo's key.--drop-risky-settingsreplaces it with ruflo's copy;--keep-risky-settingskeeps and reports it;ruflo doctorwarns. A.LOCKEDhelpers dir is skipped, and with no ground truth at all (no shipped copy, no signed manifest) the check fails open, ashelper-integritydoes.init upgradealready overwrites the critical helpers, so it needs no such check. - §2.2 a blocked plugin is never left enabled. Claude Code loads an enabled plugin from the marketplace clone, install or not.
applyModsnow scans an existing clone before it enables anything and does not enable a blocked plugin; one the post-refresh scan blocks has itsenabledPluginskey removed and is dropped from the install record. This covers--no-plugin-install, test/CI and no-clauderuns. Limit: with no clone on disk yet there is nothing to scan; the run says the plugins are enabled unscanned, and Claude Code's first trusted start clones and loads them. A finding in a stale clone that the refresh would fix keeps that plugin off until the next run. - §2.2 the scan reads what loads.
hooks.jsonmodulesare resolved against hooks.json and every relativeimport/export … from/import()/require()they reach is followed (extension,.js→.tsandindex.*resolution; type-only imports skipped). The walk's test-name,tests/and size skips do not apply to those files. A loaded file that is missing, unreadable, over 1 MB, outside the plugin, or loads a computed module name is a high finding. Every plugin in this repo still scans with no high finding. - §2.1 Windows. Both sides key the status file with one normalization (forward slashes, no trailing slash, drive paths lower-cased); the mod uses
USERPROFILEwhen it is a Windows path (whatos.homedir()used), elseHOME.plugins/.gitattributes(** -text) turns off line-ending conversion so acore.autocrlf=trueclone hashes as signed. Not exercised on a Windows host here: covered by harness tests with Windows paths and an MSYSHOME. - §2.1 the copy that runs. Every writer (
mods install,mods doctor,plugins verify, which now records the cache even with--no-cache) records the install-cache copies too: per plugin the worst of all copies, and each copy by its directory. The mod looks up theplugin.registerroot(the plugin directory being loaded) first and falls back to the per-plugin worst. - Live validation of the fix pass (Claude Code 2.1.289,
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1,--plugin-dirat this branch's ruflo-mods,modTrust: refuse-risky;/costprompts, so no model call). A temporary status file keyed/home/<user>/.claude/(trailing slash) markedruflo-jujutsumodifiedinpluginsand the directory…/plugins/ruflo-docs/modifiedinpathswhilepluginssaidruflo-docs: verified. The debug log showedruflo-docs@ruflo copy at …/plugins/ruflo-docs is modified(path lookup, matching the engine'sroot),ruflo-jujutsu@ruflo marketplace clone is modified(normalized config-dir key) andruflo-testgenpassed on to the risk judge. The file was removed afterwards.