chg: [mail] TLP in subject should be uppercase

pull/6090/head
Jakub Onderka 2020-07-05 14:08:42 +02:00
parent ae5434fbc6
commit 05118ba2bc
2 changed files with 9 additions and 9 deletions

View File

@ -3027,11 +3027,11 @@ class Event extends AppModel
} else { } else {
$subject = ''; $subject = '';
} }
$subjMarkingString = !empty(Configure::read('MISP.email_subject_TLP_string')) ? Configure::read('MISP.email_subject_TLP_string') : "tlp:amber"; $subjMarkingString = Configure::read('MISP.email_subject_TLP_string') ?: "tlp:amber";
$subjTag = !empty(Configure::read('MISP.email_subject_tag')) ? Configure::read('MISP.email_subject_tag') : "tlp"; $subjTag = Configure::read('MISP.email_subject_tag') ?: "tlp";
$tagLen = strlen($subjTag); $tagLen = strlen($subjTag);
foreach ($event[0]['EventTag'] as $k => $tag) { foreach ($event[0]['EventTag'] as $k => $tag) {
$tagName=$tag['Tag']['name']; $tagName = $tag['Tag']['name'];
if (strncasecmp($subjTag, $tagName, $tagLen) == 0 && strlen($tagName) > $tagLen && ($tagName[$tagLen] == ':' || $tagName[$tagLen] == '=')) { if (strncasecmp($subjTag, $tagName, $tagLen) == 0 && strlen($tagName) > $tagLen && ($tagName[$tagLen] == ':' || $tagName[$tagLen] == '=')) {
if (Configure::read('MISP.email_subject_include_tag_name') === false) { if (Configure::read('MISP.email_subject_include_tag_name') === false) {
$subjMarkingString = trim(substr($tagName, $tagLen+1), '"'); $subjMarkingString = trim(substr($tagName, $tagLen+1), '"');
@ -3045,7 +3045,7 @@ class Event extends AppModel
if (Configure::read('MISP.threatlevel_in_email_subject') === false) { if (Configure::read('MISP.threatlevel_in_email_subject') === false) {
$threatLevel = ''; $threatLevel = '';
} }
$subject = "[" . Configure::read('MISP.org') . " MISP] Event " . $id . " - " . $subject . $threatLevel . $subjMarkingString; $subject = "[" . Configure::read('MISP.org') . " MISP] Event " . $id . " - " . $subject . $threatLevel . strtoupper($subjMarkingString);
// Initialise the Job class if we have a background process ID // Initialise the Job class if we have a background process ID
// This will keep updating the process's progress bar // This will keep updating the process's progress bar
@ -3250,13 +3250,13 @@ class Event extends AppModel
if (empty($orgMembers)) { if (empty($orgMembers)) {
return false; return false;
} }
$tplColorString = Configure::read('MISP.email_subject_TLP_string') ?: "tlp:amber";
$subject = "[" . Configure::read('MISP.org') . " MISP] Need info about event " . $id . " - " . strtoupper($tplColorString);
$result = true;
foreach ($orgMembers as $reporter) { foreach ($orgMembers as $reporter) {
$temp = $this->__buildContactEventEmailBody($user, $message, $event, $reporter, $id); $temp = $this->__buildContactEventEmailBody($user, $message, $event, $reporter, $id);
$bodyevent = $temp[0]; $bodyevent = $temp[0];
$body = $temp[1]; $body = $temp[1];
$result = true;
$tplColorString = !empty(Configure::read('MISP.email_subject_TLP_string')) ? Configure::read('MISP.email_subject_TLP_string') : "tlp:amber";
$subject = "[" . Configure::read('MISP.org') . " MISP] Need info about event " . $id . " - ".$tplColorString;
$result = $this->User->sendEmail($reporter, $bodyevent, $body, $subject, $user) && $result; $result = $this->User->sendEmail($reporter, $bodyevent, $body, $subject, $user) && $result;
} }
return $result; return $result;

View File

@ -118,8 +118,8 @@ class Post extends AppModel
$bodyDetail .= "The following message was added: \n"; $bodyDetail .= "The following message was added: \n";
$bodyDetail .= "\n"; $bodyDetail .= "\n";
$bodyDetail .= $message . "\n"; $bodyDetail .= $message . "\n";
$tplColorString = !empty(Configure::read('MISP.email_subject_TLP_string')) ? Configure::read('MISP.email_subject_TLP_string') : "tlp:amber"; $tplColorString = Configure::read('MISP.email_subject_TLP_string') ?: "tlp:amber";
$subject = "[" . Configure::read('MISP.org') . " MISP] New post in discussion " . $post['Post']['thread_id'] . " - ".$tplColorString; $subject = "[" . Configure::read('MISP.org') . " MISP] New post in discussion " . $post['Post']['thread_id'] . " - " . strtoupper($tplColorString);
foreach ($orgMembers as $recipient) { foreach ($orgMembers as $recipient) {
$this->User->sendEmail($recipient, $bodyDetail, $body, $subject); $this->User->sendEmail($recipient, $bodyDetail, $body, $subject);
} }