From e89bd883d8854cd9e4b8e16d3c6733807df46d0a Mon Sep 17 00:00:00 2001 From: ToToKr Date: Tue, 31 Mar 2026 13:23:31 +0900 Subject: [PATCH] fix: allow Telegram RFC2544 media downloads (#57624) (thanks @MoerAI) * fix(telegram): allow RFC 2544 benchmark IPs in media download SSRF policy (#57452) Telegram CDN file servers may resolve to IPs in the RFC 2544 benchmark range (198.18.0.0/15). The SSRF policy blocked these downloads while Discord and Slack correctly allowed them. Set allowRfc2544BenchmarkRange to true to match other channel plugins. * fix: note Telegram media RFC2544 CDN downloads (#57624) (thanks @MoerAI) --------- Co-authored-by: Ayaan Zaidi --- CHANGELOG.md | 1 + .../telegram/src/bot/delivery.resolve-media-retry.test.ts | 4 ++-- extensions/telegram/src/bot/delivery.resolve-media.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb151b99135..f47b54a0df7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ Docs: https://docs.openclaw.ai - Agents/memory flush: keep daily memory flush files append-only during embedded attempts so compaction writes do not overwrite earlier notes. (#53725) Thanks @HPluseven. - Web UI/markdown: stop bare auto-links from swallowing adjacent CJK text while preserving valid mixed-script path and query characters in rendered links. (#48410) Thanks @jnuyao. - BlueBubbles/iMessage: coalesce URL-only inbound messages with their link-preview balloon again so sharing a bare link no longer drops the URL from agent context. Thanks @vincentkoc. +- Telegram/media: allow RFC 2544 benchmark-range Telegram CDN resolutions during media downloads, so voice messages, PDFs, and other attachments no longer fail with `Failed to download media`. (#57624) Thanks @MoerAI. - Sandbox/browser: install `fonts-noto-cjk` in the sandbox browser image so screenshots render Chinese, Japanese, and Korean text correctly instead of tofu boxes. Fixes #35597. Thanks @carrotRakko and @vincentkoc. - Memory/FTS: add configurable trigram tokenization plus short-CJK substring fallback so memory search can find Chinese, Japanese, and Korean text without breaking mixed long-and-short queries. Thanks @carrotRakko. - Hooks/config: accept runtime channel plugin ids in `hooks.mappings[].channel` (for example `feishu`) instead of rejecting non-core channels during config validation. (#56226) Thanks @AiKrai001. diff --git a/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts b/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts index c7de3067f97..52f0c4096d6 100644 --- a/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts +++ b/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts @@ -155,7 +155,7 @@ async function expectTransientGetFileRetrySuccess() { expect.objectContaining({ url: `https://api.telegram.org/file/bot${BOT_TOKEN}/voice/file_0.oga`, ssrfPolicy: { - allowRfc2544BenchmarkRange: false, + allowRfc2544BenchmarkRange: true, hostnameAllowlist: ["api.telegram.org"], }, }), @@ -533,7 +533,7 @@ describe("resolveMedia original filename preservation", () => { ssrfPolicy: { hostnameAllowlist: ["api.telegram.org", "192.168.1.50"], allowedHostnames: ["192.168.1.50"], - allowRfc2544BenchmarkRange: false, + allowRfc2544BenchmarkRange: true, }, }), ); diff --git a/extensions/telegram/src/bot/delivery.resolve-media.ts b/extensions/telegram/src/bot/delivery.resolve-media.ts index 50da268af1f..38e9e962090 100644 --- a/extensions/telegram/src/bot/delivery.resolve-media.ts +++ b/extensions/telegram/src/bot/delivery.resolve-media.ts @@ -41,7 +41,7 @@ function buildTelegramMediaSsrfPolicy(apiRoot?: string) { // enforcing SSRF checks on the resolved and redirected targets. hostnameAllowlist: hostnames, ...(allowedHostnames ? { allowedHostnames } : {}), - allowRfc2544BenchmarkRange: false, + allowRfc2544BenchmarkRange: true, }; }