Skip to content

fix(channels): block private targets on inbound media downloads - #3322

Open
SashaMIT wants to merge 1 commit into
sipeed:mainfrom
SashaMIT:fix/channel-download-block-private-targets
Open

fix(channels): block private targets on inbound media downloads#3322
SashaMIT wants to merge 1 commit into
sipeed:mainfrom
SashaMIT:fix/channel-download-block-private-targets

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown

Summary

utils.DownloadFile already supports SSRF hardening via BlockPrivateTargets (safe dial + redirect re-check). OneBot used it; QQ / Telegram / Discord / LINE / Slack inbound attachment downloads did not, so a crafted media URL could still reach loopback, link-local, or RFC1918 (including cloud metadata) through redirects.

This PR enables BlockPrivateTargets: true on those channel download paths (parity with OneBot).

Test plan

  • go test ./pkg/utils/ -count=1 (existing TestDownloadFile_BlockPrivateTargetsBlocksRedirectToLoopback)
  • CI green

Tip: 49183d7

Made with Cursor

OneBot already set BlockPrivateTargets on DownloadFile. QQ, Telegram,
Discord, LINE, and Slack still used the default (unguarded) client, so a
crafted attachment URL could reach loopback, link-local, or RFC1918
(including cloud metadata) via redirect. Enable the existing safe client
on those inbound download paths.

Signed-off-by: Sasha Mitchell <sash@ela.city>
@CLAassistant

CLAassistant commented Aug 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants