claude-flow 3.75.2 → 3.75.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,9 +46,16 @@ export declare class PatternDownloader {
46
46
  */
47
47
  private verifySignature;
48
48
  /**
49
- * Return the trusted Ed25519 public key that a pattern's signature must verify
50
- * against (#4750). Prefers config.trustedRegistryPublicKeys, falls back to the
51
- * entry's declared publicKey only when it is well-formed.
49
+ * Resolve the Ed25519 public key a pattern's signature must verify against
50
+ * (#4750). Returns whether the key is *pinned* (came from the operator's
51
+ * config.trustedRegistryPublicKeys) or merely the entry's own self-declared
52
+ * publicKey. Callers that enforce verification must treat a self-declared key
53
+ * as untrusted: otherwise a malicious registry entry can sign its own content
54
+ * with its own key and pass (the exact gap #4750 was filed to close).
55
+ */
56
+ private resolveVerificationKey;
57
+ /**
58
+ * Thin wrapper kept for callers that only need a usable key.
52
59
  */
53
60
  private resolveTrustedPublicKey;
54
61
  /**
@@ -76,11 +76,21 @@ export class PatternDownloader {
76
76
  console.log(`[Download] Checksum verified!`);
77
77
  }
78
78
  }
79
- // Verify signature against a trusted key (#4750). A signature that does
80
- // not verify against a trusted key is refused rather than written; when
81
- // requireVerification is set, a missing/untrusted signature is also
82
- // refused. The self-declared pattern.publicKey alone is not trusted.
83
- const trustedKey = this.resolveTrustedPublicKey(pattern);
79
+ // Verify the signature (#4750). A signature that does not verify against
80
+ // the resolved key is refused rather than written. When requireVerification
81
+ // is on, verification must be backed by a *pinned* key: a self-declared
82
+ // pattern.publicKey is not trusted, so an entry that supplies its own key
83
+ // is refused rather than allowed to self-sign.
84
+ const { key: trustedKey, pinned } = this.resolveVerificationKey(pattern);
85
+ if (this.config.requireVerification && !pinned) {
86
+ console.warn(`[Download] requireVerification is on but no trusted (pinned) key is configured for ${pattern.id}; refusing self-declared key. Configure StoreConfig.trustedRegistryPublicKeys to download this pattern, or disable requireVerification.`);
87
+ return {
88
+ success: false,
89
+ pattern,
90
+ verified: false,
91
+ size: content.length,
92
+ };
93
+ }
84
94
  if (pattern.signature && trustedKey) {
85
95
  const sigVerified = await verifyEd25519(content, pattern.signature, trustedKey);
86
96
  if (!sigVerified) {
@@ -93,6 +103,7 @@ export class PatternDownloader {
93
103
  };
94
104
  }
95
105
  console.log(`[Download] Signature verified!`);
106
+ verified = true;
96
107
  }
97
108
  else if (this.config.requireVerification) {
98
109
  console.warn(`[Download] No verifiable signature and requireVerification is on, not writing the pattern.`);
@@ -288,32 +299,38 @@ export class PatternDownloader {
288
299
  }
289
300
  }
290
301
  /**
291
- * Return the trusted Ed25519 public key that a pattern's signature must verify
292
- * against (#4750). Prefers config.trustedRegistryPublicKeys, falls back to the
293
- * entry's declared publicKey only when it is well-formed.
302
+ * Resolve the Ed25519 public key a pattern's signature must verify against
303
+ * (#4750). Returns whether the key is *pinned* (came from the operator's
304
+ * config.trustedRegistryPublicKeys) or merely the entry's own self-declared
305
+ * publicKey. Callers that enforce verification must treat a self-declared key
306
+ * as untrusted: otherwise a malicious registry entry can sign its own content
307
+ * with its own key and pass (the exact gap #4750 was filed to close).
294
308
  */
295
- resolveTrustedPublicKey(pattern) {
296
- // Prefer an explicitly configured trusted key (keyed by registry name /
297
- // IPNS name). Otherwise fall back to the entry's own declared public key,
298
- // which is only acceptable when it is a well-formed ed25519 key.
309
+ resolveVerificationKey(pattern) {
299
310
  const trusted = this.config.trustedRegistryPublicKeys;
300
311
  if (trusted) {
301
312
  const candidates = [pattern.author?.id, pattern.source, pattern.id].filter(Boolean);
302
313
  for (const key of candidates) {
303
314
  const pinned = trusted[key];
304
315
  if (pinned && pinned.startsWith('ed25519:')) {
305
- return pinned;
316
+ return { key: pinned, pinned: true };
306
317
  }
307
318
  }
308
319
  // Any configured key also matches a pattern that declares the same key.
309
320
  if (pattern.publicKey && Object.values(trusted).includes(pattern.publicKey)) {
310
- return pattern.publicKey;
321
+ return { key: pattern.publicKey, pinned: true };
311
322
  }
312
323
  }
313
324
  if (pattern.publicKey && pattern.publicKey.startsWith('ed25519:')) {
314
- return pattern.publicKey;
325
+ return { key: pattern.publicKey, pinned: false };
315
326
  }
316
- return null;
327
+ return { key: null, pinned: false };
328
+ }
329
+ /**
330
+ * Thin wrapper kept for callers that only need a usable key.
331
+ */
332
+ resolveTrustedPublicKey(pattern) {
333
+ return this.resolveVerificationKey(pattern).key;
317
334
  }
318
335
  /**
319
336
  * Sanitize a pattern's name/version and assert the resulting path stays inside
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.75.2",
3
+ "version": "3.75.3",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -107,7 +107,7 @@
107
107
  "@claude-flow/neural": "3.0.3",
108
108
  "@claude-flow/plugin-agent-federation": "1.0.7",
109
109
  "@claude-flow/security": "3.0.7",
110
- "@claude-flow/shared": "3.0.7",
110
+ "@claude-flow/shared": "3.0.8",
111
111
  "@iarna/toml": "^2.2.5",
112
112
  "@metaharness/darwin": "~0.13.0",
113
113
  "@noble/ed25519": "2.3.0",
@@ -130,12 +130,12 @@
130
130
  "ws": "^8.21.0",
131
131
  "yaml": "^2.8.0",
132
132
  "zod": "^3.22.0",
133
- "@claude-flow/memory": "3.3.0"
133
+ "@claude-flow/memory": "3.3.1"
134
134
  },
135
135
  "optionalDependencies": {
136
136
  "@agntcy/slim-bindings": "2.1.1",
137
137
  "@claude-flow/aidefence": "3.2.1",
138
- "@claude-flow/memory": "3.3.0",
138
+ "@claude-flow/memory": "3.3.1",
139
139
  "@metaharness/flywheel": "~0.1.10",
140
140
  "@metaharness/radio": "~0.1.0",
141
141
  "@metaharness/turn-credit": "~0.1.0",
@@ -1,5 +1,38 @@
1
1
  # @claude-flow/shared
2
2
 
3
+ <!-- adr-356:quickstart:start -->
4
+ ![Animated diagram: raw config is validated by Zod schemas into typed config that flows through the EventBus to other packages](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/@claude-flow/shared/assets/shared-flow.svg)
5
+
6
+ **@claude-flow/shared** — Shared types, Zod config schemas and validators, the event bus and resilience helpers that the other `@claude-flow` packages build on.
7
+
8
+ **Supported environments:** Node.js 20+ · ESM · Linux, macOS, Windows (pure JavaScript)
9
+
10
+ ## Quickstart
11
+
12
+ ```bash
13
+ npm install @claude-flow/shared
14
+ ```
15
+
16
+ ```js
17
+ import { validateAgentConfig } from '@claude-flow/shared';
18
+
19
+ const ok = validateAgentConfig({ id: 'coder-1', name: 'Coder', type: 'coder' });
20
+ console.log(ok.success, ok.data.maxConcurrentTasks, ok.data.priority);
21
+
22
+ const bad = validateAgentConfig({ id: 'coder-1', name: 'Coder', type: 'coder', priority: 500 });
23
+ console.log(bad.success, bad.errors.map((e) => `${e.path}: ${e.code}`).join(', '));
24
+ ```
25
+
26
+ Expected output:
27
+
28
+ ```text
29
+ true 5 50
30
+ false priority: too_big
31
+ ```
32
+
33
+ Next: [`@claude-flow/hooks`](https://www.npmjs.com/package/@claude-flow/hooks) builds its lifecycle hooks on these types.
34
+ <!-- adr-356:quickstart:end -->
35
+
3
36
  [![npm version](https://img.shields.io/npm/v/@claude-flow/shared.svg)](https://www.npmjs.com/package/@claude-flow/shared)
4
37
  [![npm downloads](https://img.shields.io/npm/dm/@claude-flow/shared.svg)](https://www.npmjs.com/package/@claude-flow/shared)
5
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -321,3 +354,9 @@ This package is a dependency of all other @claude-flow modules:
321
354
  ## License
322
355
 
323
356
  MIT
357
+
358
+ <!-- adr-356:footer:start -->
359
+ ---
360
+
361
+ Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/shared)
362
+ <!-- adr-356:footer:end -->