Making WordPress.org

Opened 5 weeks ago

Closed 5 weeks ago

#8454 closed defect (bug) (fixed)

Rosetta: Fix permission handling, sanitize inputs, and improve list table accessibility

Reported by: timse201 Owned by: timse201
Priority: high Milestone:
Component: Translate Site & Plugins Keywords: has-patch
Cc:

Description

Several improvements and bug fixes are needed across Rosetta roles:

  1. Bug Fixes:
  • In edit-cross-locale-pte.php and edit-translation-editor.php, the hidden input for projects was missing an echo before esc_attr(), causing the value to be empty on form submission.
  • In Cross_Locale_PTE::gp_pre_can_user_approve_translation(), the permission cache key did not include the translation_set_id, which could lead to incorrect permission caching across different sets.
  • In views/cross-locale-pte.php, the capability check for adding a user used Rosetta_Roles::MANAGE_TRANSLATION_EDITORS_CAP instead of Cross_Locale_PTE::MANAGE_CROSS_LOCALE_PTES_CAP.
  • Avoid PHP undefined index notices in Rosetta_Roles::send_email_notification() by checking isset().
  1. Sanitization:
  • Sanitize and validate request variables (order, orderby, search query, role, user input, and project IDs) using sanitize_text_field(), sanitize_key(), absint(), and strict whitelists.
  • Ensure usernames in action links are properly escaped.
  1. Accessibility and UI:
  • Add hidden screen-reader text to list table row actions ("Edit", "Remove") with the corresponding username.
  • Fix mismatched <label> elements in forms.
  • Internationalize column headers and add empty table state messages.
  • Hide the bulk action selector and checkbox column if the current user cannot manage editors.
  1. Performance:
  • Cache parent project lookups in the list table ($parent_cache).
  • Consolidate script and style enqueuing to admin_enqueue_scripts.

Change History (2)

#2 @obenland
5 weeks ago

  • Resolution → fixed
  • Status assigned → closed

In 15340:

Rosetta Roles: Fix project access saving and CLPTE approval caching

The hidden projects field on the edit screens was missing an echo, and
the Cross-Locale PTE approval cache was keyed without the translation
set ID. Also validates list-table request arguments, escapes output,
and adds screen-reader text and i18n to the tables.

Props timse201.
Closes ​https://github.com/WordPress/wordpress.org/pull/1024.
Fixes #8454.

Note: See TracTickets for help on using tickets.