Shield Security for WordPress - Version 15.0.12

Version Description

Download this release

Release Info

Developer paultgoodchild
Plugin Icon 128x128 Shield Security for WordPress
Version 15.0.12
Comparing to
See all releases

Code changes from version 15.0.9 to 15.0.12

cl.json CHANGED
@@ -217,6 +217,24 @@
217
  "type": "improved"
218
  }
219
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  }
221
  ]
222
  },
217
  "type": "improved"
218
  }
219
  ]
220
+ },
221
+ {
222
+ "version": "12",
223
+ "released_at": 1652602100,
224
+ "items": [
225
+ {
226
+ "title": "Make automatic Visitor IP Source detection quieter and run more often.",
227
+ "type": "improve"
228
+ },
229
+ {
230
+ "title": "Prevent error that occurs when rendering the Firewall Block page in some cases.",
231
+ "type": "fixed"
232
+ },
233
+ {
234
+ "title": "Prevent error that can occur when assessing whether plugin version is very old.",
235
+ "type": "fixed"
236
+ }
237
+ ]
238
  }
239
  ]
240
  },
icwp-wpsf.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://shsec.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
- * Version: 15.0.9
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages
9
  * Author: Shield Security
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://shsec.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
+ * Version: 15.0.12
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages
9
  * Author: Shield Security
plugin-spec.php CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "properties": {
3
- "version": "15.0.9",
4
- "release_timestamp": 1652433200,
5
- "build": "202205.1301",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
@@ -56,7 +56,8 @@
56
  "global-plugin"
57
  ],
58
  "js": [
59
- "global-plugin"
 
60
  ]
61
  },
62
  "plugin_admin": {
@@ -78,7 +79,6 @@
78
  "shield/traffic",
79
  "shield/audit_trail",
80
  "shield/scanners",
81
- "shield/ip_detect",
82
  "tp/circular-progress"
83
  ]
84
  },
@@ -200,7 +200,7 @@
200
  "wp-jquery"
201
  ]
202
  },
203
- "tp/circular-progress": {
204
  "url": "https://cdn.jsdelivr.net/gh/tomik23/circular-progress-bar@1.1.9/dist/circularProgressBar.min.js",
205
  "deps": [
206
  ]
@@ -320,6 +320,7 @@
320
  },
321
  "shield/ip_detect": {
322
  "deps": [
 
323
  "wp-jquery"
324
  ]
325
  },
1
  {
2
  "properties": {
3
+ "version": "15.0.12",
4
+ "release_timestamp": 1652602100,
5
+ "build": "202205.1503",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
56
  "global-plugin"
57
  ],
58
  "js": [
59
+ "global-plugin",
60
+ "shield/ip_detect"
61
  ]
62
  },
63
  "plugin_admin": {
79
  "shield/traffic",
80
  "shield/audit_trail",
81
  "shield/scanners",
 
82
  "tp/circular-progress"
83
  ]
84
  },
200
  "wp-jquery"
201
  ]
202
  },
203
+ "tp/circular-progress": {
204
  "url": "https://cdn.jsdelivr.net/gh/tomik23/circular-progress-bar@1.1.9/dist/circularProgressBar.min.js",
205
  "deps": [
206
  ]
320
  },
321
  "shield/ip_detect": {
322
  "deps": [
323
+ "global-plugin",
324
  "wp-jquery"
325
  ]
326
  },
plugin.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "properties": {
3
- "version": "15.0.9",
4
- "release_timestamp": 1652433200,
5
- "build": "202205.1301",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
@@ -56,7 +56,8 @@
56
  "global-plugin"
57
  ],
58
  "js": [
59
- "global-plugin"
 
60
  ]
61
  },
62
  "plugin_admin": {
@@ -78,7 +79,6 @@
78
  "shield/traffic",
79
  "shield/audit_trail",
80
  "shield/scanners",
81
- "shield/ip_detect",
82
  "tp/circular-progress"
83
  ]
84
  },
@@ -200,7 +200,7 @@
200
  "wp-jquery"
201
  ]
202
  },
203
- "tp/circular-progress": {
204
  "url": "https://cdn.jsdelivr.net/gh/tomik23/circular-progress-bar@1.1.9/dist/circularProgressBar.min.js",
205
  "deps": [
206
  ]
@@ -320,6 +320,7 @@
320
  },
321
  "shield/ip_detect": {
322
  "deps": [
 
323
  "wp-jquery"
324
  ]
325
  },
1
  {
2
  "properties": {
3
+ "version": "15.0.12",
4
+ "release_timestamp": 1652602100,
5
+ "build": "202205.1503",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
56
  "global-plugin"
57
  ],
58
  "js": [
59
+ "global-plugin",
60
+ "shield/ip_detect"
61
  ]
62
  },
63
  "plugin_admin": {
79
  "shield/traffic",
80
  "shield/audit_trail",
81
  "shield/scanners",
 
82
  "tp/circular-progress"
83
  ]
84
  },
200
  "wp-jquery"
201
  ]
202
  },
203
+ "tp/circular-progress": {
204
  "url": "https://cdn.jsdelivr.net/gh/tomik23/circular-progress-bar@1.1.9/dist/circularProgressBar.min.js",
205
  "deps": [
206
  ]
320
  },
321
  "shield/ip_detect": {
322
  "deps": [
323
+ "global-plugin",
324
  "wp-jquery"
325
  ]
326
  },
readme.txt CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.7
8
  Requires PHP: 7.0
9
  Recommended PHP: 7.4
10
  Tested up to: 6.0
11
- Stable tag: 15.0.9
12
 
13
  Bad Bots Are Your #1 Security Risk. Malware is a symptom of poor security, not its cause. Discover the advantage of powerful security over marketing.
14
 
8
  Requires PHP: 7.0
9
  Recommended PHP: 7.4
10
  Tested up to: 6.0
11
+ Stable tag: 15.0.12
12
 
13
  Bad Bots Are Your #1 Security Risk. Malware is a symptom of poor security, not its cause. Discover the advantage of powerful security over marketing.
14
 
resources/js/global-plugin.js CHANGED
@@ -307,7 +307,9 @@ var iCWP_WPSF_BodyOverlay = new function () {
307
  jQuery( document ).ready( function () {
308
  iCWP_WPSF_BodyOverlay.initialise();
309
 
310
- if ( typeof icwp_wpsf_vars_globalplugin.vars.dashboard_widget !== 'undefined' ) {
311
- Shield_WP_Dashboard_Widget.initialise( icwp_wpsf_vars_globalplugin.vars.dashboard_widget );
 
 
312
  }
313
  } );
307
  jQuery( document ).ready( function () {
308
  iCWP_WPSF_BodyOverlay.initialise();
309
 
310
+ if ( typeof icwp_wpsf_vars_globalplugin !== 'undefined' ) {
311
+ if ( typeof icwp_wpsf_vars_globalplugin.vars.dashboard_widget !== 'undefined' ) {
312
+ Shield_WP_Dashboard_Widget.initialise( icwp_wpsf_vars_globalplugin.vars.dashboard_widget );
313
+ }
314
  }
315
  } );
resources/js/shield/ip_detect.js CHANGED
@@ -1,4 +1,4 @@
1
- if ( typeof icwp_wpsf_vars_ipdetect !== 'undefined' ) {
2
  jQuery( document ).ready( function () {
3
  jQuery.getJSON( icwp_wpsf_vars_ipdetect.url, function ( response ) {
4
  if ( typeof response !== 'undefined' && typeof response[ 'ip' ] !== 'undefined' ) {
@@ -12,10 +12,10 @@ if ( typeof icwp_wpsf_vars_ipdetect !== 'undefined' ) {
12
  success: function ( raw ) {
13
  let response = iCWP_WPSF_ParseAjaxResponse.parseIt( raw );
14
  if ( response.success ) {
15
- alert(
16
  icwp_wpsf_vars_ipdetect.strings.source_found
17
- + "\n" + icwp_wpsf_vars_ipdetect.strings.ip_source + ': ' + response.data.ip_source
18
- + "\n" + icwp_wpsf_vars_ipdetect.strings.reloading + '...'
19
  );
20
  }
21
  }
1
+ if ( typeof icwp_wpsf_vars_ipdetect !== typeof undefined ) {
2
  jQuery( document ).ready( function () {
3
  jQuery.getJSON( icwp_wpsf_vars_ipdetect.url, function ( response ) {
4
  if ( typeof response !== 'undefined' && typeof response[ 'ip' ] !== 'undefined' ) {
12
  success: function ( raw ) {
13
  let response = iCWP_WPSF_ParseAjaxResponse.parseIt( raw );
14
  if ( response.success ) {
15
+ console.log(
16
  icwp_wpsf_vars_ipdetect.strings.source_found
17
+ + ' ' + icwp_wpsf_vars_ipdetect.strings.ip_source
18
+ + ': ' + response.data.ip_source
19
  );
20
  }
21
  }
src/lib/src/Blocks/RenderBlockPages/RenderBlockFirewall.php CHANGED
@@ -42,7 +42,8 @@ class RenderBlockFirewall extends BaseBlockPage {
42
  return array_merge(
43
  [
44
  __( 'Remaining Offenses Allowed', 'wp-simple-firewall' ) => $remainingOffenses,
45
- __( 'Firewall Rule Category', 'wp-simple-firewall' ) => $str->getFirewallCategoryName( $aux[ 'match_category' ] ),
 
46
  __( 'Request Parameter', 'wp-simple-firewall' ) => $aux[ 'match_request_param' ],
47
  __( 'Request Parameter Value', 'wp-simple-firewall' ) => $aux[ 'match_request_value' ],
48
  __( 'Firewall Pattern', 'wp-simple-firewall' ) => $aux[ 'match_pattern' ],
42
  return array_merge(
43
  [
44
  __( 'Remaining Offenses Allowed', 'wp-simple-firewall' ) => $remainingOffenses,
45
+ __( 'Firewall Rule Category', 'wp-simple-firewall' ) =>
46
+ $str->getFirewallCategoryName( (string)$aux[ 'match_category' ] ?? '' ),
47
  __( 'Request Parameter', 'wp-simple-firewall' ) => $aux[ 'match_request_param' ],
48
  __( 'Request Parameter Value', 'wp-simple-firewall' ) => $aux[ 'match_request_value' ],
49
  __( 'Firewall Pattern', 'wp-simple-firewall' ) => $aux[ 'match_pattern' ],
src/lib/src/Controller/Assets/Enqueue.php CHANGED
@@ -230,7 +230,13 @@ class Enqueue {
230
 
231
  private function getAdminAssetsToEnq() {
232
  $con = $this->getCon();
233
- return $con->cfg->includes[ $con->getIsPage_PluginAdmin() ? 'plugin_admin' : 'admin' ];
 
 
 
 
 
 
234
  }
235
 
236
  private function getFrontendAssetsToEnq() :array {
230
 
231
  private function getAdminAssetsToEnq() {
232
  $con = $this->getCon();
233
+ $admin = $con->cfg->includes[ 'admin' ];
234
+ if ( $con->getIsPage_PluginAdmin() ) {
235
+ $plugin = $con->cfg->includes[ 'plugin_admin' ];
236
+ $admin[ 'css' ] = array_unique( array_merge( $admin[ 'css' ], $plugin[ 'css' ] ) );
237
+ $admin[ 'js' ] = array_unique( array_merge( $admin[ 'js' ], $plugin[ 'js' ] ) );
238
+ }
239
+ return $admin;
240
  }
241
 
242
  private function getFrontendAssetsToEnq() :array {
src/lib/src/Modules/Firewall/Strings.php CHANGED
@@ -56,7 +56,7 @@ class Strings extends Base\Strings {
56
  return [
57
  'title' => $title,
58
  'title_short' => $titleShort,
59
- 'summary' => ( isset( $summary ) && is_array( $summary ) ) ? $summary : [],
60
  ];
61
  }
62
 
@@ -211,7 +211,7 @@ class Strings extends Base\Strings {
211
  'leading_schema' => __( 'Leading Schema', 'wp-simple-firewall' ),
212
  'php_code' => __( 'PHP Code', 'wp-simple-firewall' ),
213
  'exe_file_uploads' => __( 'EXE File Uploads', 'wp-simple-firewall' ),
214
- ][ $category ] ?? 'Unknown';
215
  }
216
 
217
  /**
@@ -232,7 +232,7 @@ class Strings extends Base\Strings {
232
  'blockparam_sql_queries' => [
233
  sprintf( __( 'Firewall Trigger: %s.', 'wp-simple-firewall' ), __( 'SQL Queries', 'wp-simple-firewall' ) )
234
  ],
235
- 'blockparam_leading_schema' => [
236
  sprintf( __( 'Firewall Trigger: %s.', 'wp-simple-firewall' ), __( 'Leading Schema', 'wp-simple-firewall' ) )
237
  ],
238
  'blockparam_aggressive' => [
56
  return [
57
  'title' => $title,
58
  'title_short' => $titleShort,
59
+ 'summary' => $summary,
60
  ];
61
  }
62
 
211
  'leading_schema' => __( 'Leading Schema', 'wp-simple-firewall' ),
212
  'php_code' => __( 'PHP Code', 'wp-simple-firewall' ),
213
  'exe_file_uploads' => __( 'EXE File Uploads', 'wp-simple-firewall' ),
214
+ ][ $category ] ?? 'Unspecified';
215
  }
216
 
217
  /**
232
  'blockparam_sql_queries' => [
233
  sprintf( __( 'Firewall Trigger: %s.', 'wp-simple-firewall' ), __( 'SQL Queries', 'wp-simple-firewall' ) )
234
  ],
235
+ 'blockparam_leading_schema' => [
236
  sprintf( __( 'Firewall Trigger: %s.', 'wp-simple-firewall' ), __( 'Leading Schema', 'wp-simple-firewall' ) )
237
  ],
238
  'blockparam_aggressive' => [
src/lib/src/Modules/Plugin/AdminNotices.php CHANGED
@@ -333,10 +333,18 @@ class AdminNotices extends Shield\Modules\Base\AdminNotices {
333
  $versions = ( new Shield\Utilities\Github\ListTags() )->run( 'FernleafSystems/Shield-Security-for-WordPress' );
334
  Transient::Set( $con->prefix( 'releases' ), $versions, WEEK_IN_SECONDS );
335
  }
336
- array_splice( $versions, array_search( $con->getVersion(), $versions ) );
337
- $needed = count( array_unique( array_map( function ( $version ) {
338
- return substr( $version, 0, strrpos( $version, '.' ) );
339
- }, $versions ) ) ) > 2;
 
 
 
 
 
 
 
 
340
  }
341
  return $needed;
342
  }
333
  $versions = ( new Shield\Utilities\Github\ListTags() )->run( 'FernleafSystems/Shield-Security-for-WordPress' );
334
  Transient::Set( $con->prefix( 'releases' ), $versions, WEEK_IN_SECONDS );
335
  }
336
+
337
+ if ( !empty( $versions ) ) {
338
+ if ( !in_array( $con->getVersion(), $versions ) ) {
339
+ $needed = true;
340
+ }
341
+ else {
342
+ array_splice( $versions, array_search( $con->getVersion(), $versions ) );
343
+ $needed = count( array_unique( array_map( function ( $version ) {
344
+ return substr( $version, 0, strrpos( $version, '.' ) );
345
+ }, $versions ) ) ) > 2;
346
+ }
347
+ }
348
  }
349
  return $needed;
350
  }
src/lib/src/Modules/Plugin/ModCon.php CHANGED
@@ -444,9 +444,12 @@ class ModCon extends BaseShield\ModCon {
444
  ]
445
  ];
446
 
 
447
  $opts = $this->getOptions();
448
- if ( Services::Request()->ts() - $opts->getOpt( 'ipdetect_at' ) > WEEK_IN_SECONDS*4 ) {
449
- $opts->setOpt( 'ipdetect_at', Services::Request()->ts() );
 
 
450
  $locals[] = [
451
  'shield/ip_detect',
452
  'icwp_wpsf_vars_ipdetect',
444
  ]
445
  ];
446
 
447
+ $req = Services::Request();
448
  $opts = $this->getOptions();
449
+ $runCheck = ( $req->ts() - $opts->getOpt( 'ipdetect_at' ) > WEEK_IN_SECONDS*4 )
450
+ || ( Services::WpUsers()->isUserAdmin() && !empty( $req->query( 'shield_check_ip_source' ) ) );
451
+ if ( $runCheck ) {
452
+ $opts->setOpt( 'ipdetect_at', $req->ts() );
453
  $locals[] = [
454
  'shield/ip_detect',
455
  'icwp_wpsf_vars_ipdetect',
src/lib/src/Modules/Plugin/UI.php CHANGED
@@ -14,6 +14,9 @@ class UI extends BaseShield\UI {
14
  'strings' => [
15
  'page_title' => sprintf( __( '%s Debug Page' ), $this->getCon()->getHumanName() )
16
  ],
 
 
 
17
  'vars' => [
18
  'debug_data' => ( new Collate() )
19
  ->setMod( $this->getMod() )
14
  'strings' => [
15
  'page_title' => sprintf( __( '%s Debug Page' ), $this->getCon()->getHumanName() )
16
  ],
17
+ 'hrefs' => [
18
+ 'check_visitor_ip_source' => add_query_arg( [ 'shield_check_ip_source' => '1' ] ),
19
+ ],
20
  'vars' => [
21
  'debug_data' => ( new Collate() )
22
  ->setMod( $this->getMod() )
src/lib/src/Rules/Responses/FirewallBlock.php CHANGED
@@ -63,6 +63,16 @@ class FirewallBlock extends Base {
63
  $ip = Services::IP()->getRequestIp();
64
 
65
  $resultData = $this->getConsolidatedConditionMeta();
 
 
 
 
 
 
 
 
 
 
66
 
67
  $mod = $this->getCon()->getModule_Firewall();
68
  return $mod->getEmailProcessor()->sendEmailWithTemplate(
@@ -86,10 +96,7 @@ class FirewallBlock extends Base {
86
  'vars' => [
87
  'req_details' => [
88
  __( 'Visitor IP Address', 'wp-simple-firewall' ) => $ip,
89
- __( 'Firewall Rule', 'wp-simple-firewall' ) => $this->getCon()
90
- ->getModule_Firewall()
91
- ->getStrings()
92
- ->getOptionStrings( 'block_'.$resultData[ 'match_category' ] )[ 'name' ] ?? 'No name',
93
  __( 'Firewall Pattern', 'wp-simple-firewall' ) => $resultData[ 'match_pattern' ] ?? 'Unavailable',
94
  __( 'Request Path', 'wp-simple-firewall' ) => Services::Request()->getPath(),
95
  __( 'Parameter Name', 'wp-simple-firewall' ) => $resultData[ 'match_request_param' ] ?? 'Unavailable',
63
  $ip = Services::IP()->getRequestIp();
64
 
65
  $resultData = $this->getConsolidatedConditionMeta();
66
+ $fwCategory = $resultData[ 'match_category' ] ?? '';
67
+ try {
68
+ $firewallRule = $this->getCon()
69
+ ->getModule_Firewall()
70
+ ->getStrings()
71
+ ->getOptionStrings( 'block_'.$fwCategory )[ 'name' ] ?? 'Unknown';
72
+ }
73
+ catch ( \Exception $e ) {
74
+ $firewallRule = 'Unknown';
75
+ }
76
 
77
  $mod = $this->getCon()->getModule_Firewall();
78
  return $mod->getEmailProcessor()->sendEmailWithTemplate(
96
  'vars' => [
97
  'req_details' => [
98
  __( 'Visitor IP Address', 'wp-simple-firewall' ) => $ip,
99
+ __( 'Firewall Rule', 'wp-simple-firewall' ) => $firewallRule,
 
 
 
100
  __( 'Firewall Pattern', 'wp-simple-firewall' ) => $resultData[ 'match_pattern' ] ?? 'Unavailable',
101
  __( 'Request Path', 'wp-simple-firewall' ) => Services::Request()->getPath(),
102
  __( 'Parameter Name', 'wp-simple-firewall' ) => $resultData[ 'match_request_param' ] ?? 'Unavailable',
src/lib/src/Utilities/Github/ListTags.php CHANGED
@@ -12,11 +12,16 @@ class ListTags {
12
  $tags = [];
13
  $raw = Services::HttpRequest()->getContent( sprintf( self::BASE_URL, $repo ) );
14
  if ( !empty( $raw ) ) {
15
- $tags = array_map( function ( $tag ) {
16
- return $tag[ 'name' ];
17
- }, json_decode( $raw, true ) );
 
 
 
 
 
18
  }
19
- return is_array( $tags ) ? $tags : [];
20
  }
21
  }
22
 
12
  $tags = [];
13
  $raw = Services::HttpRequest()->getContent( sprintf( self::BASE_URL, $repo ) );
14
  if ( !empty( $raw ) ) {
15
+ $decoded = @json_decode( $raw, true );
16
+ $tags = array_filter( array_map( function ( $tag ) {
17
+ $version = null;
18
+ if ( is_array( $tag ) && !empty( $tag[ 'name' ] ) && is_string( $tag[ 'name' ] ) ) {
19
+ $version = $tag[ 'name' ];
20
+ }
21
+ return $version;
22
+ }, is_array( $decoded ) ? $decoded : [] ) );
23
  }
24
+ return $tags;
25
  }
26
  }
27
 
templates/twig/wpadmin_pages/insights/debug/index.twig CHANGED
@@ -1,6 +1,11 @@
1
  {% extends '/wpadmin_pages/insights/base.twig' %}
2
 
3
  {% block page_main %}
 
 
 
 
 
4
  <div class="row">
5
  <div class="col">
6
  {{ content.recent_events|raw }}
1
  {% extends '/wpadmin_pages/insights/base.twig' %}
2
 
3
  {% block page_main %}
4
+ <div class="row">
5
+ <div class="col">
6
+ <a href="{{ hrefs.check_visitor_ip_source }}">Run background check for visitor IP source</a>
7
+ </div>
8
+ </div>
9
  <div class="row">
10
  <div class="col">
11
  {{ content.recent_events|raw }}