-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Media: Skip cross-origin isolation for third-party page builders #11170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f563a1
055c638
d8f3209
12e10a9
a65f438
1c74821
2f0421f
fb7caae
e7298c1
85d6e62
a1e630e
9ee5ac1
7af02dc
ec1490c
e26a9c3
afacb9e
77a504f
b122f7f
119efb6
97d4a76
1ed4cdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6411,14 +6411,18 @@ function wp_get_image_editor_output_format( $filename, $mime_type ) { | |||||||
| * @return bool Whether client-side media processing is enabled. | ||||||||
| */ | ||||||||
| function wp_is_client_side_media_processing_enabled(): bool { | ||||||||
| // This is due to SharedArrayBuffer requiring a secure context. | ||||||||
| $host = strtolower( (string) strtok( $_SERVER['HTTP_HOST'] ?? '', ':' ) ); | ||||||||
| $enabled = ( is_ssl() || 'localhost' === $host || str_ends_with( $host, '.localhost' ) ); | ||||||||
|
|
||||||||
| /** | ||||||||
| * Filters whether client-side media processing is enabled. | ||||||||
| * | ||||||||
| * @since 7.0.0 | ||||||||
| * | ||||||||
| * @param bool $enabled Whether client-side media processing is enabled. Default true. | ||||||||
| * @param bool $enabled Whether client-side media processing is enabled. Default true if the page is served in a secure context. | ||||||||
| */ | ||||||||
| return (bool) apply_filters( 'wp_client_side_media_processing_enabled', true ); | ||||||||
| return (bool) apply_filters( 'wp_client_side_media_processing_enabled', $enabled ); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
|
|
@@ -6431,7 +6435,7 @@ function wp_set_client_side_media_processing_flag(): void { | |||||||
| return; | ||||||||
| } | ||||||||
|
|
||||||||
| wp_add_inline_script( 'wp-block-editor', 'window.__clientSideMediaProcessing = true', 'before' ); | ||||||||
| wp_add_inline_script( 'wp-block-editor', 'window.__clientSideMediaProcessing = true;', 'before' ); | ||||||||
|
|
||||||||
| $chromium_version = wp_get_chromium_major_version(); | ||||||||
|
|
||||||||
|
|
@@ -6477,6 +6481,10 @@ function wp_get_chromium_major_version(): ?int { | |||||||
| * media processing in the editor. Uses Document-Isolation-Policy | ||||||||
| * on supported browsers (Chromium 137+). | ||||||||
| * | ||||||||
| * Skips setup when a third-party page builder overrides the block | ||||||||
| * editor via a custom `action` query parameter, as DIP would block | ||||||||
| * same-origin iframe access that these editors rely on. | ||||||||
| * | ||||||||
| * @since 7.0.0 | ||||||||
| */ | ||||||||
| function wp_set_up_cross_origin_isolation(): void { | ||||||||
|
|
@@ -6494,6 +6502,15 @@ function wp_set_up_cross_origin_isolation(): void { | |||||||
| return; | ||||||||
| } | ||||||||
|
|
||||||||
| /* | ||||||||
| * Skip when a third-party page builder overrides the block editor. | ||||||||
| * DIP isolates the document into its own agent cluster, | ||||||||
| * which blocks same-origin iframe access that these editors rely on. | ||||||||
| */ | ||||||||
| if ( isset( $_GET['action'] ) && 'edit' !== $_GET['action'] ) { | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While implementing
Also, do we have any research or data on how many plugins might be impacted by this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not an issue for Web Stories because it short-circuits here: wordpress-develop/src/wp-includes/media.php Lines 6453 to 6455 in 055c638
This is because it is filtering
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, it also short-circuits here with the Classic Editor plugin.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
the original pr included this fix, but it was removed because it was deemed unrelated (#11098 (comment)). Both changes came out of bugs reports after the release of beta 1 - https://core.trac.wordpress.org/ticket/64740 there is more discussion there about why the fix for Elementor was added |
||||||||
| return; | ||||||||
| } | ||||||||
|
|
||||||||
| // Cross-origin isolation is not needed if users can't upload files anyway. | ||||||||
| if ( ! current_user_can( 'upload_files' ) ) { | ||||||||
| return; | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.