updated plugin Jetpack Protect version 2.0.0

This commit is contained in:
2024-02-08 12:31:43 +00:00
committed by Gitium
parent ce653dd56c
commit 8d5e7cc070
192 changed files with 5244 additions and 2003 deletions
wp-content/plugins/jetpack-protect
CHANGELOG.md
build
composer.jsonjetpack-protect.php
jetpack_vendor
automattic
jetpack-a8c-mc-stats
jetpack-admin-ui
jetpack-assets
jetpack-backup-helper-script-manager
jetpack-config
jetpack-connection
jetpack-constants
jetpack-device-detection
jetpack-identity-crisis
jetpack-ip
jetpack-jitm
jetpack-licensing
jetpack-logo
jetpack-my-jetpack
jetpack-partner
jetpack-password-checker
jetpack-plugins-installer
jetpack-redirect
jetpack-roles
jetpack-status
jetpack-sync
jetpack-transport-helper
jetpack-waf
i18n-map.php
readme.txt
src
vendor

@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.1] - 2023-11-21
### Changed
- Added a note of non-usage of PHP8+ functions yet. [#34137]
## [2.0.0] - 2023-11-20
### Changed
- Updated required PHP version to >= 7.0. [#34192]
## [1.5.1] - 2023-11-14
## [1.5.0] - 2023-11-13
### Added
- Added 'cookieinformationscanner' and 'facebookexternalhit' to the bot user agent list. [#34026]
## [1.4.27] - 2023-08-23
### Changed
- Updated package dependencies. [#32605]
@ -163,6 +177,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Moving jetpack_is_mobile into a package
[2.0.1]: https://github.com/Automattic/jetpack-device-detection/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/Automattic/jetpack-device-detection/compare/v1.5.1...v2.0.0
[1.5.1]: https://github.com/Automattic/jetpack-device-detection/compare/v1.5.0...v1.5.1
[1.5.0]: https://github.com/Automattic/jetpack-device-detection/compare/v1.4.27...v1.5.0
[1.4.27]: https://github.com/Automattic/jetpack-device-detection/compare/v1.4.26...v1.4.27
[1.4.26]: https://github.com/Automattic/jetpack-device-detection/compare/v1.4.25...v1.4.26
[1.4.25]: https://github.com/Automattic/jetpack-device-detection/compare/v1.4.24...v1.4.25

@ -4,11 +4,20 @@ Full details of the Automattic Security Policy can be found on [automattic.com](
## Supported Versions
Generally, only the latest version of Jetpack has continued support. If a critical vulnerability is found in the current version of Jetpack, we may opt to backport any patches to previous versions.
Generally, only the latest version of Jetpack and its associated plugins have continued support. If a critical vulnerability is found in the current version of a plugin, we may opt to backport any patches to previous versions.
## Reporting a Vulnerability
[Jetpack](https://jetpack.com/) is an open-source plugin for WordPress. Our HackerOne program covers the plugin software, as well as a variety of related projects and infrastructure.
Our HackerOne program covers the below plugin software, as well as a variety of related projects and infrastructure:
* [Jetpack](https://jetpack.com/)
* Jetpack Backup
* Jetpack Boost
* Jetpack CRM
* Jetpack Protect
* Jetpack Search
* Jetpack Social
* Jetpack VideoPress
**For responsible disclosure of security issues and to be eligible for our bug bounty program, please submit your report via the [HackerOne](https://hackerone.com/automattic) portal.**

@ -3,10 +3,12 @@
"description": "A way to detect device types based on User-Agent header.",
"type": "jetpack-library",
"license": "GPL-2.0-or-later",
"require": {},
"require": {
"php": ">=7.0"
},
"require-dev": {
"yoast/phpunit-polyfills": "1.1.0",
"automattic/jetpack-changelogger": "^3.3.8"
"automattic/jetpack-changelogger": "^4.0.2"
},
"suggest": {
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
@ -33,7 +35,7 @@
"link-template": "https://github.com/Automattic/jetpack-device-detection/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "1.4.x-dev"
"dev-trunk": "2.0.x-dev"
}
}
}

@ -17,6 +17,9 @@ use function Automattic\Jetpack\Device_Detection\wp_unslash;
* Class Device_Detection
*
* Determine if the current User Agent matches the passed $kind.
*
* Note: str_contains() and other PHP8+ functions that have a polyfill in core are not used here,
* as wp-includes/compat.php may not be loaded yet.
*/
class Device_Detection {

@ -17,6 +17,9 @@ require_once __DIR__ . '/functions.php';
/**
* A class providing device properties detection.
*
* Note: str_contains() and other PHP8+ functions that have a polyfill in core are not used here,
* as wp-includes/compat.php may not be loaded yet.
*/
class User_Agent_Info {
@ -147,63 +150,63 @@ class User_Agent_Info {
* @return string The matched User Agent name, false otherwise.
*/
public function get_mobile_user_agent_name() {
if ( $this->is_chrome_for_iOS() ) { // Keep this check before the safari rule.
if ( static::is_chrome_for_iOS() ) { // Keep this check before the safari rule.
return 'chrome-for-ios';
} elseif ( $this->is_iphone_or_ipod( 'iphone-safari' ) ) {
} elseif ( static::is_iphone_or_ipod( 'iphone-safari' ) ) {
return 'iphone';
} elseif ( $this->is_ipad( 'ipad-safari' ) ) {
} elseif ( static::is_ipad( 'ipad-safari' ) ) {
return 'ipad';
} elseif ( $this->is_android_tablet() ) { // Keep this check before the android rule.
} elseif ( static::is_android_tablet() ) { // Keep this check before the android rule.
return 'android_tablet';
} elseif ( $this->is_android() ) {
} elseif ( static::is_android() ) {
return 'android';
} elseif ( $this->is_blackberry_10() ) {
} elseif ( static::is_blackberry_10() ) {
return 'blackberry_10';
} elseif ( $this->is_blackbeberry() ) {
} elseif ( static::is_blackbeberry() ) {
return 'blackberry';
} elseif ( $this->is_WindowsPhone7() ) {
} elseif ( static::is_WindowsPhone7() ) {
return 'win7';
} elseif ( $this->is_windows_phone_8() ) {
} elseif ( static::is_windows_phone_8() ) {
return 'winphone8';
} elseif ( $this->is_opera_mini() ) {
} elseif ( static::is_opera_mini() ) {
return 'opera-mini';
} elseif ( $this->is_opera_mini_dumb() ) {
} elseif ( static::is_opera_mini_dumb() ) {
return 'opera-mini-dumb';
} elseif ( $this->is_opera_mobile() ) {
} elseif ( static::is_opera_mobile() ) {
return 'opera-mobi';
} elseif ( $this->is_blackberry_tablet() ) {
} elseif ( static::is_blackberry_tablet() ) {
return 'blackberry_tablet';
} elseif ( $this->is_kindle_fire() ) {
} elseif ( static::is_kindle_fire() ) {
return 'kindle-fire';
} elseif ( $this->is_PalmWebOS() ) {
} elseif ( static::is_PalmWebOS() ) {
return 'webos';
} elseif ( $this->is_S60_OSSBrowser() ) {
} elseif ( static::is_S60_OSSBrowser() ) {
return 'series60';
} elseif ( $this->is_firefox_os() ) {
} elseif ( static::is_firefox_os() ) {
return 'firefoxOS';
} elseif ( $this->is_firefox_mobile() ) {
} elseif ( static::is_firefox_mobile() ) {
return 'firefox_mobile';
} elseif ( $this->is_MaemoTablet() ) {
} elseif ( static::is_MaemoTablet() ) {
return 'maemo';
} elseif ( $this->is_MeeGo() ) {
} elseif ( static::is_MeeGo() ) {
return 'meego';
} elseif ( $this->is_TouchPad() ) {
} elseif ( static::is_TouchPad() ) {
return 'hp_tablet';
} elseif ( $this->is_facebook_for_iphone() ) {
} elseif ( static::is_facebook_for_iphone() ) {
return 'facebook-for-iphone';
} elseif ( $this->is_facebook_for_ipad() ) {
} elseif ( static::is_facebook_for_ipad() ) {
return 'facebook-for-ipad';
} elseif ( $this->is_twitter_for_iphone() ) {
} elseif ( static::is_twitter_for_iphone() ) {
return 'twitter-for-iphone';
} elseif ( $this->is_twitter_for_ipad() ) {
} elseif ( static::is_twitter_for_ipad() ) {
return 'twitter-for-ipad';
} elseif ( $this->is_wordpress_for_ios() ) {
} elseif ( static::is_wordpress_for_ios() ) {
return 'ios-app';
} elseif ( $this->is_iphone_or_ipod( 'iphone-not-safari' ) ) {
} elseif ( static::is_iphone_or_ipod( 'iphone-not-safari' ) ) {
return 'iphone-unknown';
} elseif ( $this->is_ipad( 'ipad-not-safari' ) ) {
} elseif ( static::is_ipad( 'ipad-not-safari' ) ) {
return 'ipad-unknown';
} elseif ( $this->is_Nintendo_3DS() ) {
} elseif ( static::is_Nintendo_3DS() ) {
return 'nintendo-3ds';
} else {
$agent = $this->useragent;
@ -245,26 +248,26 @@ class User_Agent_Info {
} elseif ( strpos( $this->useragent, 'iphone' ) !== false ) {
$this->platform = self::PLATFORM_IPHONE;
} elseif ( strpos( $this->useragent, 'android' ) !== false ) {
if ( $this->is_android_tablet() ) {
if ( static::is_android_tablet() ) {
$this->platform = self::PLATFORM_ANDROID_TABLET;
} else {
$this->platform = self::PLATFORM_ANDROID;
}
} elseif ( $this->is_kindle_fire() ) {
} elseif ( static::is_kindle_fire() ) {
$this->platform = self::PLATFORM_ANDROID_TABLET;
} elseif ( $this->is_blackberry_10() ) {
} elseif ( static::is_blackberry_10() ) {
$this->platform = self::PLATFORM_BLACKBERRY_10;
} elseif ( strpos( $this->useragent, 'blackberry' ) !== false ) {
$this->platform = self::PLATFORM_BLACKBERRY;
} elseif ( $this->is_blackberry_tablet() ) {
} elseif ( static::is_blackberry_tablet() ) {
$this->platform = self::PLATFORM_BLACKBERRY;
} elseif ( $this->is_symbian_platform() ) {
} elseif ( static::is_symbian_platform() ) {
$this->platform = self::PLATFORM_SYMBIAN;
} elseif ( $this->is_symbian_s40_platform() ) {
} elseif ( static::is_symbian_s40_platform() ) {
$this->platform = self::PLATFORM_SYMBIAN_S40;
} elseif ( $this->is_J2ME_platform() ) {
} elseif ( static::is_J2ME_platform() ) {
$this->platform = self::PLATFORM_J2ME_MIDP;
} elseif ( $this->is_firefox_os() ) {
} elseif ( static::is_firefox_os() ) {
$this->platform = self::PLATFORM_FIREFOX_OS;
} else {
$this->platform = false;
@ -286,77 +289,77 @@ class User_Agent_Info {
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_android() ) {
} elseif ( static::is_android() ) {
$this->matched_agent = 'android';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_windows_phone_8() ) {
} elseif ( static::is_windows_phone_8() ) {
$this->matched_agent = 'winphone8';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_WindowsPhone7() ) {
} elseif ( static::is_WindowsPhone7() ) {
$this->matched_agent = 'win7';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_blackberry_10() ) {
} elseif ( static::is_blackberry_10() ) {
$this->matched_agent = 'blackberry-10';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_blackbeberry() && 'blackberry-webkit' === $this->detect_blackberry_browser_version() ) {
} elseif ( static::is_blackbeberry() && 'blackberry-webkit' === static::detect_blackberry_browser_version() ) {
$this->matched_agent = 'blackberry-webkit';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_blackberry_tablet() ) {
} elseif ( static::is_blackberry_tablet() ) {
$this->matched_agent = 'blackberry_tablet';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_PalmWebOS() ) {
} elseif ( static::is_PalmWebOS() ) {
$this->matched_agent = 'webos';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_TouchPad() ) {
} elseif ( static::is_TouchPad() ) {
$this->matched_agent = 'hp_tablet';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_firefox_os() ) {
} elseif ( static::is_firefox_os() ) {
$this->matched_agent = 'firefoxOS';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_firefox_mobile() ) {
} elseif ( static::is_firefox_mobile() ) {
$this->matched_agent = 'fennec';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_opera_mobile() ) {
} elseif ( static::is_opera_mobile() ) {
$this->matched_agent = 'opera-mobi';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_MaemoTablet() ) {
} elseif ( static::is_MaemoTablet() ) {
$this->matched_agent = 'maemo';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_MeeGo() ) {
} elseif ( static::is_MeeGo() ) {
$this->matched_agent = 'meego';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_kindle_touch() ) {
} elseif ( static::is_kindle_touch() ) {
$this->matched_agent = 'kindle-touch';
$this->isTierIphone = true;
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
} elseif ( $this->is_Nintendo_3DS() ) {
} elseif ( static::is_Nintendo_3DS() ) {
$this->matched_agent = 'nintendo-3ds';
$this->isTierIphone = true;
$this->isTierRichCss = false;
@ -381,18 +384,18 @@ class User_Agent_Info {
}
// The following devices are explicitly ok.
if ( $this->is_S60_OSSBrowser() ) {
if ( static::is_S60_OSSBrowser() ) {
$this->matched_agent = 'series60';
$this->isTierIphone = false;
$this->isTierRichCss = true;
$this->isTierGenericMobile = false;
} elseif ( $this->is_opera_mini() ) {
} elseif ( static::is_opera_mini() ) {
$this->matched_agent = 'opera-mini';
$this->isTierIphone = false;
$this->isTierRichCss = true;
$this->isTierGenericMobile = false;
} elseif ( $this->is_blackbeberry() ) {
$detectedDevice = $this->detect_blackberry_browser_version();
} elseif ( static::is_blackbeberry() ) {
$detectedDevice = static::detect_blackberry_browser_version();
if (
'blackberry-5' === $detectedDevice
|| 'blackberry-4.7' === $detectedDevice
@ -1559,6 +1562,8 @@ class User_Agent_Info {
'domaintunocrawler',
'grapeshotcrawler',
'cloudflare-alwaysonline',
'cookieinformationscanner', // p1699315886066389-slack-C0438NHCLSY
'facebookexternalhit', // https://www.facebook.com/externalhit_uatext.php
);
foreach ( $bot_agents as $bot_agent ) {