Skip to content

Commit 78536e3

Browse files
Merge pull request #967 from Codeinwp/bugfix/364
Fixed cross site scripting vulnerability
2 parents fa10d4b + 645bece commit 78536e3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,9 @@ public function renderChartPages() {
532532
set_current_screen( 'visualizer_render_chart' );
533533
// check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
534534
$chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : '';
535+
if ( ! empty( $_POST ) ) {
536+
$_POST = map_deep( $_POST, 'wp_strip_all_tags' );
537+
}
535538
if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type !== Visualizer_Plugin::CPT_VISUALIZER ) {
536539
if ( empty( $_GET['lang'] ) || empty( $_GET['parent_chart_id'] ) ) {
537540
$this->deleteOldCharts();

js/preview.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
clearTimeout(timeout);
6262
timeout = setTimeout(function() {
6363
var settings = $('#settings-form').serializeObject();
64-
64+
settings = JSON.stringify( settings ).replace( /<\/?[^>]+(>|$)/g, '' );
65+
settings = JSON.parse( settings );
6566
delete settings['width'];
6667
delete settings['height'];
6768

0 commit comments

Comments
 (0)