Merge pull request #5818 from mailcow/fix/web
[Web] fix exception handler and rspamd_maps function
This commit is contained in:
commit
9decfa9c31
@ -12,7 +12,8 @@ $alertbox_log_parser = alertbox_log_parser($_SESSION);
|
|||||||
$alerts = [];
|
$alerts = [];
|
||||||
if (is_array($alertbox_log_parser)) {
|
if (is_array($alertbox_log_parser)) {
|
||||||
foreach ($alertbox_log_parser as $log) {
|
foreach ($alertbox_log_parser as $log) {
|
||||||
$message = strtr($log['msg'], ["\n" => '', "\r" => '', "\t" => '<br>']);
|
$message = htmlspecialchars($log['msg'], ENT_QUOTES);
|
||||||
|
$message = strtr($message, ["\n" => '', "\r" => '', "\t" => '<br>']);
|
||||||
$alerts[trim($log['type'], '"')][] = trim($message, '"');
|
$alerts[trim($log['type'], '"')][] = trim($message, '"');
|
||||||
}
|
}
|
||||||
$alert = array_filter(array_unique($alerts));
|
$alert = array_filter(array_unique($alerts));
|
||||||
|
@ -143,6 +143,7 @@ function rspamd_maps($_action, $_data = null) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$maps = (array)$_data['map'];
|
$maps = (array)$_data['map'];
|
||||||
|
$valid_maps = array();
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
foreach ($RSPAMD_MAPS as $rspamd_map_type) {
|
foreach ($RSPAMD_MAPS as $rspamd_map_type) {
|
||||||
if (!in_array($map, $rspamd_map_type)) {
|
if (!in_array($map, $rspamd_map_type)) {
|
||||||
@ -151,9 +152,12 @@ function rspamd_maps($_action, $_data = null) {
|
|||||||
'log' => array(__FUNCTION__, $_action, '-'),
|
'log' => array(__FUNCTION__, $_action, '-'),
|
||||||
'msg' => array('global_map_invalid', $map)
|
'msg' => array('global_map_invalid', $map)
|
||||||
);
|
);
|
||||||
continue;
|
} else {
|
||||||
|
array_push($valid_maps, $map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
foreach ($valid_maps as $map) {
|
||||||
try {
|
try {
|
||||||
if (file_exists('/rspamd_custom_maps/' . $map)) {
|
if (file_exists('/rspamd_custom_maps/' . $map)) {
|
||||||
$map_content = trim($_data['rspamd_map_data']);
|
$map_content = trim($_data['rspamd_map_data']);
|
||||||
|
@ -47,6 +47,12 @@ function api_log($_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Block requests not intended for direct API use by checking the 'Sec-Fetch-Dest' header.
|
||||||
|
if (isset($_SERVER['HTTP_SEC_FETCH_DEST']) && $_SERVER['HTTP_SEC_FETCH_DEST'] !== 'empty') {
|
||||||
|
header('HTTP/1.1 403 Forbidden');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['query'])) {
|
if (isset($_GET['query'])) {
|
||||||
|
|
||||||
$query = explode('/', $_GET['query']);
|
$query = explode('/', $_GET['query']);
|
||||||
|
Loading…
Reference in New Issue
Block a user