fix(adapters): guard attachment downloads across slack, discord, telegram, and whatsapp - #865
Open
bensabic wants to merge 2 commits into
Open
fix(adapters): guard attachment downloads across slack, discord, telegram, and whatsapp#865bensabic wants to merge 2 commits into
bensabic wants to merge 2 commits into
Conversation
…gram, and whatsapp - route Slack, Discord, and WhatsApp attachment downloads through the shared guarded downloader (SSRF blocklist, DNS pinning, redirect revalidation, 25 MB cap, 30 second timeout) - send the Slack bot token only on hops to trusted Slack origins and add a createFileTransport() override for proxies - keep the WhatsApp access token on Meta media hosts and the configured Graph origin; downloadMedia() accepts a custom transport - cap and time out Telegram file downloads with the Web Fetch API so runtimes like Cloudflare Workers keep working - resolve downloadAttachment headers per hop, forward them to custom transports, and add an onResponse hook - document inbound attachment policies for all four adapters
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
gr2m
reviewed
Aug 25, 2026
…token - check each redirect target against the exact-origin and Meta media host policy before attaching the authorization header - refuse off-policy hops such as subdomains of the Graph origin or the same host on another port - add regression tests for both cases
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.
Follows up on #850, #856, and #859 by adopting the shared guarded downloader (
downloadAttachmentin@chat-adapter/shared) in the remaining adapters that fetch attachment bytes from event-supplied URLs.createFileTransport()override routes downloads through a proxy.downloadMedia()accepts a custom transport.downloadAttachmentnow resolvesheadersper hop (function form decides what each redirect target receives), forwards the resolved headers to custom transports, and accepts anonResponsehook that can reject a final response before its body is read.