MCP06
- Location
dist/.setup/runtime-api-Ci45IlXP.mjs:102- Finding
Untrusted discussion messages reach the main agent through tool results ## Remediation Suggestions 1. **Preserve an explicit trust boundary.** Return discussion messages using host-supported untrusted-content annotations or structured external-content blocks. Clearly separate message data from tool-owned instructions and metadata. 2. **Clarify the tool contract.** Update the tool description and result envelope to state that discussion messages are externally authored data and cannot authorize sensitive operations or override higher-priority instructions. 3. **Align history and ingress authorization.** Where `allowFrom` is intended to restrict who can influence the agent, apply equivalent sender-policy checks before including messages in history results. If broader history visibility is intentional, distinguish readable content from authorized requests. 4. **Require independent authorization for sensitive actions.** Discussion-derived requests involving credentials, private transcripts, file access, configuration changes, or external transmission should require authorization outside the discussion text. 5. **Add regression tests.** Verify that messages rejected by inbound sender policy cannot silently become authorized requests through history retrieval, and test instruction-bearing message bodies and thread replies.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/dist/.setup/runtime-api-Ci45IlXP.mjs:102–111, 144–148, 1023–1040
Vulnerability Type: Indirect prompt injection through external tool-result content
Risk Level: MediumComplete Relevant Code
Discussion history formatting:
js function formatDiscussionHistory(history) { const text = history.messages.map((message) => { const author = message.author?.display_name || message.author?.handle || message.author_id || "Unknown"; return `timestamp=${discussionRecordJson(message.created_at)} [Author ${discussionRecordJson(author)} id=${discussionRecordJson(message.author_id)}] text=${discussionRecordJson(message.body)}`; }).join("\n"); const truncationNote = history.truncated ? "\n[History scan reached its safety bound; older active threads may be omitted.]" : ""; return text ? `${text}${truncationNote}` : ""; }Retrieval and return of external history:
js const history = await client.latestChannelMessages(binding.channelId, limit); if (!canReadHistory()) return { text: "No discussion is bound to this session." }; return { binding, text: formatDiscussionHistory(history) || "The bound discussion has no messages yet." };Tool registration and model-visible result:
js api.registerTool(({ sessionKey }) => ({ name: "discussion", label: "Discussion", description: "Read the latest messages from the ClickClack discussion bound to this session.", parameters: DiscussionParameters, async execute(_toolCallId, input) { if (!sessionKey) return textResult("No discussion is bound to this session.", { bound: false }); const requested = typeof input === "object" && input !== null && "limit" in input ? Number(input.limit) : DEFAULT_MESSAGE_LIMIT; const limit = Number.isInteger(requested) ? Math.max(1, Math.min(MAX_MESSAGE_LIMIT, requested)) : DEFAULT_MESSAGE_LIMIT; const result = await service.readLatestMessages(sessionKey, limit); return textResult(result.text, { bound: Boolea ...[truncated 2803 chars]
