Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-data-access/WPDataAccess/API/WPDA_Apps.php
+++ b/wp-data-access/WPDataAccess/API/WPDA_Apps.php
@@ -591,6 +591,48 @@
'app_id' => $this->get_param( 'app_id' ),
),
) );
+ register_rest_route( WPDA_API::WPDA_NAMESPACE, 'app/upload', array(
+ 'methods' => array('POST'),
+ 'callback' => array($this, 'app_upload'),
+ 'permission_callback' => '__return_true',
+ 'args' => array(
+ 'app_id' => $this->get_param( 'app_id' ),
+ 'cnt_id' => $this->get_param( 'cnt_id' ),
+ 'pk' => array(
+ 'required' => true,
+ 'type' => 'string',
+ 'description' => __( 'Primary key in JSON format', 'wp-data-access' ),
+ 'sanitize_callback' => 'sanitize_text_field',
+ 'validate_callback' => 'rest_validate_request_arg',
+ ),
+ 'col' => $this->get_param( 'col' ),
+ ),
+ ) );
+ register_rest_route( WPDA_API::WPDA_NAMESPACE, 'app/download', array(
+ 'methods' => array('POST'),
+ 'callback' => array($this, 'app_download'),
+ 'permission_callback' => '__return_true',
+ 'args' => array(
+ 'app_id' => $this->get_param( 'app_id' ),
+ 'cnt_id' => $this->get_param( 'cnt_id' ),
+ 'pk' => array(
+ 'required' => true,
+ 'type' => 'string',
+ 'description' => __( 'Primary key in JSON format', 'wp-data-access' ),
+ 'sanitize_callback' => 'sanitize_text_field',
+ 'validate_callback' => 'rest_validate_request_arg',
+ ),
+ 'col' => $this->get_param( 'col' ),
+ ),
+ ) );
+ }
+
+ public function app_download( $request ) {
+ return $this->WPDA_Rest_Response( 'OK' );
+ }
+
+ public function app_upload( $request ) {
+ return $this->WPDA_Rest_Response( 'OK' );
}
public function app_wpa_deactivate( $request ) {
@@ -923,6 +965,7 @@
$rel_tab = $request->get_param( 'rel_tab' );
$client_side = '1' === $request->get_param( 'client_side' );
$geo_radius = $request->get_param( 'geo_radius' );
+ $docs = array();
$default_where = '';
$default_orderby = '';
$lookups = array();
@@ -998,7 +1041,8 @@
$m2m_relationship,
$search_data_types,
$client_side,
- $geo_radius
+ $geo_radius,
+ $docs
);
} else {
if ( 'rest_cookie_invalid_nonce' === $msg ) {
@@ -1033,6 +1077,7 @@
$key = $request->get_param( 'key' );
$media = $request->get_param( 'media' );
$rel_tab = $request->get_param( 'rel_tab' );
+ $docs = array();
if ( $this->check_app_access(
$app_id,
$cnt_id,
@@ -1054,7 +1099,8 @@
$key,
$media,
$column_names,
- $default_where
+ $default_where,
+ $docs
);
} else {
if ( 'rest_cookie_invalid_nonce' === $msg ) {
@@ -2026,6 +2072,7 @@
'date_format' => get_option( 'date_format' ),
'time_format' => get_option( 'time_format' ),
'scroll_offset' => WPDA::get_option( WPDA::OPTION_APPS_SCROLL_OFFSET ),
+ 'upload' => @ini_get( 'upload_max_filesize' ),
];
return $settings;
}
--- a/wp-data-access/WPDataAccess/API/WPDA_Table.php
+++ b/wp-data-access/WPDataAccess/API/WPDA_Table.php
@@ -487,7 +487,8 @@
$primary_key,
$media_columns = array(),
$column_names = array(),
- $default_where = ''
+ $default_where = '',
+ $docs = array()
) {
$wpdadb = WPDADB::get_db_connection( $dbs );
if ( null === $wpdadb ) {
@@ -552,6 +553,7 @@
}
}
$context = array();
+ // Add media
$context['media'] = $media;
if ( isset( $debug['debug'] ) && 'on' === WPDA::get_option( WPDA::OPTION_PLUGIN_DEBUG ) ) {
$context['debug'] = $debug['debug'];
@@ -935,7 +937,8 @@
$m2m_relationship = array(),
$search_data_types = array(),
$client_side = false,
- $geo_radius = array()
+ $geo_radius = array(),
+ $docs = array()
) {
$wpdadb = WPDADB::get_db_connection( $dbs );
if ( null === $wpdadb ) {
@@ -1213,6 +1216,7 @@
'connect' => $connect,
'copyinprogress' => WPDA_Actions::copy_in_progress(),
'scroll_offset' => WPDA::get_option( WPDA::OPTION_APPS_SCROLL_OFFSET ),
+ 'upload' => @ini_get( 'upload_max_filesize' ),
];
if ( true === $waa ) {
$settings->wp['aonce'] = implode( '-', array(
--- a/wp-data-access/WPDataAccess/Data_Apps/WPDA_App_Container.php
+++ b/wp-data-access/WPDataAccess/Data_Apps/WPDA_App_Container.php
@@ -67,7 +67,7 @@
if ( ! $this->user_can_access( $app ) ) {
if ( $this->pwa ) {
- echo __( 'Not authorized', 'wp-data-access' );
+ esc_html_e( 'Not authorized', 'wp-data-access' );
return;
}
--- a/wp-data-access/WPDataAccess/Data_Apps/WPDA_PWA.php
+++ b/wp-data-access/WPDataAccess/Data_Apps/WPDA_PWA.php
@@ -16,4 +16,7 @@
private static function render_pwa( $route ) {
}
+ private static function get_icon_url( $route, $px ) {
+ }
+
}
--- a/wp-data-access/WPDataAccess/Data_Publisher/WPDA_Publisher_Form.php
+++ b/wp-data-access/WPDataAccess/Data_Publisher/WPDA_Publisher_Form.php
@@ -193,14 +193,14 @@
if ( $form_item->get_item_name() === 'pub_column_names' ) {
$title = __( 'Select columns shown in data table', 'wp-data-access' );
$form_item->set_item_hide_icon( true );
- $form_item->set_item_js( 'jQuery("#pub_column_names").parent().parent().find("td.icon").append("<a id='select_columns' class='button wpda_tooltip' href='javascript:void(0)' title='' . $title . '' onclick='select_columns()'>' . '<i class='fas fa-list wpda_icon_on_button'></i> ' . __( 'Select', 'wp-data-access' ) . '</a>");' );
+ $form_item->set_item_js( 'jQuery("#pub_column_names").parent().parent().find("td.icon").append("<a id='select_columns' class='button wpda_tooltip' href='javascript:void(0)' title='' . esc_attr( $title ) . '' onclick='select_columns()'>' . '<i class='fas fa-list wpda_icon_on_button'></i> ' . __( 'Select', 'wp-data-access' ) . '</a>");' );
}
// Prepare column label settings.
if ( $form_item->get_item_name() === 'pub_format' ) {
$title = __( 'Define columns for data table (not necessary if already defined in Data Explorer table settings)', 'wp-data-access' );
$form_item->set_item_hide_icon( true );
$form_item->set_item_class( 'hide_item' );
- $form_item->set_item_js( 'jQuery("#pub_format").parent().parent().find("td.data").append("<a id='format_columns' class='button wpda_tooltip' href='javascript:void(0)' title='' . $title . '' onclick='format_columns()'>' . '<i class='fas fa-tag wpda_icon_on_button'></i> ' . __( 'Click to define column labels', 'wp-data-access' ) . '</a>");' );
+ $form_item->set_item_js( 'jQuery("#pub_format").parent().parent().find("td.data").append("<a id='format_columns' class='button wpda_tooltip' href='javascript:void(0)' title='' . esc_attr( $title ) . '' onclick='format_columns()'>' . '<i class='fas fa-tag wpda_icon_on_button'></i> ' . __( 'Click to define column labels', 'wp-data-access' ) . '</a>");' );
}
if ( 'pub_responsive_popup_title' === $form_item->get_item_name() || 'pub_responsive_cols' === $form_item->get_item_name() || 'pub_responsive_type' === $form_item->get_item_name() || 'pub_responsive_modal_hyperlinks' === $form_item->get_item_name() || 'pub_responsive_icon' === $form_item->get_item_name() || 'pub_flat_scrollx' === $form_item->get_item_name() ) {
$form_item->set_hide_item_init( true );
--- a/wp-data-access/WPDataAccess/Data_Tables/WPDA_Data_Tables.php
+++ b/wp-data-access/WPDataAccess/Data_Tables/WPDA_Data_Tables.php
@@ -1066,17 +1066,17 @@
$hyperlink = json_decode( (string) $row[$hyperlinks_array[$i]], true );
if ( is_array( $hyperlink ) && isset( $hyperlink['label'] ) && isset( $hyperlink['url'] ) && isset( $hyperlink['target'] ) ) {
if ( '' === $hyperlink['url'] ) {
- $row[$hyperlinks_array[$i]] = $hyperlink['label'];
+ $row[$hyperlinks_array[$i]] = esc_attr( $hyperlink['label'] );
} else {
- $row[$hyperlinks_array[$i]] = "<a href='{$hyperlink['url']}' target='{$hyperlink['target']}'>{$hyperlink['label']}</a>";
+ $row[$hyperlinks_array[$i]] = "<a href='" . esc_url_raw( $hyperlink['url'] ) . "' target='" . esc_attr( $hyperlink['target'] ) . "'>" . esc_attr( $hyperlink['label'] ) . "</a>";
}
} else {
$row[$hyperlinks_array[$i]] = '';
}
} else {
if ( null !== $row[$hyperlinks_array[$i]] && '' !== $row[$hyperlinks_array[$i]] ) {
- $hyperlink_label = $this->wpda_list_columns->get_column_label( $hyperlinks_array_col[$i] );
- $row[$hyperlinks_array[$i]] = "<a href='{$row[$hyperlinks_array[$i]]}' target='_blank'>{$hyperlink_label}</a>";
+ $hyperlink_label = esc_attr( $this->wpda_list_columns->get_column_label( $hyperlinks_array_col[$i] ) );
+ $row[$hyperlinks_array[$i]] = "<a href='" . esc_url_raw( $row[$hyperlinks_array[$i]] ) . "' target='_blank'>" . esc_attr( $hyperlink_label ) . "</a>";
} else {
$row[$hyperlinks_array[$i]] = '';
}
@@ -1092,7 +1092,7 @@
if ( false !== $url ) {
$title = get_the_title( esc_attr( $media_id ) );
if ( false !== $url ) {
- $media_links .= '<div class="wpda_tooltip" title="' . $title . '">' . do_shortcode( '[audio src="' . $url . '"]' ) . '</div>';
+ $media_links .= '<div class="wpda_tooltip" title="' . esc_attr( $title ) . '">' . do_shortcode( '[audio src="' . esc_url_raw( $url ) . '"]' ) . '</div>';
}
}
}
@@ -1107,7 +1107,7 @@
$url = wp_get_attachment_url( esc_attr( $media_id ) );
if ( false !== $url ) {
if ( false !== $url ) {
- $media_links .= do_shortcode( '[video src="' . $url . '"]' );
+ $media_links .= do_shortcode( '[video src="' . esc_url_raw( $url ) . '"]' );
}
}
}
--- a/wp-data-access/WPDataAccess/List_Table/WPDA_List_Table.php
+++ b/wp-data-access/WPDataAccess/List_Table/WPDA_List_Table.php
@@ -547,12 +547,12 @@
if ( 'page_number' !== $this->page_number_item_name ) {
if ( isset( $_REQUEST['page_number'] ) ) {
$requested_page_number = sanitize_text_field( wp_unslash( $_REQUEST['page_number'] ) );
- $this->page_number_link = '&page_number=' . $requested_page_number;
- $this->page_number_item = "<input type='hidden' name='page_number' value='" . $requested_page_number . "' />";
+ $this->page_number_link = '&page_number=' . esc_attr( $requested_page_number );
+ $this->page_number_item = "<input type='hidden' name='page_number' value='" . esc_attr( $requested_page_number ) . "' />";
}
}
- $this->page_number_link .= '&paged=' . $this->get_pagenum();
- $this->page_number_item .= "<input type='hidden' name='" . esc_attr( $this->page_number_item_name ) . "' value='" . $this->get_pagenum() . "' />";
+ $this->page_number_link .= '&paged=' . esc_attr( $this->get_pagenum() );
+ $this->page_number_item .= "<input type='hidden' name='" . esc_attr( $this->page_number_item_name ) . "' value='" . esc_attr( $this->get_pagenum() ) . "' />";
// Add search arguments to link to return to same page.
foreach ( $_REQUEST as $key => $value ) {
if ( substr( $key, 0, 19 ) === 'wpda_search_column_' && count( array_filter( $this->wpda_list_columns->get_table_columns(), function ( $column ) use($key) {
@@ -959,7 +959,13 @@
$hyperlink_label = ( isset( $hyperlink->hyperlink_label ) ? $hyperlink->hyperlink_label : '' );
$hyperlink_target = ( isset( $hyperlink->hyperlink_target ) ? $hyperlink->hyperlink_target : false );
$target = ( true === $hyperlink_target ? "target='_blank'" : '' );
- return "<a href='" . str_replace( ' ', '+', trim( $hyperlink_html ) ) . "' {$target}>{$hyperlink_label}</a>";
+ if ( false === $hyperlink_target ) {
+ $json = json_decode( $hyperlink_html, true );
+ if ( isset( $json['url'] ) ) {
+ $hyperlink_target = $json['url'];
+ }
+ }
+ return "<a href='" . esc_url_raw( $hyperlink_target ) . "' {$target}>" . esc_attr( $hyperlink_label ) . "</a>";
}
} else {
return '';
@@ -1009,14 +1015,14 @@
if ( '' === $hyperlink['url'] ) {
return '';
} else {
- return "<a href='{$hyperlink['url']}' target='{$hyperlink['target']}'>{$hyperlink['label']}</a>";
+ return "<a href='" . esc_url_raw( $hyperlink['url'] ) . "' target='" . esc_attr( $hyperlink['target'] ) . "'>" . esc_attr( $hyperlink['label'] ) . "</a>";
}
} else {
return '';
}
} else {
$hyperlink_label = $this->wpda_list_columns->get_column_label( $column_name );
- return "<a href='{$item[$column_name]}' target='_blank'>{$hyperlink_label}</a>";
+ return "<a href='" . esc_url_raw( $item[$column_name] ) . "' target='_blank'>" . esc_attr( $hyperlink_label ) . "</a>";
}
}
} elseif ( 'Audio' === $media_type ) {
@@ -1029,7 +1035,7 @@
if ( false !== $url ) {
$title = get_the_title( esc_attr( $audio_id ) );
if ( false !== $url ) {
- $audio_src .= '<div title="' . $title . '" class="wpda_tooltip">' . do_shortcode( '[audio src="' . $url . '"]' ) . '</div>';
+ $audio_src .= '<div title="' . esc_attr( $title ) . '" class="wpda_tooltip">' . do_shortcode( '[audio src="' . esc_url_raw( $url ) . '"]' ) . '</div>';
}
}
}
@@ -1044,7 +1050,7 @@
$url = wp_get_attachment_url( esc_attr( $video_id ) );
if ( false !== $url ) {
if ( false !== $url ) {
- $video_src .= do_shortcode( '[video src="' . $url . '"]' );
+ $video_src .= do_shortcode( '[video src="' . esc_url_raw( $url ) . '"]' );
}
}
}
@@ -1123,9 +1129,9 @@
ttttt{$add_schema_and_table_name}
ttttt<input type='hidden' name='action' value='{$esc_attr( $action )}' />
ttttt<input type='hidden' name='_wpnonce' value='{$esc_attr( $wp_nonce )}'>
-ttttt{$row_security_nonce_field}
-ttttt{$page_number_item}
-ttttt{$case_sensitive_search}
+ttttt{$esc_attr( $row_security_nonce_field )}
+ttttt{$esc_attr( $page_number_item )}
+ttttt{$esc_attr( $case_sensitive_search )}
tttt</form>
EOT;
return str_replace( array("n", "r"), '', $form );
@@ -1192,9 +1198,9 @@
WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP )
);
if ( $substitute_newlines ) {
- return str_replace( "n", '<br/>', substr( esc_html( str_replace( '&', '&', (string) $column_content ) ), 0, WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP ) ) . ' <a href="javascript:void(0)" title="' . $title . '">•••</a>' );
+ return str_replace( "n", '<br/>', substr( esc_html( str_replace( '&', '&', (string) $column_content ) ), 0, WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP ) ) . ' <a href="javascript:void(0)" title="' . esc_attr( $title ) . '">•••</a>' );
} else {
- return substr( esc_html( str_replace( '&', '&', (string) $column_content ) ), 0, WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP ) ) . ' <a href="javascript:void(0)" title="' . $title . '">•••</a>';
+ return substr( esc_html( str_replace( '&', '&', (string) $column_content ) ), 0, WPDA::get_option( WPDA::OPTION_BE_TEXT_WRAP ) ) . ' <a href="javascript:void(0)" title="' . esc_attr( $title ) . '">•••</a>';
}
} else {
$column_data_type = $this->wpda_list_columns->get_column_data_type( $column_name );
--- a/wp-data-access/WPDataAccess/Simple_Form/WPDA_Simple_Form.php
+++ b/wp-data-access/WPDataAccess/Simple_Form/WPDA_Simple_Form.php
@@ -465,8 +465,9 @@
// Add search arguments to link to return to same page
foreach ( $_REQUEST as $key => $value ) {
if ( substr( $key, 0, 19 ) === 'wpda_search_column_' ) {
- $this->page_number_link .= "&{$key}={$value}";
- $this->page_number_item .= "<input type='hidden' name='{$key}' value='{$value}' />";
+ $esc_attr = 'esc_attr';
+ $this->page_number_link .= "&{$esc_attr( $key )}={$esc_attr( $value )}";
+ $this->page_number_item .= "<input type='hidden' name='{$esc_attr( $key )}' value='{$esc_attr( $value )}' />";
}
}
// Check if button text "back to list" should be changed
--- a/wp-data-access/WPDataAccess/Simple_Form/WPDA_Simple_Form_Item_Hyperlink.php
+++ b/wp-data-access/WPDataAccess/Simple_Form/WPDA_Simple_Form_Item_Hyperlink.php
@@ -131,7 +131,7 @@
<input type="hidden"
name="<?php echo esc_attr( $this->item_name ); ?>"
- value="<?php echo $this->show_context_column_value; // phpcs:ignore WordPress.Security.EscapeOutput ?>"
+ value="<?php echo esc_html( $this->show_context_column_value ); ?>"
class="wpda_hyperlink"
/>
<?php
--- a/wp-data-access/WPDataAccess/WPDA.php
+++ b/wp-data-access/WPDataAccess/WPDA.php
@@ -51,8 +51,8 @@
/**
* Option wpda_version and it's default value
*/
- const OPTION_WPDA_VERSION = array( 'wpda_version', '5.5.79' );
- const OPTION_WPDA_CLIENT_VERSION = array( 'wpda_client_version', '1.0.77' );
+ const OPTION_WPDA_VERSION = array( 'wpda_version', '5.5.80' );
+ const OPTION_WPDA_CLIENT_VERSION = array( 'wpda_client_version', '1.0.78' );
const OPTION_WPDA_UPGRADED = array( 'wpda_upgraded', false );
/**
* Option wpda_setup_error and it's default value
--- a/wp-data-access/WPDataAccess/Wordpress_Original/WP_List_Table.php
+++ b/wp-data-access/WPDataAccess/Wordpress_Original/WP_List_Table.php
@@ -628,7 +628,7 @@
foreach ( $value as $name => $title ) {
$class = ( 'edit' === $name ) ? ' class="hide-if-no-js"' : '';
- echo "tt" . '<option value="' . esc_attr( $name ) . '"' . $class . '>' . $title . "</option>n";
+ echo "tt" . '<option value="' . esc_attr( $name ) . '"' . $class . '>' . esc_attr( $title ) . "</option>n";
}
echo "t" . "</optgroup>n";
} else {
--- a/wp-data-access/WPDataProjects/List_Table/WPDP_List_Table.php
+++ b/wp-data-access/WPDataProjects/List_Table/WPDP_List_Table.php
@@ -78,7 +78,7 @@
$url = wp_get_attachment_url( esc_attr( $image_id ) );
if ( false !== $url ) {
$image_src .= '' !== $image_src ? '<br/>' : '';
- $image_src .= sprintf( '<img src="%s" width="100%%">', $url );
+ $image_src .= sprintf( '<img src="%s" width="100%%">', esc_url_raw( $url ) );
}
}
@@ -105,7 +105,7 @@
}
$title = get_the_title( esc_attr( $media_id ) );
$media_links .= '' !== $media_links ? '<br/>' : '';
- $media_links .= sprintf( '<span class="dashicons dashicons-external"></span><a href="%s" title="%s" class="wpda_tooltip" target="_blank">%s</a>', $url, $title, $mime_type );
+ $media_links .= sprintf( '<span class="dashicons dashicons-external"></span><a href="%s" title="%s" class="wpda_tooltip" target="_blank">%s</a>', esc_url_raw( $url ), esc_attr( $title ), esc_html( $mime_type ) );
}
}
}
--- a/wp-data-access/WPDataProjects/Parent_Child/WPDP_Parent_List_Table.php
+++ b/wp-data-access/WPDataProjects/Parent_Child/WPDP_Parent_List_Table.php
@@ -113,7 +113,7 @@
$actions['delete'] = sprintf(
'
<a href="javascript:void(0)" class="wpda_tooltip"
- title="' . $title . '"
+ title="' . esc_attr( $title ) . '"
onclick="if (confirm('%s')) jQuery('%s').submit()"
>
<span style="white-space:nowrap">
--- a/wp-data-access/wp-data-access.php
+++ b/wp-data-access/wp-data-access.php
@@ -4,7 +4,7 @@
* Plugin Name: WP Data Access
* Plugin URI: https://wpdataaccess.com/
* Description: A powerful data-driven App Builder with an intuitive Table Builder, a highly customizable Form Builder and interactive Chart support in 35 languages
- * Version: 5.5.79
+ * Version: 5.5.80
* Author: Passionate Programmers B.V.
* Author URI: https://wpdataaccess.com/
* Text Domain: wp-data-access