mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-21 16:41:56 +00:00
fix(telegram): allowlist api.telegram.org in media SSRF policy
This commit is contained in:
@@ -95,7 +95,10 @@ async function expectTransientGetFileRetrySuccess() {
|
||||
expect(fetchRemoteMedia).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
url: `https://api.telegram.org/file/bot${BOT_TOKEN}/voice/file_0.oga`,
|
||||
ssrfPolicy: { allowRfc2544BenchmarkRange: true },
|
||||
ssrfPolicy: {
|
||||
allowRfc2544BenchmarkRange: true,
|
||||
allowedHostnames: ["api.telegram.org"],
|
||||
},
|
||||
}),
|
||||
);
|
||||
return result;
|
||||
|
||||
@@ -36,6 +36,9 @@ const PARSE_ERR_RE = /can't parse entities|parse entities|find end of the entity
|
||||
const VOICE_FORBIDDEN_RE = /VOICE_MESSAGES_FORBIDDEN/;
|
||||
const FILE_TOO_BIG_RE = /file is too big/i;
|
||||
const TELEGRAM_MEDIA_SSRF_POLICY = {
|
||||
// Telegram file downloads should trust api.telegram.org even when DNS/proxy
|
||||
// resolution maps to private/internal ranges in restricted networks.
|
||||
allowedHostnames: ["api.telegram.org"],
|
||||
allowRfc2544BenchmarkRange: true,
|
||||
} as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user