From 4ad4eeaf7d7b9f5d92545472d48eed44be3fbe05 Mon Sep 17 00:00:00 2001 From: Timothy Jacobs Date: Sat, 26 Sep 2020 21:00:19 +0000 Subject: [PATCH] Add ircs and irc6 to the list of allowed protocols. This adds support for the secure and ipv6 variants of the already allowed irc protocol. Props arealnobrainer, markparnell, ctmartin. git-svn-id: https://develop.svn.wordpress.org/trunk@49055 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 7 ++++--- tests/phpunit/tests/customize/nav-menu-item-setting.php | 2 ++ tests/phpunit/tests/functions/allowedProtocols.php | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 8df5788119..68d865089f 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -6295,13 +6295,14 @@ function send_frame_options_header() { * @since 4.3.0 Added 'webcal' to the protocols array. * @since 4.7.0 Added 'urn' to the protocols array. * @since 5.3.0 Added 'sms' to the protocols array. + * @since 5.6.0 Added 'irc6' and 'ircs' to the protocols array. * * @see wp_kses() * @see esc_url() * * @return string[] Array of allowed protocols. Defaults to an array containing 'http', 'https', - * 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', - * 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'. + * 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', + * 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'. * This covers all common link protocols, except for 'javascript' which should not * be allowed for untrusted users. */ @@ -6309,7 +6310,7 @@ function wp_allowed_protocols() { static $protocols = array(); if ( empty( $protocols ) ) { - $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' ); + $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' ); } if ( ! did_action( 'wp_loaded' ) ) { diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php index e5c005a49e..ee552836a3 100644 --- a/tests/phpunit/tests/customize/nav-menu-item-setting.php +++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php @@ -516,6 +516,8 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase { 'ftps://example.com/', 'news://news.server.example/example.group.this', 'irc://irc.freenode.net/wordpress', + 'irc6://irc.freenode.net/wordpress', + 'ircs://irc.freenode.net/wordpress', 'gopher://example.com', 'nntp://news.server.example/example.group.this', 'feed://example.com/', diff --git a/tests/phpunit/tests/functions/allowedProtocols.php b/tests/phpunit/tests/functions/allowedProtocols.php index 8803bed8a2..4ec65afbe7 100644 --- a/tests/phpunit/tests/functions/allowedProtocols.php +++ b/tests/phpunit/tests/functions/allowedProtocols.php @@ -46,6 +46,8 @@ class Tests_Functions_AllowedProtocols extends WP_UnitTestCase { array( 'mailto', 'mailto://someone@example.com' ), // RFC6068 array( 'news', 'news://news.server.example/example.group.this' ), // RFC5538 array( 'irc', 'irc://example.com/wordpress' ), + array( 'irc6', 'irc6://example.com/wordpress' ), + array( 'ircs', 'ircs://example.com/wordpress' ), array( 'gopher', 'gopher://example.com/7a_gopher_selector%09foobar' ), // RFC4266 array( 'nntp', 'nntp://news.server.example/example.group.this' ), // RFC5538 array( 'feed', 'feed://example.com/rss.xml' ),