Skip to content

Commit

Permalink
Add security nonces.
Browse files Browse the repository at this point in the history
  • Loading branch information
brettshumaker committed Oct 31, 2023
1 parent db6fd24 commit 90bd46b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions trunk/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: brettshumaker
Tags: staff list, staff directory, employee list, staff, employee, employees
Requires at least: 3.0
Tested up to: 6.3
Tested up to: 6.3.2
Requires PHP: 5.4
Stable tag: 2.2.4
Stable tag: 2.2.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -47,6 +47,9 @@ Alright, here's a few things to try:

== Changelog ==

= 2.2.5 =
- FIXED: Added security nonces

= 2.2.4 =
- FIXED: Added additional escaping

Expand Down
6 changes: 4 additions & 2 deletions trunk/admin/class-simple-staff-list-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ public function enqueue_scripts() {
* @since 2.0
*/
public function ajax_flush_rewrite_rules() {
// Check the security nonce before doing anything.
if ( ! isset( $_POST['security'] ) || ! wp_verify_nonce( $_POST['security'], 'sslp_flush_rewrite_rules' ) ) {
wp_send_json_error();
}

flush_rewrite_rules();

wp_send_json_success();

}

/**
Expand Down
1 change: 1 addition & 0 deletions trunk/admin/partials/simple-staff-list-options-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
jQuery(document).ready(function($) {
var data = {
'action': 'sslp_flush_rewrite_rules',
'security': '<?php echo esc_attr( wp_create_nonce( 'sslp_flush_rewrite_rules' ) ); ?>'
}

$.post( "<?php echo esc_attr( admin_url( 'admin-ajax.php' ) ); ?>", data, function(response){});
Expand Down
2 changes: 1 addition & 1 deletion trunk/includes/class-simple-staff-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Simple_Staff_List {
public function __construct() {

$this->plugin_name = 'simple-staff-list';
$this->version = '2.2.4';
$this->version = '2.2.5';

$this->load_dependencies();
$this->set_locale();
Expand Down
2 changes: 1 addition & 1 deletion trunk/simple-staff-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: Simple Staff List
* Plugin URI: https://wordpress.org/plugins/simple-staff-list/
* Description: A simple plugin to build and display a staff listing for your website.
* Version: 2.2.4
* Version: 2.2.5
* Author: Brett Shumaker
* Author URI: http://www.brettshumaker.com
* License: GPL-2.0+
Expand Down

0 comments on commit 90bd46b

Please sign in to comment.