Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest -> v3.0 #716

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
== Changelog ==
= 3.4.1 =
FIX - improve security while processing AJAX requests in Admin Panel

= 3.4.0 =
* ENHANCEMENT - removed `udx/lib-settings` package dependency for security reasons.
* ENHANCEMENT - removed `udx/lib-utility` package dependency for security reasons.
Expand Down
3 changes: 3 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 3.4.1
FIX - improve security while processing AJAX requests in Admin Panel

#### 3.4.0
* ENHANCEMENT - removed `udx/lib-settings` package dependency for security reasons.
* ENHANCEMENT - removed `udx/lib-utility` package dependency for security reasons.
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/classes/class-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function __construct() {
* @author peshkov@UD
*/
public function request() {
check_ajax_referer('sm_inline_sync');

global $doing_manual_sync;

$response = array(
Expand Down
3 changes: 3 additions & 0 deletions lib/classes/class-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,9 @@ public function admin_init() {

/* Attachment or upload page */
wp_register_script('wp-stateless-uploads-js', $this->path('static/scripts/wp-stateless-uploads.js', 'url'), array('jquery'), self::$version);
wp_localize_script('wp-stateless-uploads-js', 'stateless_upload', [
'inline_sync_nonce' => wp_create_nonce('sm_inline_sync'),
]);

/* Setup wizard styles. */
wp_register_style('wp-stateless-setup-wizard', $this->path('static/styles/wp-stateless-setup-wizard.css', 'url'), array(), self::$version);
Expand Down
21 changes: 15 additions & 6 deletions lib/classes/class-errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public function admin_notices() {
wp_localize_script( "ud-dismiss", "_ud_vars", array(
"ajaxurl" => admin_url( 'admin-ajax.php' ),
) );

wp_localize_script( "sateless-error-notice-js", "stateless_error_notice_vars", array(
"dismiss_nonce" => wp_create_nonce( 'stateless_notice_dismiss' ),
"enable_action_nonce" => wp_create_nonce( 'stateless_enable_notice_button_action' ),
) );

//** Don't show the message if the user has no enough permissions. */
if ( ! function_exists( 'wp_get_current_user' ) ) {
Expand Down Expand Up @@ -248,20 +251,24 @@ public function admin_notices() {
* dismiss the notice ajax callback
* @throws \Exception
*/
public function dismiss_notices(){
public function dismiss_notices() {
check_ajax_referer('stateless_notice_dismiss');

$response = array(
'success' => '0',
'error' => __( 'There was an error in request.', $this->domain ),
);

$error = false;

if( empty($_POST['key']) && strpos($_POST['key'], 'dismissed_notice_') !== false ) {
$option_key = isset($_POST['key']) ? sanitize_key($_POST['key']) : '';

if ( strpos($option_key, 'dismissed_') !== 0 ) {
$response['error'] = __( 'Invalid key', $this->domain );
$error = true;
}
else {
$option_key = sanitize_key($_POST['key']);
update_option( $option_key, time() );

if ( !$error && update_option( $option_key, time() ) ) {
$response['success'] = '1';
$response['error'] = null;
}
Expand All @@ -274,6 +281,8 @@ public function dismiss_notices(){
* @throws \Exception
*/
public function stateless_enable_notice_button_action(){
check_ajax_referer('stateless_enable_notice_button_action');

$response = array(
'success' => '1',
);
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Tags: google, google cloud, google cloud storage, cdn, uploads, media, stateless
License: GPLv2 or later
Requires PHP: 8.0
Requires at least: 5.0
Tested up to: 6.4.2
Stable tag: 3.4.0
Tested up to: 6.4.3
Stable tag: 3.4.1

Upload and serve your WordPress media files from Google Cloud Storage.

Expand Down Expand Up @@ -112,6 +112,9 @@ Before upgrading to WP-Stateless 3.2.0, please, make sure you use PHP 7.2 or abo
Before upgrading to WP-Stateless 3.0, please, make sure you tested it on your development environment.

== Changelog ==
= 3.4.1 =
FIX - improve security while processing AJAX requests in Admin Panel

= 3.4.0 =
* ENHANCEMENT - removed `udx/lib-settings` package dependency for security reasons.
* ENHANCEMENT - removed `udx/lib-utility` package dependency for security reasons.
Expand Down
2 changes: 2 additions & 0 deletions static/scripts/error-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jQuery( document ).ready( function ($) {
var data = {
action: 'stateless_enable_notice_button_action',
key: _this.data('key'),
_ajax_nonce: stateless_error_notice_vars.enable_action_nonce ?? '',
}

jQuery.post( ajaxurl, data, function ( result_data ) {
Expand All @@ -41,6 +42,7 @@ jQuery( document ).ready( function ($) {
var data = {
action: 'stateless_notice_dismiss',
key: _this.data('key'),
_ajax_nonce: stateless_error_notice_vars.dismiss_nonce ?? '',
}

jQuery.post( ajaxurl, data, function ( result_data ) {
Expand Down
3 changes: 2 additions & 1 deletion static/scripts/wp-stateless-uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jQuery(document).ready(function(){
data: {
action: that.data('type') == 'image' ? "stateless_process_image" : "stateless_process_file",
id: that.data('id'),
size: that.data('size')
size: that.data('size'),
_ajax_nonce: stateless_upload.inline_sync_nonce ?? '',
}
})
.done(function( response ) {
Expand Down
16 changes: 8 additions & 8 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@
},
{
"name": "udx/lib-ud-api-client",
"version": "1.2.2",
"version_normalized": "1.2.2.0",
"version": "1.2.3",
"version_normalized": "1.2.3.0",
"source": {
"type": "git",
"url": "[email protected]:udx/lib-ud-api-client",
"reference": "1.2.2"
"reference": "1.2.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/udx/lib-ud-api-client/archive/1.2.2.zip"
"url": "https://github.com/udx/lib-ud-api-client/archive/1.2.3.zip"
},
"require": {
"php": ">=5.3"
Expand Down Expand Up @@ -310,16 +310,16 @@
},
{
"name": "udx/lib-wp-bootstrap",
"version": "1.3.1",
"version_normalized": "1.3.1.0",
"version": "1.3.2",
"version_normalized": "1.3.2.0",
"source": {
"type": "git",
"url": "[email protected]:udx/lib-wp-bootstrap",
"reference": "1.3.1"
"reference": "1.3.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/udx/lib-wp-bootstrap/archive/1.3.1.zip"
"url": "https://github.com/udx/lib-wp-bootstrap/archive/1.3.2.zip"
},
"require": {
"php": ">=5.3"
Expand Down
16 changes: 8 additions & 8 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'wpcloud/wp-stateless',
'pretty_version' => 'dev-latest',
'version' => 'dev-latest',
'reference' => '4e811ffcf935c543ab66a31c9562301a405d988d',
'reference' => '4485e93b09271c7d1d632d20406de711e4d8b391',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -50,18 +50,18 @@
),
),
'udx/lib-ud-api-client' => array(
'pretty_version' => '1.2.2',
'version' => '1.2.2.0',
'reference' => '1.2.2',
'pretty_version' => '1.2.3',
'version' => '1.2.3.0',
'reference' => '1.2.3',
'type' => 'library',
'install_path' => __DIR__ . '/../udx/lib-ud-api-client',
'aliases' => array(),
'dev_requirement' => false,
),
'udx/lib-wp-bootstrap' => array(
'pretty_version' => '1.3.1',
'version' => '1.3.1.0',
'reference' => '1.3.1',
'pretty_version' => '1.3.2',
'version' => '1.3.2.0',
'reference' => '1.3.2',
'type' => 'library',
'install_path' => __DIR__ . '/../udx/lib-wp-bootstrap',
'aliases' => array(),
Expand All @@ -70,7 +70,7 @@
'wpcloud/wp-stateless' => array(
'pretty_version' => 'dev-latest',
'version' => 'dev-latest',
'reference' => '4e811ffcf935c543ab66a31c9562301a405d988d',
'reference' => '4485e93b09271c7d1d632d20406de711e4d8b391',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down
4 changes: 4 additions & 0 deletions vendor/udx/lib-ud-api-client/changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.2.3

* Improve security while processing AJAX requests in Admin Panel.

### 1.2.2

* Remove dependency from `udx/lib-utility`.
2 changes: 1 addition & 1 deletion vendor/udx/lib-ud-api-client/gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Build Plugin.
*
* @author potanin@UD
* @version 1.2.2
* @version 1.2.3
* @param grunt
*/
module.exports = function( grunt ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Bootstrap extends Scaffold {
/**
*
*/
public static $version = '1.2.2';
public static $version = '1.2.3';

/**
*
Expand Down
Loading