Conversation
…hing Previously, if base_homeserver_url was left unset, the content scanner would resolve each media's origin homeserver via .well-known discovery (or a direct https://<server_name> guess) and forward the requester's Authorization header there. Since server_name comes from the untrusted mxc:// URI, this could send access tokens to a homeserver the operator never intended to trust. base_homeserver_url is now mandatory: every media fetch (authenticated and legacy) goes through that single, admin-configured homeserver only, which is expected to proxy/fetch remote media on the scanner's behalf. The now-unreachable well-known discovery and direct-fetch fallback code has been removed.
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.
Summary
download.base_homeserver_urlis now a required configuration value (thedownloadsection itself is now required too).v1and legacyv3endpoints) now go exclusively through the configuredbase_homeserver_url. The.well-knowndiscovery fallback and the directhttps://<server_name>fallback have been removed, along with the now-dead_discover_via_well_knownmethod andWellKnownDiscoveryError.base_homeserver_urlwas unset, the scanner resolved each media's origin homeserver from the (attacker-influenced)server_namein themxc://URI via.well-knowndiscovery, or guessedhttps://<server_name>directly, and forwarded the client'sAuthorizationheader there. This could leak access tokens to a homeserver the operator never intended to trust. Media fetches now always go to the single, admin-configured, trusted homeserver, which is expected to proxy/fetch remote media on the scanner's behalf (as homeserver implementations like Synapse already do for both the legacy and authenticated media download endpoints).config.sample.yamlandREADME.mdmigration notes to reflect the new requirement.Test plan
python -m unittest discover testspasses (57 tests)ruff checkcleanmypyshows no new errors (vs. main)base_homeserver_url