PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.10
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.10
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
← All changes | includes/agents/abilities.php +17 -1 1.0.11.1.10 View file →
@@ -290,8 +290,17 @@
290 290
291 291 /**
292 292 * `desktop-mode/get-post` permission callback.
293 293 *
294 + * `read_post` decides visibility (published / private / draft) and
295 + * never the post password — WordPress splits the two deliberately, so
296 + * a plain `read_post` check would hand a Subscriber the raw body of a
297 + * password-protected post. Mirror Core: a sealed post stays sealed
298 + * unless the caller can edit it (the same escape hatch
299 + * `WP_REST_Posts_Controller::check_password_required()` grants), and
300 + * because this ability returns RAW `post_content` there is no empty
301 + * rendered field to fall back to — the only safe answer is to refuse.
302 + *
294 303 * @param array $args Input args.
295 304 * @return bool
296 305 */
297 306 function openstation_agents_ability_get_post_can( $args ) {
@@ -299,9 +308,16 @@
299 308 $post_id = isset( $args['post_id'] ) ? (int) $args['post_id'] : 0;
300 309 if ( $post_id <= 0 ) {
301 310 return false;
302 311 }
303 - return current_user_can( 'read_post', $post_id );
312 + if ( ! current_user_can( 'read_post', $post_id ) ) {
313 + return false;
314 + }
315 + $post = get_post( $post_id );
316 + if ( $post instanceof WP_Post && post_password_required( $post ) && ! current_user_can( 'edit_post', $post_id ) ) {
317 + return false;
318 + }
319 + return true;
304 320 }
305 321
306 322 /**
307 323 * `desktop-mode/get-media` execute callback.