Skip to content

Commit 121caea

Browse files
committed
Harden pattern for room name.
1 parent 25649e1 commit 121caea

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/wp-includes/collaboration/class-wp-http-polling-collaboration-server.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@ public function register_routes(): void {
159159
'room' => array(
160160
'required' => true,
161161
'type' => 'string',
162-
'pattern' => '^[^/]+/[^/:]+(?::\\S+)?$',
162+
/*
163+
* Room names follow the pattern EntityKind/EntityName:ObjectID, where:
164+
* - EntityKind is a broad category of the entity, e.g. 'postType'.
165+
* - EntityName is the specific entity, e.g. 'post', 'page'.
166+
* - ObjectID is an optional identifier for single entities, e.g. a specific post ID. It must be a positive integer.
167+
*/
168+
'pattern' => '^[^/]+/[^/:]+(?::[1-9][0-9]*)?$',
163169
'maxLength' => 191, // Matches $max_index_length in wp-admin/includes/schema.php.
164170
),
165171
'updates' => array(

0 commit comments

Comments
 (0)