Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

fix(plugins): label the unverified demo-registry fallback honestly

martinvladb467dbcd82a6
diff --git a/v3/@claude-flow/cli/__tests__/plugins-demo-registry-honesty.test.ts b/v3/@claude-flow/cli/__tests__/plugins-demo-registry-honesty.test.ts
new file mode 100644
index 0000000000..db92a1c410
--- /dev/null
+++ b/v3/@claude-flow/cli/__tests__/plugins-demo-registry-honesty.test.ts
@@ -0,0 +1,38 @@
+/**
+ * When the signed plugin registry can't be verified (ruvnet/ruflo#3211), discovery falls back
+ * to the CLI's built-in list. The fallback must be labelled as such: flagged `demo`, no
+ * fabricated CID, and a cached fallback must stay labelled on the next call.
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+
+vi.mock('../src/transfer/ipfs/client.js', () => ({
+ resolveIPNS: vi.fn(async () => null),
+ // The pinned CID serves a registry with no registrySignature, as production does today.
+ fetchFromIPFS: vi.fn(async () => ({ version: '1.0.1', type: 'plugins', plugins: [], totalPlugins: 0 })),
+ verifyEd25519Signature: vi.fn(async () => false),
+}));
+
+import { PluginDiscoveryService } from '../src/plugins/store/discovery.js';
+
+describe('plugin discovery: unverified registry fallback is labelled honestly', () => {
+ beforeEach(() => {
+ // Keep the built-in list's npm-stats lookup offline.
+ vi.stubGlobal('fetch', vi.fn(async () => { throw new Error('offline'); }));
+ });
+
+ it('flags the fallback as demo, invents no CID, and keeps the label on a cache hit', async () => {
+ const svc = new PluginDiscoveryService({ requireVerification: true } as never);
+ const name = svc.listRegistries()[0].name;
+
+ const first = await svc.discoverRegistry(name);
+ expect(first.success).toBe(true);
+ expect(first.demo).toBe(true);
+ expect(first.cid).toBeUndefined();
+ expect(first.source).toMatch(/\(demo\)$/);
+
+ const second = await svc.discoverRegistry(name);
+ expect(second.fromCache).toBe(true);
+ expect(second.demo).toBe(true);
+ expect(second.source).toMatch(/\(demo\)$/);
+ });
+});
diff --git a/v3/@claude-flow/cli/src/commands/plugins.ts b/v3/@claude-flow/cli/src/commands/plugins.ts
index c2b017a6fa..4ed93078a3 100644
--- a/v3/@claude-flow/cli/src/commands/plugins.ts
+++ b/v3/@claude-flow/cli/src/commands/plugins.ts
@@ -108,7 +108,18 @@ const listCommand: Command = {
return { success: false, exitCode: 1 };
}
- spinner.succeed(`Registry discovered: ${result.registry.totalPlugins} plugins available`);
+ if (result.demo) {
+ // The signed registry was unavailable or failed verification (see ruvnet/ruflo#3211):
+ // say so instead of reporting a successful discovery over the built-in list.
+ spinner.stop(
+ output.warning(
+ `Signed plugin registry unavailable or unverified; showing the built-in list ` +
+ `(${result.registry.totalPlugins} plugins)`,
+ ),
+ );
+ } else {
+ spinner.succeed(`Registry discovered: ${result.registry.totalPlugins} plugins available`);
+ }
output.writeln();
@@ -193,6 +204,14 @@ const listCommand: Command = {
output.writeln(output.dim('(ratings: cached — cloud unavailable)'));
}
output.writeln(output.dim(`Source: ${result.source}${result.fromCache ? ' (cached)' : ''}`));
+ if (result.demo) {
+ output.writeln(
+ output.warning(
+ 'Not from the signed registry: download counts, ratings and trust labels are the ' +
+ "CLI's built-in defaults, not verified registry data.",
+ ),
+ );
+ }
if (result.cid) {
output.writeln(output.dim(`Registry CID: ${result.cid.slice(0, 30)}...`));
}
diff --git a/v3/@claude-flow/cli/src/plugins/store/discovery.ts b/v3/@claude-flow/cli/src/plugins/store/discovery.ts
index 9bfdba8926..2a3af4dfd5 100644
--- a/v3/@claude-flow/cli/src/plugins/store/discovery.ts
+++ b/v3/@claude-flow/cli/src/plugins/store/discovery.ts
@@ -112,6 +112,12 @@ export interface PluginDiscoveryResult {
source?: string;
fromCache?: boolean;
error?: string;
+ /**
+ * True when the signed registry could not be fetched or verified and the CLI fell back to
+ * its built-in plugin list. That list is safe to use (fixed, first-party npm names), but it
+ * is NOT the verified registry, and callers must say so rather than report a discovery.
+ */
+ demo?: boolean;
}
/**
@@ -119,7 +125,7 @@ export interface PluginDiscoveryResult {
*/
export class PluginDiscoveryService {
private config: PluginStoreConfig;
- private cache: Map<string, { registry: PluginRegistry; timestamp: number }> = new Map();
+ private cache: Map<string, { registry: PluginRegistry; timestamp: number; demo?: boolean }> = new Map();
constructor(config: Partial<PluginStoreConfig> = {}) {
this.config = { ...DEFAULT_PLUGIN_STORE_CONFIG, ...config };
@@ -149,7 +155,9 @@ export class PluginDiscoveryService {
success: true,
registry: cached.registry,
fromCache: true,
- source: registry.name,
+ // A cached fallback is still the fallback: never relabel it as the real registry.
+ source: cached.demo ? `${registry.name} (demo)` : registry.name,
+ ...(cached.demo ? { demo: true } : {}),
};
}
@@ -267,14 +275,17 @@ export class PluginDiscoveryService {
this.cache.set(registry.ipnsName, {
registry: demoRegistry,
timestamp: Date.now(),
+ demo: true,
});
return {
success: true,
registry: demoRegistry,
- cid: `bafybeiplugin${crypto.randomBytes(16).toString('hex')}`,
+ // No CID: the built-in list was not fetched from IPFS. (This used to be a random
+ // `bafybeiplugin…` string, printed as "Registry CID" as if it were a real address.)
source: `${registry.name} (demo)`,
fromCache: false,
+ demo: true,
};
}