mirror of https://github.com/MISP/MISP
fix: [correlation] Avoid duplicate correlation
parent
14ff781b5b
commit
2aa2b7c79b
|
@ -347,7 +347,7 @@ class Correlation extends AppModel
|
|||
$correlatingValues = [$a['value1']];
|
||||
} else {
|
||||
$extraConditions = null;
|
||||
$correlatingValues = [];
|
||||
$correlatingValues = [null];
|
||||
}
|
||||
if (!empty($a['value2']) && !in_array($a['type'], Attribute::PRIMARY_ONLY_CORRELATING_TYPES, true) && !$this->__preventExcludedCorrelations($a['value2'])) {
|
||||
$correlatingValues[] = $a['value2'];
|
||||
|
@ -359,6 +359,9 @@ class Correlation extends AppModel
|
|||
|
||||
$correlatingAttributes = [];
|
||||
foreach ($correlatingValues as $k => $cV) {
|
||||
if ($cV === null) {
|
||||
continue;
|
||||
}
|
||||
$conditions = [
|
||||
'OR' => [
|
||||
'Attribute.value1' => $cV,
|
||||
|
@ -375,7 +378,7 @@ class Correlation extends AppModel
|
|||
'Event.disable_correlation' => 0,
|
||||
'Attribute.deleted' => 0,
|
||||
];
|
||||
if (!empty($extraConditions)) {
|
||||
if ($k === 0 && !empty($extraConditions)) {
|
||||
$conditions['OR'][] = $extraConditions;
|
||||
}
|
||||
if ($full) {
|
||||
|
|
Loading…
Reference in New Issue