🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
test(federation): assert the stated acceptance bar for the three token classes
ruvd9934d55bfe5
diff --git a/plugins/ruflo-chatgpt-federation/README.md b/plugins/ruflo-chatgpt-federation/README.mdindex b15d7bfb4a..8aa428fb0b 100644--- a/plugins/ruflo-chatgpt-federation/README.md+++ b/plugins/ruflo-chatgpt-federation/README.md@@ -120,6 +120,17 @@ this design**.An unauthenticated or unverifiable request to `/mcp` gets `401` with`WWW-Authenticate: Bearer resource_metadata="…"`, which is what starts discovery.+### Client binding, not resource binding — stated plainly++This is **client-audience binding, not standards-style resource-audience binding**+(RFC 8707). It is a deliberate, documented deviation, accepted for this dedicated+integration because the connector is a single-tenant resource with its own OAuth+client. It is not a pattern to copy into a multi-resource service, and it stops being+safe the moment `federation:read`/`federation:publish` is granted to a second client.++If `auth.cognitum.one` later implements resource indicators (console ADR-038, open),+switch `CGF_OAUTH_CLIENT_ID` to the resource identifier and this paragraph goes away.+### Why the audience is a client id`auth.cognitum.one` binds `aud` to the **requesting OAuth client**diff --git a/plugins/ruflo-chatgpt-federation/test/oauth.test.mjs b/plugins/ruflo-chatgpt-federation/test/oauth.test.mjsindex 42668f26f1..b5dc196b26 100644--- a/plugins/ruflo-chatgpt-federation/test/oauth.test.mjs+++ b/plugins/ruflo-chatgpt-federation/test/oauth.test.mjs@@ -269,3 +269,37 @@ test('enforcing OAuth without an expected audience fails the deploy', async () =}}});++test('ACCEPTANCE: session and other-client tokens get 401; ours succeeds with exactly two scopes', async () => {+ // The stated bar. Three tokens, same issuer key, same signature validity —+ // separated only by what they are addressed to.+ const as = await fakeAuthServer();+ try {+ await withService(as, { required: true, publicUrl: 'https://cgf.example' }, async (port, svc) => {+ // 1. A browser-session-shaped token: auth_web.rs mints these through the+ // unbound path, so they carry neither iss nor aud.+ const session = await as.mintRaw({ scope: `${SCOPE_READ} ${SCOPE_PUBLISH}` });+ const r1 = await call(port, 'federation_identity', {}, { authorization: `Bearer ${session}` });+ assert.equal(r1.status, 401, 'a browser-session token must not authenticate here');+ assert.match(r1.wwwAuth || '', /carries no iss or aud claim/);++ // 2. A well-formed OAuth token for a DIFFERENT Cognitum client.+ const other = await as.mint({ scope: `${SCOPE_READ} ${SCOPE_PUBLISH}`, audience: 'music-cognitum-one' });+ const r2 = await call(port, 'channel_publish',+ { channel: 'pub:announce', msgType: 'Status', payload: {} }, { authorization: `Bearer ${other}` });+ assert.equal(r2.status, 401, 'another client\'s token must not act as the federation identity');++ // 3. Ours: correct issuer, addressed to our client_id, exactly the two scopes.+ const ours = await as.mint({ scope: `${SCOPE_READ} ${SCOPE_PUBLISH}`, audience: CLIENT_ID });+ const r3 = await call(port, 'federation_identity', {}, { authorization: `Bearer ${ours}` });+ assert.equal(r3.status, 200);+ assert.equal(JSON.parse(toolText(r3.body)).pubkey, svc.pubkey);++ // and it carries ONLY those two — a third scope must not ride along.+ const decoded = JSON.parse(Buffer.from(ours.split('.')[1], 'base64url').toString());+ assert.deepEqual(decoded.scope.split(' ').sort(), [SCOPE_PUBLISH, SCOPE_READ].sort());+ assert.equal(decoded.aud, CLIENT_ID);+ assert.equal(decoded.iss, as.issuer);+ });+ } finally { as.close(); }+});