Skip to content

Backport: Improve validation and permission checks for WP_HTTP_Polling_Sync_Server#76987

Merged
peterwilsoncc merged 2 commits intotrunkfrom
fix/backport-wp-develop-11296
Apr 2, 2026
Merged

Backport: Improve validation and permission checks for WP_HTTP_Polling_Sync_Server#76987
peterwilsoncc merged 2 commits intotrunkfrom
fix/backport-wp-develop-11296

Conversation

@chriszarate
Copy link
Copy Markdown
Contributor

What?

Hardens WP_HTTP_Polling_Sync_Server endpoints with additional validation and permission checks.

Why?

Backport of WordPress/wordpress-develop#11296

How?

  • Add MAX_BODY_SIZE, MAX_ROOMS_PER_REQUEST, MAX_UPDATE_DATA_SIZE constants
  • Add maxLength constraint for update data strings
  • Add maxItems constraint for rooms per request
  • Add route-level validate_callback for request body size
  • Improve can_user_sync_entity_type() to use ctype_digit() for object ID validation, verify post type matches, validate taxonomy terms exist in the correct taxonomy, and reject zero/negative object IDs
  • Add comprehensive test coverage for new validation and permission checks

…g_Sync_Server

Backport of WordPress/wordpress-develop#11296.

Hardens WP_HTTP_Polling_Sync_Server endpoints with additional validation
and permission checks:

- Add MAX_BODY_SIZE, MAX_ROOMS_PER_REQUEST, MAX_UPDATE_DATA_SIZE constants
- Add maxLength constraint for update data strings
- Add maxItems constraint for rooms per request
- Add route-level validate_callback for request body size
- Improve can_user_sync_entity_type() to use ctype_digit() for object ID
  validation, verify post type matches, validate taxonomy terms exist in
  the correct taxonomy, and reject zero/negative object IDs
- Add comprehensive test coverage for new validation and permission checks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chriszarate chriszarate added [Type] Task Issues or PRs that have been broken down into an individual action to take [Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Apr 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

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.

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: chriszarate <czarate@git.wordpress.org>
Co-authored-by: peterwilsoncc <peterwilsoncc@git.wordpress.org>

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Flaky tests detected in 521da9e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23879753130
📝 Reported issues:

Copy link
Copy Markdown
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Chris, this matches the changes in the WordPress-Develop repo.

@peterwilsoncc peterwilsoncc merged commit 1be2ef2 into trunk Apr 2, 2026
41 checks passed
@peterwilsoncc peterwilsoncc deleted the fix/backport-wp-develop-11296 branch April 2, 2026 03:00
@github-actions github-actions bot added this to the Gutenberg 23.0 milestone Apr 2, 2026
@github-actions github-actions bot removed the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Apr 2, 2026
gutenbergplugin pushed a commit that referenced this pull request Apr 2, 2026
…ng_Sync_Server` (#76987)

* Backport: Improve validation and permission checks for WP_HTTP_Polling_Sync_Server

Backport of WordPress/wordpress-develop#11296.

Hardens WP_HTTP_Polling_Sync_Server endpoints with additional validation
and permission checks:

- Add MAX_BODY_SIZE, MAX_ROOMS_PER_REQUEST, MAX_UPDATE_DATA_SIZE constants
- Add maxLength constraint for update data strings
- Add maxItems constraint for rooms per request
- Add route-level validate_callback for request body size
- Improve can_user_sync_entity_type() to use ctype_digit() for object ID
  validation, verify post type matches, validate taxonomy terms exist in
  the correct taxonomy, and reject zero/negative object IDs
- Add comprehensive test coverage for new validation and permission checks

* Add backport changelog

---------

Co-authored-by: chriszarate <czarate@git.wordpress.org>
Co-authored-by: peterwilsoncc <peterwilsoncc@git.wordpress.org>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Apr 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: cd91928

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants