Title: [271176] trunk/Websites/webkit.org
Revision
271176
Author
[email protected]
Date
2021-01-05 14:40:20 -0800 (Tue, 05 Jan 2021)

Log Message

Disable public APIs on webkit.org blog
https://bugs.webkit.org/show_bug.cgi?id=220028

Reviewed by Timothy Hatcher.

* wp-content/plugins/disable-public-apis.php: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Websites/webkit.org/ChangeLog (271175 => 271176)


--- trunk/Websites/webkit.org/ChangeLog	2021-01-05 22:37:34 UTC (rev 271175)
+++ trunk/Websites/webkit.org/ChangeLog	2021-01-05 22:40:20 UTC (rev 271176)
@@ -1,5 +1,14 @@
 2021-01-05  Jon Davis  <[email protected]>
 
+        Disable public APIs on webkit.org blog
+        https://bugs.webkit.org/show_bug.cgi?id=220028
+
+        Reviewed by Timothy Hatcher.
+
+        * wp-content/plugins/disable-public-apis.php: Added.
+
+2021-01-05  Jon Davis  <[email protected]>
+
         Enforce strong password changes on webkit.org blog
         https://bugs.webkit.org/show_bug.cgi?id=220027
 

Added: trunk/Websites/webkit.org/wp-content/plugins/disable-public-apis.php (0 => 271176)


--- trunk/Websites/webkit.org/wp-content/plugins/disable-public-apis.php	                        (rev 0)
+++ trunk/Websites/webkit.org/wp-content/plugins/disable-public-apis.php	2021-01-05 22:40:20 UTC (rev 271176)
@@ -0,0 +1,24 @@
+<?php
+/*
+Plugin Name: Disable Public APIs
+Description: Disable all public APIs
+Version:     1.0
+Author:      Jonathan Davis
+Author URI:  http://webkit.org
+*/
+
+// Disable XML-RPC
+add_filter('xmlrpc_enabled', '__return_false', 100);
+
+// Disable REST API links in wp_head
+remove_action('wp_head', 'rest_output_link_wp_head', 10);
+remove_action('xmlrpc_rsd_apis', 'rest_output_rsd');
+
+// Disable REST API Link HTTP header
+remove_action('template_redirect', 'rest_output_link_header', 100);
+
+add_filter('rest_authentication_errors', function ($access) {
+    if (is_user_logged_in())
+        return $access;
+    return new WP_Error('rest_login_required', __('Access denied.'), array('status' => rest_authorization_required_code()));
+});
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to