mirror of https://github.com/MISP/MISP
fix: [tag search] fixes #1
- correctly break the execution for AND ed tag searches if at least one of the tags in the list doesn't exist - correctly compare against the event_id field in the attribute_tags table, rather than the copy pasta error of Event.idpull/9764/head
parent
565b6a68c1
commit
5c80a22f1f
|
@ -1101,6 +1101,12 @@ class Attribute extends AppModel
|
|||
$params[$tag_key] = $this->dissectArgs($params[$tag_key]);
|
||||
foreach (array(0, 1, 2) as $tag_operator) {
|
||||
$tagArray[$tag_operator] = $tag->fetchTagIdsSimple($params[$tag_key][$tag_operator]);
|
||||
// If at least one of the ANDed tags is not found, invalidate the entire query by setting the lookup equal -1
|
||||
if ($tag_operator === 2) {
|
||||
if (count($params[$tag_key][2]) !== count($tagArray[2])) {
|
||||
$tagArray[2] = [-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$temp = array();
|
||||
if (!empty($tagArray[0])) {
|
||||
|
@ -1200,7 +1206,7 @@ class Attribute extends AppModel
|
|||
'tag_id' => $anded_tag
|
||||
),
|
||||
'fields' => array(
|
||||
$options['scope'] === 'Event' ? 'Event.id' : 'attribute_id'
|
||||
$options['scope'] === 'Event' ? 'event_id' : 'attribute_id'
|
||||
)
|
||||
);
|
||||
$lookup_field = $options['scope'] === 'Event' ? 'Event.id' : 'Attribute.id';
|
||||
|
|
Loading…
Reference in New Issue