Repository navigation
Open
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p3Nice-to-havestatus-readyGreenlit and ready for development (vetted; counterpart to status-incubating)theme-securityTheme: Securitytype-bugBug fix
Description
Problem
The MCP audit wrapper (src/mcp-server/src/audit.ts::withAudit) labels a tool call by throw / no-throw, plus an out-of-band outcome stamp. #4026 (PR #4246) added the non-denial stamp, audit.ts::toolFailed (kind failed). It moved apply_system and teardown_system onto it, and only those two.
Every other "never throws" tool still RETURNS its failures as {success: false, …} envelopes with no stamp. Each of those calls is audited success: true, so an operator reading mcp_operation rows cannot tell a refused or failed call from a successful one.
Evidence (dev @ aa12f15)
- At least 32 single-line
return JSON.stringify({ success: false, … })sites with no stamp, in 16 modules undersrc/mcp-server/src/tools/. The largest groups:events.ts(5),memory.ts(4),reminders.ts,loops.tsanddecisions.ts(3 each), andaauth.ts,a2a.tsandnotifications.ts(2 each). - Single sites:
a2a_call.ts:172,credential_vault.ts:185,agents.ts,metrics.ts,nevermined.ts,pipelines.ts,reports.ts,voip.ts. - Further unstamped envelopes are built across several lines, so the count above misses them. Examples are in
operator_queue.ts,channels.ts,messages.ts,metrics.tsandskill_sources.ts.
What must be true
- Every returned failure on the MCP tool surface is audited
success: false. - An authorization refusal carries
denied: true(access.ts::accessDenied). Any other failure carries nodeniedkey (toolFailed). - Deciding which branches are denials is per tool, and is the substance of this work. A 403 or a
not_permitted/not_authorized/human_onlyflag is a denial. A retryable outage, a validation error or an unavailable feature is not. Getting one wrong corrupts a security signal. - The caller-facing JSON of every tool is byte-identical. The stamp is out-of-band.
- A guard makes the next tool unable to forget.
audit-denial.test.tsalready fails a deny branch that bypassesaccessDenied; a returnedsuccess: falseenvelope that bypasses both helpers should fail the same way.
Context
- Patterns:
src/mcp-server/src/tools/systems.apply.test.tsreads each audit row through the registered tool, andaudit-denial.test.tsholds the helper's unit tests and the mechanism guard. - Splitting the work into one PR per module group is fine.
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p3Nice-to-havestatus-readyGreenlit and ready for development (vetted; counterpart to status-incubating)theme-securityTheme: Securitytype-bugBug fix
Activity