fix(mattermost): properly resolve ambiguous target IDs and enable image recognition [AI-assisted]#22594
fix(mattermost): properly resolve ambiguous target IDs and enable image recognition [AI-assisted]#22594webclerk wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Add ssrfPolicy configuration to allow fetching media files from the Mattermost server hostname, enabling proper image recognition. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hey @webclerk, thanks for working on this! A few observations from our work on #19957 (interactive buttons + directory adapter) which touches the same
|
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
|
This pull request has been automatically marked as stale due to inactivity. |
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
Allow fetching attachments from the Mattermost server host, which may be localhost or a private IP. Without this, SSRF guards block inbound media downloads silently. Credit: @webclerk (openclaw#22594) for identifying this gap.
|
Closing this out in favor of #29925. The SSRF/media-fetch part is already in |
Summary
This PR contains two fixes for the Mattermost integration:
Properly resolve ambiguous target IDs via graceful fallback - Fixes an issue where 26-character user IDs without a prefix were incorrectly assumed to be channel IDs, leading to 403 Forbidden errors.
Enable image recognition with SSRF policy - Adds SSRF policy configuration to allow fetching media files from the Mattermost server hostname, enabling proper image recognition.
Changes
Target ID Resolution
normalizeMattermostMessagingTargetto return unprefixed IDs as-is instead of auto-addingchannel:prefixkind: "unknown"target type to represent ambiguous IDsparseMattermostTargetto classify unprefixed IDs as "unknown" instead of "channel"resolveTargetChannelIdto probe channel existence before falling back to user ID resolutionImage Recognition Support
ssrfPolicyparameter with allowed hostname when fetching media filesTesting
AI-Assisted Note
What & Why
Target ID Resolution
The Mattermost plugin was incorrectly treating all 26-character unprefixed IDs as channel IDs. This caused 403 errors when users tried to interact with direct message channels using user IDs. The fix implements a graceful fallback pattern that probes the ID type and falls back appropriately.
Image Recognition Support
The Mattermost monitor was unable to fetch images due to missing SSRF policy. This fix adds the required
ssrfPolicyconfiguration to allow downloading media files from the configured Mattermost server hostname, which is essential for image recognition features.Both fixes work together to provide a complete and robust Mattermost integration experience.