Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#46025 closed defect (bug) (fixed)

_json_wp_die_handler doesn't handle JSONP request

Reported by: spacedmonkey's profile spacedmonkey Owned by: spacedmonkey's profile spacedmonkey
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.1
Component: Site Health Keywords: has-patch needs-testing servehappy
Focuses: multisite Cc:

Description

Originally raised in #45933 , but the new wp_die handler _json_wp_die_handler doesn't support JSONP requests and returns invalid response. The rest api support returning JSONP responses, this handler should too.

Attachments (4)

46025.diff (2.2 KB) - added by spacedmonkey 6 years ago.
46025.2.diff (3.2 KB) - added by spacedmonkey 6 years ago.
46025.3.diff (3.2 KB) - added by spacedmonkey 6 years ago.
46025.4.diff (3.3 KB) - added by spacedmonkey 6 years ago.

Download all attachments as: .zip

Change History (28)

@spacedmonkey
6 years ago

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

#3 @pento
6 years ago

  • Milestone changed from Awaiting Review to 5.1

Setting Milestone to 5.1 for review.

This ticket was mentioned in Slack in #core-php by flixos90. View the logs.


6 years ago

#5 @flixos90
6 years ago

  • Owner set to spacedmonkey
  • Status changed from new to assigned

@spacedmonkey
6 years ago

#6 @spacedmonkey
6 years ago

Added another handler for jsonp. Also add another function wp_is_jsonp_request.

Can you review please @flixos90

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

@spacedmonkey
6 years ago

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

#10 @TimothyBlynJacobs
6 years ago

The REST API also sends an X-Content-Type-Options: nosniff header which is accompanied by this doc:

/*
 * Mitigate possible JSONP Flash attacks.
 *
 * https://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/
 */

Seems this should also be sent in this handler.

@spacedmonkey
6 years ago

#11 @spacedmonkey
6 years ago

After feedback from @timothyblynjacobs I have added the following lines to add extra headers.

header( 'X-Content-Type-Options: nosniff' );
header( 'X-Robots-Tag: noindex' );

One fixes cors issue and one is SEO related.

#12 @flixos90
6 years ago

  • Milestone changed from 5.1 to 5.2

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

#14 @flixos90
6 years ago

  • Milestone changed from 5.2 to 5.3

#15 @flixos90
6 years ago

  • Milestone 5.3 deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

This ticket is based on the old fatal error recovery mode implementation and will be covered as part of #46130.

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

#17 @spacedmonkey
6 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Re-opened as still valid and should be another ticket an #46130.

#18 @SergeyBiryukov
6 years ago

  • Milestone set to 5.3

Restoring the milestone.

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


6 years ago

#21 @SergeyBiryukov
6 years ago

  • Milestone changed from 5.3 to 5.2

Moving to 5.2, per the latest #core-php chat.

#22 @SergeyBiryukov
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 45015:

Bootstrap/Load: Add support for JSONP requests to wp_die().

In addition to AJAX, XML-RPC, and JSON requests, wp_die() now handles JSONP requests correctly, returning information in the expected content type.

Props spacedmonkey, TimothyBlynJacobs.
Fixes #46025. See #44458.

#23 @SergeyBiryukov
6 years ago

In 45017:

Docs: Improve documentation for wp_die() handlers after [45015] and [45016].

See #46543, #46025, #46026.

#24 @spacedmonkey
5 years ago

  • Component changed from Bootstrap/Load to Site Health
Note: See TracTickets for help on using tickets.