openclaw - 💡(How to fix) Fix Feature Request: Untrusted content wrapping for inbound channel messages

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Inbound messages from channels (Slack, Telegram, etc.) arrive in the agent context without structural separation between message content and system instructions. While sender metadata is correctly marked as "untrusted metadata," the message body itself is presented as raw text that the model processes alongside system prompts.

Root Cause

Inbound messages from channels (Slack, Telegram, etc.) arrive in the agent context without structural separation between message content and system instructions. While sender metadata is correctly marked as "untrusted metadata," the message body itself is presented as raw text that the model processes alongside system prompts.

Code Example

<untrusted-channel-message source="slack" sender="U03LTC8LFD0" timestamp="2026-04-20T12:00:00Z">
[message content here]
</untrusted-channel-message>
RAW_BUFFERClick to expand / collapse

Summary

Inbound messages from channels (Slack, Telegram, etc.) arrive in the agent context without structural separation between message content and system instructions. While sender metadata is correctly marked as "untrusted metadata," the message body itself is presented as raw text that the model processes alongside system prompts.

Problem

An adversary with access to a Slack channel, email, or calendar invite can craft messages containing prompt injection payloads. These are presented to the agent without any structural defense. The risk is compounded when the Dreaming pipeline captures inbound messages into long-term memory — a poisoned message persists across sessions.

Proposed Solution

Wrap inbound message bodies in untrusted content tags (similar to how mcporter wraps SQL results in <untrusted-data-*> tags):

<untrusted-channel-message source="slack" sender="U03LTC8LFD0" timestamp="2026-04-20T12:00:00Z">
[message content here]
</untrusted-channel-message>

This creates structural separation that helps models distinguish between instructions and user-submitted content.

Additional Context

  • mcporter already implements this pattern successfully for SQL results
  • The memory pipeline (Dreaming) should carry source attribution through to consolidated memories
  • Actor-aware memory attribution would allow future retrieval to filter on provenance
  • Identified during an adversarial verification audit of a production OpenClaw deployment

Impact

Without this, the highest-risk attack path is: untrusted Slack message → captured as memory → injected in future session. The memory system has regex-based injection screening, but sophisticated obfuscation can bypass pattern matching. Structural wrapping provides defense-in-depth.

extent analysis

TL;DR

Wrap inbound message bodies from channels like Slack and Telegram in <untrusted-channel-message> tags to structurally separate message content from system instructions.

Guidance

  • Implement the proposed solution by wrapping inbound message bodies in <untrusted-channel-message> tags, including attributes for source, sender, and timestamp, to provide structural separation and help models distinguish between instructions and user-submitted content.
  • Ensure the Dreaming pipeline captures these wrapped messages and maintains source attribution through to consolidated memories, allowing for future retrieval to filter on provenance.
  • Consider implementing actor-aware memory attribution to further enhance the security of the memory system.
  • Verify the effectiveness of this solution by testing it against various prompt injection payloads and sophisticated obfuscation techniques.

Example

<untrusted-channel-message source="slack" sender="U03LTC8LFD0" timestamp="2026-04-20T12:00:00Z">
  This is a sample message from a Slack channel.
</untrusted-channel-message>

Notes

The provided solution builds upon the existing pattern used by mcporter for SQL results, which has been successfully implemented. However, the effectiveness of this solution in preventing all types of prompt injection attacks is not guaranteed and should be thoroughly tested.

Recommendation

Apply the proposed workaround by wrapping inbound message bodies in <untrusted-channel-message> tags, as it provides a defense-in-depth approach to mitigating the risk of prompt injection attacks.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature Request: Untrusted content wrapping for inbound channel messages