-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Cover: Ensure url
is not malformed due to sanitization through wp_kses
#47906
Cover: Ensure url
is not malformed due to sanitization through wp_kses
#47906
Conversation
…ation through `wp_kses`
Size Change: +35 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
@ntsekouras, does this only affect the Cover block or any media block that stores the URL in the attribute? If the latter, we should consider a more general solution to the problem. |
From what I could see it's only about the Cover block because other media blocks use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good "hotfix" if the issue only affects the Cover block. We can think of a more general solution when/if there are issues with other media blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the local fix while we get to the bottom of the interactions between KSES, the serialiser, etc. :)
…ation through `wp_kses` (#47906)
I just cherry-picked this PR to the wp/6.2 branch to get it included in the next release: 1af9f34 |
url
is not malformed due to sanitization through wp_kses
url
is not malformed due to sanitization through wp_kses
What?
Resolves: #47636
Why?
The issue here is a result of GB sanitizing the pattern content through
wp_kses_post
. The flow there is:wp_kses_normalize_entities
replaces&
to&
wp_pre_kses_block_attributes
replaces&
to\u0026
that results in\u0026amp;
in the final output.The above though is for security reasons and normally is not an issue for block attributes that are not URLs. In the
Cover
block case though it is a problem, as it results to a malformed URL. I'm not confident following a similar approach to PD to replace
\u0026amp;
to&
, but maybe ensuring that the url is not malformed insideCover
block might be enough and safe.Testing Instructions
&
), fetch the images properly. You can check theheaders
pattern category.