Files
ruflo/v3/@claude-flow/plugin-agent-federation
edf7ddb3fe fix(security): transport and WebSocket limits (#4752) (#4962)
* fix(security): enforce transport and WebSocket limits (#4752)

- x-gateway ws-proxy: release a connection slot once per connection;
  close/error on both sockets decremented `active` up to four times,
  which defeated the 500-connection cap.
- mcp http transport: /ws now has maxPayload (maxMessageSize, default
  10 MiB) and checks the bearer token in verifyClient, before the
  upgrade, using the same Authorization header as the HTTP routes
  (no ?token=). Unset token entries are skipped instead of throwing.
- mcp http transport: cap legacy SSE streams on GET /mcp
  (maxSseClients, default 100); extra streams get 503 + Retry-After.
- agent-federation fallback WebSocket listener: maxPayload (default
  4 MiB, configurable) instead of the ws 100 MiB default.
- agentbbs sync: redirect "error", reject an oversized Content-Length
  up front, and stream the body with a running byte cap instead of
  buffering it whole.

Each limit has a test.

* fix(mcp): keep ?token= on /ws, checked before the upgrade (#4752)

Browsers cannot set Authorization on a WebSocket, so dropping ?token=
would cut browser clients off /ws and make the HTTP transport behave
differently from the standalone WebSocket transport. verifyClient now
takes the token from the Authorization header or, failing that, from
?token=, still before the upgrade and still failing closed on an empty
token list. ADR-479 describes the new check.

Also:
- maxMessageSize and maxSseClients fall back to their defaults unless
  they are positive numbers.
- shared/src/mcp/transport/http.ts: /ws gets maxPayload (maxMessageSize,
  default 10 MiB) instead of the ws 100 MiB default.

* chore(ruflo-x-gateway): bump to 0.10.5 for the ws-proxy slot fix

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(leaves): shared 3.0.9 for the /ws payload cap (#4752)

The /ws maxPayload change in shared/src/mcp/transport/http.ts only reaches
users through a standalone shared publish. shared 3.0.9 is published; the CLI
and root manifests pin it and both lockfiles follow.

Co-Authored-By: RuFlo <ruv@ruv.net>

* test(ci): list the x-gateway ws-proxy node:test file with its siblings

Root vitest cannot run plugins/ruflo-x-gateway node:test files (they run via
the plugin's npm test), so each one is listed in ci-test-baseline.txt. The new
ws-proxy test was missing, which failed the ratchet with 'No test suite found'.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Rutvij97 <218486544+Rutvij97@users.noreply.github.com>
Co-authored-by: rUv <ruv@ruv.net>
Co-authored-by: r <r@x>
2026-11-17 23:15:27 -05:00
..

@claude-flow/plugin-agent-federation

npm version npm downloads License: MIT

Cross-installation agent federation with zero-trust security, PII-gated data flow, and compliance-grade audit trails.

Install + run

npx -y -p @claude-flow/plugin-agent-federation@latest ruflo-federation --help

Subcommands

Command Description
ruflo-federation init Initialize federation on this node (generates keypair)
ruflo-federation join <peer-url> Join a federation by connecting to a peer
ruflo-federation leave Leave the current federation
ruflo-federation peers List known peers and their trust levels
ruflo-federation peers add <node-id> Add a peer to the federation
ruflo-federation peers remove <node-id> Remove a peer
ruflo-federation status Show federation health, sessions, trust levels
ruflo-federation audit Query compliance-grade audit logs
ruflo-federation trust Manage trust scores and tiers
ruflo-federation config Show/update federation config

Configuration via .env

FEDERATION_NODE_NAME=my-node           # default: hostname
FEDERATION_BIND_HOST=127.0.0.1         # default: 127.0.0.1 (0.0.0.0 accepts other hosts)
FEDERATION_BIND_PORT=8443              # default: 8443
FEDERATION_TRUST_LEVEL=untrusted       # default: untrusted

Tests

Handshake signatures cover ruflo:federation:handshake:v1: followed by the nonce, not the peer-supplied nonce alone. Signing adapters must sign the supplied bytes unchanged. Both peers must use this context; raw-nonce handshake responses from older peers are rejected, so upgrade federation peers together. This prevents a handshake response from also verifying as a signature over bare envelope bytes.

JCS-signed inbound envelopes must target this node, agree with their signed ID/type/source/session metadata, and be no older than five minutes or more than 30 seconds in the future. A replay guard is shared by the plugin's inbound callbacks. It retains IDs until the signed timestamp expires, with limits of 1,024 IDs per peer, 256 peers, 8,192 IDs total and 256 characters per ID. Capacity exhaustion rejects new messages instead of evicting live replay history.

Replay history is in memory for one plugin lifecycle; restarting the plugin clears it. To close the restart window, a JCS envelope whose signed timestamp is earlier than the guard's creation (plugin initialize) is rejected with MESSAGE_PREDATES_REPLAY_HISTORY, so an envelope captured before a restart cannot be replayed into the new lifecycle. Peers whose clocks run behind this node may see fresh messages rejected for up to that skew immediately after a restart. This is not durable or cross-replica deduplication. The existing legacy-v1 heartbeat/status compatibility path cannot authenticate nested envelope fields and does not acquire JCS replay guarantees. Signature and policy checks still run before a JCS message can reserve an ID or reach the event bus.

325 unit tests covering audit, routing, discovery, plugin lifecycle.

npm test

License

MIT — Claude Flow Team.