Files
ruflo/.github/workflows
ruvandAeon 82edec30f9 fix(security): #1922 — verify plugin-registry Ed25519 signature properly (CWE-347)
The plugin-registry signature verifier in
`v3/@claude-flow/cli/src/plugins/store/discovery.ts` was a stub that
returned `true` whenever the served `registryPublicKey` field started
with `"ed25519"`. The call site only `console.warn`ed on failure and
continued to use the unverified registry. With `requireVerification:
true` (the default), a network adversary on the path to an IPFS
gateway could swap the served registry and have a user install
attacker-controlled plugin tarballs with filesystem+network+hooks
permissions.

Patch (originally proposed in #1922 by @aaronjmars; CWE-347):
- Import `verifyEd25519Signature` from `transfer/ipfs/client.ts` (the
  real Ed25519 verifier already lived there, just wasn't wired in).
- Replace the stub with an async verifier that mirrors `signRegistry()`
  in `scripts/publish-registry.ts:127-151`: strip `registrySignature` +
  `registryPublicKey` from the registry copy, `JSON.stringify`, verify
  signature against `expectedPublicKey`.
- Pin verifier to the caller-supplied `expectedPublicKey` (the trusted
  pinned key from `DEFAULT_PLUGIN_STORE_CONFIG`), NOT the self-asserted
  `registry.registryPublicKey` (which an attacker can swap too).
- Update call site to `await` the now-async verifier AND fail closed
  (return demo registry on failure rather than warn+continue).

CI guards (this commit):
1. `scripts/smoke-plugin-registry-signature.mjs` — 13-check regression
   smoke covering: (a) static contract on discovery.ts (correct import,
   canonicalization, pinned-key call, no stub revival), (b) Ed25519
   crypto round-trip matching signRegistry()'s scheme (valid passes,
   tampered fails, empty fields fail, swapped served key cannot defeat
   the trusted pin), (c) call-site byte check (await + fail-closed).
2. `plugin-registry-signature-smoke` job in `v3-ci.yml` runs the smoke
   on push + PR (including from forks now that pull_request branches
   include `develop`).
3. Path filters added for `discovery.ts`, `transfer/ipfs/client.ts`,
   `publish-registry.ts`, and the smoke itself so any future drift in
   the signing scheme triggers re-verification.

Acceptance:
- `node scripts/smoke-plugin-registry-signature.mjs` → 13/13 pass
- Build of `@claude-flow/cli` clean (no new typecheck errors)
- Root npm audit: 0 vulnerabilities
- Supply-chain audit (5 layers): no hard-fail findings

Sibling `verifyRegistrySignature` stub at
`transfer/store/registry.ts:278` is dead code today; tracked as a
follow-up (delete-if-dead or rewrite when wired up).

Co-Authored-By: Aeon (aaronjmars) <aeon@aaronjmars.com>
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-19 16:39:54 -04:00
..