Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Sharing: Prevent PHP fatals when passed malformed data.
7 changes: 7 additions & 0 deletions projects/packages/publicize/src/class-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ public function register_rest_routes() {
return is_array( $param );
},
'sanitize_callback' => function ( $param ) {
if ( ! is_array( $param ) ) {
return new WP_Error(
'rest_invalid_param',
esc_html__( 'The skipped_connections argument must be an array of connection IDs.', 'jetpack-publicize-pkg' ),
array( 'status' => 400 )
);
}
return array_map( 'absint', $param );
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public function register_routes() {
return is_array( $param );
},
'sanitize_callback' => function ( $param ) {
if ( ! is_array( $param ) ) {
return new WP_Error(
'rest_invalid_param',
esc_html__( 'The skipped_connections argument must be an array of connection IDs.', 'jetpack-publicize-pkg' ),
array( 'status' => 400 )
);
}
return array_map( 'absint', $param );
},
),
Expand Down
Loading