VideoPress: improve escaping of block attributes rendered into inline styles - #50865
Closed
vianasw wants to merge 1 commit into
Closed
VideoPress: improve escaping of block attributes rendered into inline styles#50865vianasw wants to merge 1 commit into
vianasw wants to merge 1 commit into
Conversation
Contributor
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Contributor
|
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! |
Code Coverage SummaryCoverage changed in 1 file.
|
vianasw
force-pushed
the
fix/videopress-poster-css-escaping
branch
from
July 31, 2026 13:35
bb1f401 to
bccb5af
Compare
vianasw
force-pushed
the
fix/videopress-poster-css-escaping
branch
from
July 31, 2026 15:36
00657eb to
3b1aecb
Compare
… styles The video block renders the poster URL into a CSS url() and the maxWidth attribute into an inline style. Escape and validate both for their CSS context: emit the poster URL as a double-quoted CSS string, and accept only a plain CSS length or percentage for maxWidth (falling back to full width otherwise). Adds render regression tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ2nEAgqJJ5zmczuyFngF9
vianasw
force-pushed
the
fix/videopress-poster-css-escaping
branch
from
July 31, 2026 15:37
3b1aecb to
f6616ac
Compare
Contributor
Author
|
Closing this in favor of an internal change so it can be coordinated with related work — nothing further needed here. Thanks! |
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.
Proposed changes
The VideoPress video block renders two author-supplied block attributes into inline CSS, and neither was escaped ideally for its context:
background-image: url( … ).esc_url()does not escape every character that is significant inside a CSSurl(), so the value is now emitted as a double-quoted CSS string (url("…")) to keep it contained.maxWidth— rendered intomax-width: …. It now only accepts a plain CSS length or percentage; any other value is dropped and the block falls back to full width (as with the100%default). Notecalc()is also dropped, which the dimension control does not produce.Both are escaping/validation hardening for values that go into inline styles. Adds render regression tests.
Does this pull request change what data or activity we track or use?
No.
Testing instructions
url("…")and a non-length max-width is ignored rather than applied.jp test php packages/videopress— the new regression tests pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01NZ2nEAgqJJ5zmczuyFngF9