Skip to content

Restrict WP.com media request authentication to WP.com hosts - #25863

Open
crazytonyli wants to merge 3 commits into
trunkfrom
fix/media-token-allowlist
Open

Restrict WP.com media request authentication to WP.com hosts#25863
crazytonyli wants to merge 3 commits into
trunkfrom
fix/media-token-allowlist

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

Description

Fixes https://linear.app/a8c/issue/CMM-2195.

See the Linear issue for details.

A 2020 change accidentally disabled the host allowlist guard in
MediaRequestAuthenticator, so media requests for private WP.com sites
attached the account-wide OAuth Bearer token to any URL, including
attacker-controlled external hosts embedded in post content. Restore
the allowlist (wordpress.com and wp.com domains) and enforce it inside
tokenAuthenticatedWPComRequest so every request path is covered.
The AVURLAsset path in MediaRequestAuthenticator attached the WP.com
Bearer token to video and audio URLs without any host check. Apply the
same allowlist used for media requests, and enforce https like the
request paths already do.
@crazytonyli crazytonyli added this to the 27.2 milestone Aug 3, 2026
@crazytonyli
crazytonyli requested a review from jkmassel August 3, 2026 02:11
@wpmobilebot

wpmobilebot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number33580
VersionPR #25863
Bundle IDorg.wordpress.alpha
Commitf4c1e0e
Installation URL7hh6e0d9blu4o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number33580
VersionPR #25863
Bundle IDcom.jetpack.alpha
Commitf4c1e0e
Installation URL7avqjar2eo1ro
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

DNS hostnames are case-insensitive (RFC 4343) but URL.host preserves the
input casing, so a WP.com host with uppercase letters would fail the
allowlist and load private media unauthenticated. Lowercase the host
before matching.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants