mirror of https://github.com/MISP/MISP
fix: [correlations] save the distribution state of the event before/after saving it, fixes #8528
- only trigger a correlation update with the new distribution if it actually changed - should remove a massive additional load on the table - thanks to @github-germ for noticing this!pull/8540/head
parent
42a30bae98
commit
e24d3bf2d3
|
@ -44,6 +44,8 @@ class Event extends AppModel
|
|||
|
||||
public $mispVersion = '2.4.0';
|
||||
|
||||
private $__beforeSaveData = null;
|
||||
|
||||
public $fieldDescriptions = array(
|
||||
'threat_level_id' => array('desc' => 'Risk levels: *low* means mass-malware, *medium* means APT malware, *high* means sophisticated APT malware or 0-day attack', 'formdesc' => 'Risk levels: low: mass-malware medium: APT malware high: sophisticated APT malware or 0-day attack'),
|
||||
'classification' => array('desc' => 'Set the Traffic Light Protocol classification. <ol><li><em>TLP:AMBER</em>- Share only within the organization on a need-to-know basis</li><li><em>TLP:GREEN:NeedToKnow</em>- Share within your constituency on the need-to-know basis.</li><li><em>TLP:GREEN</em>- Share within your constituency.</li></ol>'),
|
||||
|
@ -431,6 +433,7 @@ class Event extends AppModel
|
|||
if (empty($this->data['Event']['uuid'])) {
|
||||
$this->data['Event']['uuid'] = CakeText::uuid();
|
||||
}
|
||||
$this->__beforeSaveData = $this->data['Event'];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -438,8 +441,21 @@ class Event extends AppModel
|
|||
{
|
||||
$event = $this->data['Event'];
|
||||
if (!Configure::read('MISP.completely_disable_correlation') && !$created) {
|
||||
$this->Attribute->Correlation->updateContainedCorrelations($event, 'event');
|
||||
if (
|
||||
empty($this->__beforeSaveData) ||
|
||||
(
|
||||
isset($this->__beforeSaveData['distribution']) &&
|
||||
$event['distribution'] != $this->__beforeSaveData['distribution']
|
||||
) ||
|
||||
(
|
||||
isset($this->__beforeSaveData['sharing_group_id']) &&
|
||||
$event['sharing_group_id'] != $this->__beforeSaveData['sharing_group_id']
|
||||
)
|
||||
) {
|
||||
$this->Attribute->Correlation->updateContainedCorrelations($event, 'event');
|
||||
}
|
||||
}
|
||||
$this->__beforeSaveData = null;
|
||||
if (empty($event['unpublishAction']) && empty($event['skip_zmq']) && $this->pubToZmq('event')) {
|
||||
$pubSubTool = $this->getPubSubTool();
|
||||
$eventForZmq = $this->quickFetchEvent($event['id']);
|
||||
|
|
Loading…
Reference in New Issue