Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#46025 closed defect (bug) (fixed)

_json_wp_die_handler doesn't handle JSONP request

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

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 8 years ago.
46025.2.diff​ (3.2 KB ) - added by spacedmonkey 8 years ago.
46025.3.diff​ (3.2 KB ) - added by spacedmonkey 8 years ago.
46025.4.diff​ (3.3 KB ) - added by spacedmonkey 8 years ago.

Download all attachments as: .zip

Change History (28)

@spacedmonkey
8 years ago

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


8 years ago

#3 @pento
8 years ago

  • Milestone Awaiting Review → 5.1

Setting Milestone to 5.1 for review.

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


8 years ago

#5 @flixos90
8 years ago

  • Owner set to spacedmonkey
  • Status new → assigned

@spacedmonkey
8 years ago

#6 @spacedmonkey
8 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.


8 years ago

@spacedmonkey
8 years ago

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


8 years ago

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


8 years ago

#10 @TimothyBlynJacobs
8 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
8 years ago

#11 @spacedmonkey
8 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
8 years ago

  • Milestone 5.1 → 5.2

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


8 years ago

#14 @flixos90
8 years ago

  • Milestone 5.2 → 5.3

#15 @flixos90
8 years ago

  • Milestone 5.3
  • Resolution → invalid
  • Status assigned → 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.


8 years ago

#17 @spacedmonkey
8 years ago

  • Resolution invalid
  • Status closed → reopened

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

#18 @SergeyBiryukov
8 years ago

  • Milestone → 5.3

Restoring the milestone.

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


8 years ago

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


8 years ago

#21 @SergeyBiryukov
8 years ago

  • Milestone 5.3 → 5.2

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

#22 @SergeyBiryukov
8 years ago

  • Resolution → fixed
  • Status reopened → 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
8 years ago

In 45017:

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

See #46543, #46025, #46026.

#24 @spacedmonkey
7 years ago

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