Skip to content

Commit 15a212e

Browse files
authored
Merge pull request #667 from CleanTalk/fix_vuln_weak_spot_av
Fix. Scanner. Editing the data preparation in the table
2 parents 4d511ab + 952f26c commit 15a212e

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

inc/spbc-settings.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,10 +2124,12 @@ function spbc_field_scanner__prepare_data__files(&$table)
21242124
if ( ! empty($weak_spots['SIGNATURES']) && $signatures) {
21252125
foreach ($weak_spots['SIGNATURES'] as $_string => $weak_spot_in_string) {
21262126
foreach ($weak_spot_in_string as $weak_spot) {
2127-
$ws_string .= '<span class="spbcRed"><i setting="signatures_' . $signatures[ $weak_spot ]->attack_type . '" class="spbc_long_description__show spbc-icon-help-circled"></i>' . $signatures[ $weak_spot ]->attack_type . ': </span>'
2128-
. (strlen($signatures[ $weak_spot ]->name) > 30
2129-
? substr($signatures[ $weak_spot ]->name, 0, 30) . '...'
2130-
: $signatures[ $weak_spot ]->name);
2127+
$attack_type = isset($signatures[ $weak_spot ]) ? $signatures[ $weak_spot ]->attack_type : '';
2128+
$sig_name = isset($signatures[ $weak_spot ]) ? $signatures[ $weak_spot ]->name : '';
2129+
$ws_string .= '<span class="spbcRed"><i setting="signatures_' . esc_attr($attack_type) . '" class="spbc_long_description__show spbc-icon-help-circled"></i>' . esc_html($attack_type) . ': </span>'
2130+
. (strlen($sig_name) > 30
2131+
? esc_html(substr($sig_name, 0, 30)) . '...'
2132+
: esc_html($sig_name));
21312133
}
21322134
}
21332135
}
@@ -2139,10 +2141,10 @@ function spbc_field_scanner__prepare_data__files(&$table)
21392141
}
21402142
$all_unique_weak_spots = array_unique($all_unique_weak_spots);
21412143
foreach ($all_unique_weak_spots as $weak_spot_in_string) {
2142-
$ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="heuristic_' . str_replace(' ', '_', $weak_spot_in_string) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Heuristic: </span>'
2144+
$ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="heuristic_' . esc_attr(str_replace(' ', '_', $weak_spot_in_string)) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Heuristic: </span>'
21432145
. (strlen($weak_spot_in_string) > 30
2144-
? substr($weak_spot_in_string, 0, 30) . '...'
2145-
: $weak_spot_in_string);
2146+
? esc_html(substr($weak_spot_in_string, 0, 30)) . '...'
2147+
: esc_html($weak_spot_in_string));
21462148
$ws_string .= '</p>';
21472149
}
21482150
}
@@ -2154,10 +2156,10 @@ function spbc_field_scanner__prepare_data__files(&$table)
21542156
}
21552157
$all_unique_weak_spots = array_unique($all_unique_weak_spots);
21562158
foreach ($all_unique_weak_spots as $weak_spot_in_string) {
2157-
$ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="suspicious_' . str_replace(' ', '_', $weak_spot_in_string) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Suspicious: </span>'
2159+
$ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="suspicious_' . esc_attr(str_replace(' ', '_', $weak_spot_in_string)) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Suspicious: </span>'
21582160
. (strlen($weak_spot_in_string) > 30
2159-
? substr($weak_spot_in_string, 0, 30) . '...'
2160-
: $weak_spot_in_string);
2161+
? esc_html(substr($weak_spot_in_string, 0, 30)) . '...'
2162+
: esc_html($weak_spot_in_string));
21612163
$ws_string .= '</p>';
21622164
}
21632165
}
@@ -2169,7 +2171,7 @@ function spbc_field_scanner__prepare_data__files(&$table)
21692171
}
21702172
$all_unique_weak_spots = array_unique($all_unique_weak_spots);
21712173
foreach ($all_unique_weak_spots as $weak_spot_in_string) {
2172-
$ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="hash_' . str_replace(' ', '_', $weak_spot_in_string) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Hash: </span>'
2174+
$ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="hash_' . esc_attr(str_replace(' ', '_', $weak_spot_in_string)) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Hash: </span>'
21732175
. 'denied';
21742176

21752177
$ws_string .= '</p>';
@@ -2205,7 +2207,7 @@ function spbc_field_scanner__prepare_data__files(&$table)
22052207
$errors = json_decode($row->error_msg, true);
22062208
if (!empty($errors)) {
22072209
foreach ($errors as $_key => $_val) {
2208-
$parsed_item_error .= '<p>' . $_key . ': ' . $_val . '</p>';
2210+
$parsed_item_error .= '<p>' . esc_html($_key) . ': ' . esc_html($_val) . '</p>';
22092211
}
22102212
} else {
22112213
$parsed_item_error = 'Unknown error';
@@ -2272,12 +2274,12 @@ function spbc_field_scanner__prepare_data__analysis_log(&$table)
22722274
}
22732275
break;
22742276
default:
2275-
$pscan_status = $row->pscan_processing_status;
2277+
$pscan_status = esc_html($row->pscan_processing_status);
22762278
$analysis_comment = 'Not scanned by Cloud or CleanTalk team.';
22772279
}
22782280

22792281
if ( isset($row->status) && $row->status === 'QUARANTINED' ) {
2280-
$pscan_status = $row->pscan_status;
2282+
$pscan_status = esc_html($row->pscan_status);
22812283
$analysis_comment = __('Quarantined by user', 'security-malware-firewall');
22822284
}
22832285

0 commit comments

Comments
 (0)