Sanitize HTTP_CF_CONNECTING_IP in Request and escape values in Logs Monitor email - GHSA-9cm3-qvj2-8hg4
This commit is contained in:
@@ -103,18 +103,18 @@ class LogsMonitor extends Command
|
||||
$text = 'Logs having new records for the last '.$options['alert_logs_period'].':<ul>';
|
||||
foreach ($names as $name) {
|
||||
$text .= '<li>';
|
||||
$text .= '<strong>'.\App\ActivityLog::getLogTitle($name).'</strong>';
|
||||
$text .= '<strong>'.htmlspecialchars(\App\ActivityLog::getLogTitle($name)).'</strong>';
|
||||
$text .= '</li>';
|
||||
}
|
||||
$text .= '</ul>';
|
||||
|
||||
foreach ($names as $name) {
|
||||
$text .= '<br/><strong>'.\App\ActivityLog::getLogTitle($name).'</strong><br/>';
|
||||
$text .= '<br/><strong>'.htmlspecialchars(\App\ActivityLog::getLogTitle($name)).'</strong><br/>';
|
||||
foreach ($logs as $log) {
|
||||
if ($log->log_name != $name) {
|
||||
continue;
|
||||
}
|
||||
$text .= '● ['.$log->created_at.'] '.$log->getEventDescription().' <code>'.$log->properties.'</code><br/>';
|
||||
$text .= '● ['.$log->created_at.'] '.htmlspecialchars($log->getEventDescription()).' <code>'.htmlspecialchars($log->properties).'</code><br/>';
|
||||
}
|
||||
}
|
||||
// Send alert.
|
||||
|
||||
@@ -894,6 +894,8 @@ class Request
|
||||
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])
|
||||
&& $_SERVER['REMOTE_ADDR'] != $_SERVER["HTTP_CF_CONNECTING_IP"]
|
||||
&& config('app.cloudflare_is_used')
|
||||
// https://github.com/freescout-help-desk/freescout/security/advisories/GHSA-9cm3-qvj2-8hg4
|
||||
&& \Helper::isValidIp($_SERVER["HTTP_CF_CONNECTING_IP"])
|
||||
) {
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
|
||||
$this->server->set('REMOTE_ADDR', $_SERVER["HTTP_CF_CONNECTING_IP"]);
|
||||
|
||||
Reference in New Issue
Block a user