🌊 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
feat(federation): log the auth mode per call, without token material
ruv25d4718004a3
diff --git a/plugins/ruflo-chatgpt-federation/src/server.mjs b/plugins/ruflo-chatgpt-federation/src/server.mjsindex 3ad16f5d70..3e4ae0f6cf 100644--- a/plugins/ruflo-chatgpt-federation/src/server.mjs+++ b/plugins/ruflo-chatgpt-federation/src/server.mjs@@ -21,7 +21,7 @@* output, a resource, or a log line.*/import { createServer } from 'node:http';-import { timingSafeEqual } from 'node:crypto';+import { timingSafeEqual, createHash } from 'node:crypto';import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';import { z } from 'zod';@@ -195,6 +195,15 @@ export function createPublisherService({ relay, keyPath, port } = {}) {if (rateLimited(req)) return res.writeHead(429, { 'content-type': 'application/json' }).end('{"error":"rate limited"}');let body; try { body = await readBody(req); } catch { return res.writeHead(413, { 'content-type': 'application/json' }).end('{"error":"payload too large"}'); }const auth = await authContext(req);+ // One line per call, so "is OAuth actually being used?" is answerable from+ // logs instead of inferred. Never the token: only the mode, the granted+ // scopes, and a truncated hash of the subject — enough to correlate calls+ // from one identity, not enough to identify or replay anyone.+ try {+ const sub = auth.subject ? createHash('sha256').update(auth.subject).digest('hex').slice(0, 12) : '-';+ console.log(`mcp auth=${auth.mode} scopes=${(auth.scopes || []).join('+') || '-'} sub=${sub}` ++ (auth.mode === 'denied' ? ` reason=${redact(auth.error)}` : ''));+ } catch { /* logging must never break a request */ }if (auth.mode === 'denied') {// 401 + WWW-Authenticate is what starts a client's OAuth discovery.res.writeHead(401, { 'content-type': 'application/json',diff --git a/plugins/ruflo-chatgpt-federation/test/oauth.test.mjs b/plugins/ruflo-chatgpt-federation/test/oauth.test.mjsindex c78b9bc412..a82c2d3f8d 100644--- a/plugins/ruflo-chatgpt-federation/test/oauth.test.mjs+++ b/plugins/ruflo-chatgpt-federation/test/oauth.test.mjs@@ -338,3 +338,22 @@ test('protected-resource metadata echoes the identifier the client asked about',});} finally { as.close(); }});++test('the auth-mode log line never contains token material', async () => {+ const as = await fakeAuthServer();+ const lines = [];+ const orig = console.log;+ console.log = (...a) => { lines.push(a.join(' ')); };+ try {+ await withService(as, { required: true, publicUrl: 'https://cgf.example' }, async (port) => {+ const tok = await as.mint({ scope: `${SCOPE_READ} ${SCOPE_PUBLISH}`, audience: CLIENT_ID });+ await call(port, 'federation_identity', {}, { authorization: `Bearer ${tok}` });+ const line = lines.find((l) => l.startsWith('mcp auth='));+ assert.ok(line, 'an auth line is emitted');+ assert.match(line, /auth=oauth/);+ assert.match(line, /scopes=federation:read\+federation:publish/);+ assert.ok(!line.includes(tok), 'the token must never appear in a log line');+ assert.ok(!/user-1/.test(line), 'the raw subject must not appear either');+ });+ } finally { console.log = orig; as.close(); }+});