Repository navigation
Conversation
The token bridge runs in the player's sandbox iframe, which lacks GutenbergKit's globals, so it fell back to a cookie-only fetch that the app can't authenticate. Use the same-origin parent's apiFetch instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndpoint The endpoint dropped media-video-jwt-bridge because it matches no allowed handle prefix. Without it, the player sandbox in GutenbergKit gets no token bridge, so private VideoPress videos never request a playback token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
|
Fixes CMM-2928
Proposed changes
Private VideoPress videos show "This video is private" in the mobile apps' editor (GutenbergKit), even for the site owner. Two things block the player's token request; both are needed.
media-video-jwt-bridgescript. Its handle matches no allowed prefix, so the endpoint removed it and the player sandbox got no token bridge. Adds an exact-matchALLOWED_PLUGIN_HANDLESlist.getMediaToken: when GutenbergKit is on the window or its same-origin parent, request the token through GutenbergKit's authenticatedwp.apiFetch. The bridge runs inside the player's sandbox, which has nowp.apiFetchof its own, so it fell back to a cookie-onlyfetchthe app can't authenticate. A cross-origin parent falls back tofetch.Related product discussion/links
@wordpress/api-fetchutility for GutenbergKit only #45254, which added theapiFetchpath for the current window.Does this pull request change what data or activity we track or use?
No.
Testing instructions
Needs a site with a private VideoPress video, and GutenbergKit's demo app (or the Jetpack/WordPress app) pointed at it.
Additional AI-generated details
Why the app needs the parent's
apiFetchbut WP Admin doesn't. In WP Admin the sandbox'sfetchcarries the login cookies. The app has no cookies; GutenbergKit authenticates with anAuthorizationheader that only itsapiFetchmiddleware adds. On Atomic and self-hosted sites,Jetpack_Application_Password_Extrasalready lets application passwords authenticatevideopress-*admin-ajax actions.Security.
window.parent.wponly works when the sandbox is same-origin with the editor, and same-origin frames already share full DOM access, so this grants no new capability.apiFetch, only for the site, its API root, or app-listed domains.videopressAjax.ajaxUrl, set server-side fromadmin_url().postMessage, after the bridge's existing origin check.Tests.
getMediaTokenusesapiFetchwhen GBKit is on the window or the parent, andfetchwhen GBKit is absent or the parent is cross-origin. Only the parent case fails on trunk.🤖 Generated with Claude Code