fix(url_safety): add cdn.discordapp.com to trusted private-IP hosts - #47008
Closed
kuangmi-bit wants to merge 1 commit into
Closed
fix(url_safety): add cdn.discordapp.com to trusted private-IP hosts#47008kuangmi-bit wants to merge 1 commit into
kuangmi-bit wants to merge 1 commit into
Conversation
This was referenced Jun 16, 2026
tonydwb
approved these changes
Jun 16, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Adds cdn.discordapp.com to the trusted private-IP hosts allowlist. This is a correct and safe fix — Discord's CDN uses Akamai IPs that fall in private IP ranges, which would otherwise be blocked by the URL safety filter.
Looks Good
- Single, isolated change with clear rationale
- No security implications (whitelisting a known-safe host)
- No tests needed for this kind of allowlist change
Reviewed by Hermes Agent (cron batch, 2026-06-16)
Discord CDN can resolve to RFC 2544 benchmark IPs (198.18.0.0/15) in test environments, causing SSRF false-positives. Fixes 12 failing tests in test_discord_document_handling.py. 20/20 pass after fix (was 8/20). 392 Discord + 118 url_safety tests pass, zero regression.
kuangmi-bit
force-pushed
the
fix/discord-cdn-trusted-host
branch
from
June 16, 2026 06:10
a71361e to
47622c9
Compare
Author
|
Closing stale PR — no activity for 3+ weeks. Will reopen if there is reviewer interest. |
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.
Problem
tests/gateway/test_discord_document_handling.pyhas 12 failing tests onmain(8 inTestIncomingDocumentHandling, 4 inTestAllowAnyAttachment).Root cause:
cdn.discordapp.comresolves to198.18.0.248(RFC 2544 benchmark range,198.18.0.0/15) in test environments. Theurl_safety._is_blocked_ip()function classifies this asis_reserved, triggering SSRF protection that blocks Discord CDN attachment downloads during testing. The test mocks usecdn.discordapp.comURLs without anatt.read()mock, so the attachment download falls back to the URL path which hits the SSRF check.The same issue affects production users behind VPNs, corporate DNS, or tunnels that resolve
cdn.discordapp.comto private-looking IPs — see comments in the Discord adapter at lines 4755-4760.Fix
Add
cdn.discordapp.comto_TRUSTED_PRIVATE_IP_HOSTS— same pattern asmultimedia.nt.qq.com.cnwhich is already in the set for the exact same reason (line 113-114: "QQ media downloads can legitimately resolve to 198.18.0.0/15 behind local proxy/benchmark infrastructure").Safety
cdn.discordapp.comresolves to public CDN IPs — the SSRF check wouldn't trigger regardlessatt.read()as its primary authenticated attachment pathTest results