Directory

Update kses allowed attributes 2022 by kkmuffme · Pull Request #2654 · WordPress/wordpress-develop · GitHub
Skip to content
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

Update kses allowed attributes 2022 #2654

Closed

Conversation

kkmuffme
Copy link

Trac ticket: https://core.trac.wordpress.org/ticket/55605

Additionally:

  • update global HTML tag attributes to match attributes in 2022 (e.g. SEO,... with itemprop,...)
  • sort modified tag attributes alphabetically (no removals)
  • add all attributes for tag
  • allow picture + source tag to allow loading webp,... with fallback
  • allow select + option tags for dropdowns
  • allow meta and link tag for improved SEO and performance
  • allow autocomplete attribute for form

Attributes are mostly based on https://developer.mozilla.org/en-US/docs/Web/HTML/Element with some containing browser specifics which were introduced in the last years.

The tags were chosen based on a WP installation that contains the most popular WP + WooCommerce plugins, as well as features introduced by browsers (e.g. picture tag)

* sort modified tag attributes alphabetically (no removals)
* add all attributes for <img> tag
* allow picture + source tag to allow loading webp,... with fallback
* allow select + option tags for dropdowns
* allow meta and link tag for improved SEO and performance
* allow autocomplete attribute for form

Attributes are mostly based on https://developer.mozilla.org/en-US/docs/Web/HTML/Element with some containing browser specifics which were introduced in the last years.

The tags were chosen based on a WP installation that contains the most popular WP + WooCommerce plugins, as well as features introduced by browsers (e.g. picture tag)
@swissspidy
Copy link
Member

I think the changes here are too broad.

https://core.trac.wordpress.org/ticket/55605 is just about the selected attribute, so the PR should be covering that.

There was https://core.trac.wordpress.org/ticket/53098 for adding basically all HTML tags, like this PR seems to be doing to an extent. There is also a comment there explaining why the list is currently as it is. The intention behind the KSES allowlist is not to 1:1 match all the existing HTML tags there are. It only contains the ones that provide value and address a specific need.

Also, many of these attributes need specific sanitization as well. That's why there is a separate ticket for picture and srcset: https://core.trac.wordpress.org/ticket/29807
So that should be handled as part of that ticket.


Aside: There are some merge conflicts

Copy link

github-actions bot commented Feb 7, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core SVN

Core Committers: Use this line as a base for the props when committing in SVN:

Props kkmuffme, swissspidy.

GitHub Merge commits

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: kkmuffme <kkmuffme@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@swissspidy
Copy link
Member

After re-reading the ticket, I decided to close the ticket as wontfix because select and option aren't in the allowlist to begin with, so there's no point in adding <option selected> support.

@kkmuffme kkmuffme closed this Mar 30, 2024
@kkmuffme kkmuffme deleted the update-kses-allowed-attributes-2022 branch March 30, 2024 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants