Skip to content

Commit 9c8e9af

Browse files
authored
Merge pull request #31 from brainstormforce/security-audit-fix
fix : plugin security audits.
2 parents 9df6f11 + 822a689 commit 9c8e9af

4 files changed

Lines changed: 19 additions & 12 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
**Donate link:** https://www.paypal.me/BrainstormForce
44
**Tags:** custom sidebar, sidebar manager, custom widget areas, widgets, conditional sidebar
55
**Requires at least:** 4.0
6-
**Tested up to:** 5.5
7-
**Stable tag:** 1.1.5
6+
**Tested up to:** 5.5.1
7+
**Stable tag:** 1.1.6
88
**License:** GPLv2 or later
99
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -51,7 +51,10 @@ Other plugins we found are heavy with ugly interface, non supported, developed o
5151

5252
## Changelog ##
5353

54-
### 1.1.5 ###
54+
### 1.1.6 ###
55+
- Improvement: Hardened the security of plugin.
56+
57+
### 1.1.5 ###
5558
- Fix: Security hardening.
5659

5760
### 1.1.4 ###

classes/class-bsf-sb-metabox.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function metabox_actions() {
8181
*/
8282
public function metabox_save( $post_id ) {
8383

84-
if( ! isset( $_POST[ BSF_SB_POST_TYPE . '-nonce' ] ) ) {
84+
if ( ! isset( $_POST[ BSF_SB_POST_TYPE . '-nonce' ] ) ) {
8585
return;
8686
}
8787

@@ -110,12 +110,13 @@ public function metabox_save( $post_id ) {
110110
}
111111

112112
if ( isset( $_POST['bsf-sb-users'] ) ) {
113-
update_post_meta( $post_id, '_bsf-sb-users', $_POST['bsf-sb-users'] );
113+
$bsf_sb_user_roles = array_map( 'sanitize_text_field', $_POST['bsf-sb-users'] );
114+
update_post_meta( $post_id, '_bsf-sb-users', $bsf_sb_user_roles );
114115
}
115116

116117
if ( isset( $_POST['replace_this_sidebar'] ) ) {
117118

118-
$replace_sidebar = esc_attr( $_POST['replace_this_sidebar'] );
119+
$replace_sidebar = sanitize_text_field( $_POST['replace_this_sidebar'] );
119120

120121
update_post_meta( $post_id, '_replace_this_sidebar', $replace_sidebar );
121122
}
@@ -158,7 +159,7 @@ public function sidebar_settings( $post ) {
158159
if ( strrpos( $slug, BSF_SB_PREFIX ) !== false ) {
159160
continue;
160161
}
161-
$out .= '<option value="' . $slug . '"' . selected( $replace_sidebar, $slug, false ) . '>' . $name . '</option>';
162+
$out .= '<option value="' . esc_attr( $slug ) . '"' . selected( $replace_sidebar, $slug, false ) . '>' . esc_attr( $name ) . '</option>';
162163
}
163164
$out .= '</select>';
164165
} else {
@@ -174,7 +175,7 @@ public function sidebar_settings( $post ) {
174175
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Add an optional description fot the Widgets screen.', 'sidebar-manager' ) . '"></i>';
175176
$out .= '</td>';
176177
$out .= '<td class="bsf-sb-row-content">';
177-
$out .= '<input type="text" rows="1" name="excerpt" value="' . $post->post_excerpt . '">';
178+
$out .= '<input type="text" rows="1" name="excerpt" value="' . esc_attr( $post->post_excerpt ) . '">';
178179
$out .= '</td>';
179180
$out .= '</tr>';
180181

readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: BrainstormForce
33
Donate link: https://www.paypal.me/BrainstormForce
44
Tags: custom sidebar, sidebar manager, custom widget areas, widgets, conditional sidebar
55
Requires at least: 4.0
6-
Tested up to: 5.5
7-
Stable tag: 1.1.5
6+
Tested up to: 5.5.1
7+
Stable tag: 1.1.6
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -51,6 +51,9 @@ Other plugins we found are heavy with ugly interface, non supported, developed o
5151

5252
== Changelog ==
5353

54+
= 1.1.6 =
55+
- Improvement: Hardened the security of plugin.
56+
5457
= 1.1.5 =
5558
- Fix: Security hardening.
5659

sidebar-manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Sidebar Manager
44
* Plugin URI: http://www.brainstormforce.com
55
* Description: This is the plugin to create custom siderbars to your site.
6-
* Version: 1.1.5
6+
* Version: 1.1.6
77
* Author: Brainstorm Force
88
* Author URI: https://www.brainstormforce.com/
99
* Text Domain: bsfsidebars
@@ -25,7 +25,7 @@
2525
define( 'BSF_SB_BASE', plugin_basename( BSF_SB_FILE ) );
2626
define( 'BSF_SB_DIR', plugin_dir_path( BSF_SB_FILE ) );
2727
define( 'BSF_SB_URL', plugins_url( '/', BSF_SB_FILE ) );
28-
define( 'BSF_SB_VER', '1.1.5' );
28+
define( 'BSF_SB_VER', '1.1.6' );
2929
define( 'BSF_SB_PREFIX', 'bsf-sb' );
3030
define( 'BSF_SB_POST_TYPE', 'bsf-sidebar' );
3131

0 commit comments

Comments
 (0)