mirror of https://github.com/MISP/MISP
fix: [object] the optional blocking of duplicates fixed for objects including malware samples
- also looping the attributes through the pre-validation massaging ensures that attributes modified by it are correctly comparedpull/6854/head
parent
88d7e08606
commit
7493f9e8c3
|
@ -303,9 +303,14 @@ class MispObject extends AppModel
|
|||
$newObjectAttributes = array();
|
||||
$existingObjectAttributes = array();
|
||||
foreach ($object['Attribute'] as $attribute) {
|
||||
if ($attribute['type'] === 'malware-sample') {
|
||||
if (strpos($attribute['value'], '|') === false && !empty($attribute['data'])) {
|
||||
$attribute['value'] = $attribute['value'] . '|' . md5(base64_decode($attribute['data']));
|
||||
}
|
||||
}
|
||||
$newObjectAttributes[] = hash(
|
||||
'sha256',
|
||||
$attribute['object_relation'] . $attribute['category'] . $attribute['type'] . $attribute['value']
|
||||
$attribute['object_relation'] . $attribute['category'] . $attribute['type'] . $this->data['Attribute']['value'] = $this->Attribute->modifyBeforeValidation($attribute['type'], $attribute['value'])
|
||||
);
|
||||
}
|
||||
$newObjectAttributeCount = count($newObjectAttributes);
|
||||
|
|
Loading…
Reference in New Issue