fix(discord): add allowRfc2544BenchmarkRange to attachment and sticker downloads#26436
Open
cncoder wants to merge 2 commits intoopenclaw:mainfrom
Open
fix(discord): add allowRfc2544BenchmarkRange to attachment and sticker downloads#26436cncoder wants to merge 2 commits intoopenclaw:mainfrom
cncoder wants to merge 2 commits intoopenclaw:mainfrom
Conversation
…r downloads Discord attachment and sticker downloads fail when the host uses a local proxy with virtual-IP DNS mode (198.18.0.0/15, RFC 2544 benchmark range). The SSRF guard blocks these addresses by default. This follows the same pattern already applied in the Telegram module (src/telegram/bot/delivery.ts:43) by passing ssrfPolicy with allowRfc2544BenchmarkRange: true to fetchRemoteMedia calls. Only Discord-specific call sites are modified to keep the fix scoped: - appendResolvedMediaFromAttachments (voice messages, images, files) - appendResolvedMediaFromStickers Updated corresponding test assertions to expect the new ssrfPolicy parameter. Fixes openclaw#25215 Related: openclaw#25086, openclaw#24973, openclaw#24454
|
I don’t think we should add special definitions for every RFC address block. It would be better to simply allow users to define their own list of CIDR blocks to block. |
|
Additionally, other reasonable contexts (for example, accessing GitHub via web_fetch) should also be allowed. |
|
This pull request has been automatically marked as stale due to inactivity. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cdn.discordapp.comto the198.18.0.0/15range (RFC 2544 benchmark addresses), which the SSRF guard blocks since2026.2.22.ssrfPolicy: { allowRfc2544BenchmarkRange: true }to two Discord-specificfetchRemoteMediacall sites inmessage-utils.ts, plus updated test assertions.attachments.ts), no changes to SSRF guard logic itself, no new config options. Only the Discord channel module is touched, following the same pattern already in Telegram (delivery.ts:43).Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Discord attachments (voice messages, images, files, stickers) now download correctly when the host resolves CDN domains to RFC 2544 benchmark addresses (198.18.0.0/15), typically caused by local proxies with virtual-IP DNS mode.
Security Impact (required)
NoNoNo— samefetchRemoteMediacalls, just with relaxed SSRF policy for the RFC 2544 rangeNoNoallowRfc2544BenchmarkRangeis already used in the Telegram module (src/telegram/bot/delivery.ts:43). This PR extends the same policy to Discord. The RFC 2544 range (198.18.0.0/15) is not routable on the public internet — it only appears when a local proxy assigns virtual IPs from this range.Repro + Verification
Environment
198.18.0.0/15), OpenClaw2026.2.23Steps
198.18.0.0/15range)Expected
Attachment downloads successfully and is processed (e.g., voice → ASR transcription → reply).
Actual (before fix)
Evidence
[security] blocked URL fetch (url-fetch) target=https://cdn.discordapp.com/attachments/.../voice-message.ogg reason=Blocked: resolves to private/internal/special-use IP addressnpx vitest run src/discord/monitor/message-utils.test.ts— 15/15 passednpx tsc --noEmit— zero errorsHuman Verification (required)
media-understanding/attachments.tsreads local file after Discord downloads it (does not re-download), so does not need this fix.Compatibility / Migration
YesNoNoFailure Recovery (if this breaks)
ssrfPolicylines fromsrc/discord/monitor/message-utils.ts.src/discord/monitor/message-utils.ts,src/discord/monitor/message-utils.test.tsallowRfc2544BenchmarkRangeis relaxed; all other private/internal ranges remain blocked.Risks and Mitigations
Greptile Summary
Added
ssrfPolicy: { allowRfc2544BenchmarkRange: true }to Discord attachment and sticker downloads to fix failures when OpenClaw runs behind local proxies with virtual-IP DNS mode (resolvescdn.discordapp.comto RFC 2544 benchmark range198.18.0.0/15).src/telegram/bot/delivery.ts:43)appendResolvedMediaFromAttachmentsandappendResolvedMediaFromStickersinsrc/discord/monitor/message-utils.tsConfidence Score: 5/5
Last reviewed commit: 7148456
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!