Skip to content

Commit

Permalink
update linkbyid validation logic when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
clemiller committed Jan 23, 2024
1 parent a2062d9 commit 8f9a09c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/app/classes/stix/stix-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,11 @@ export abstract class StixObject extends Serializable {

return restAPIService.getAllObjects({attackIDs: ids, revoked: true, deprecated: true, deserialize: true}).pipe(
map((results: any) => {
let retrieved_ids = (results.data as StixObject[]).map(obj => obj.attackID);
// objects must be validated in cases where more than one object is
// returned by the given ATT&CK ID, this occurs due to older versions
// of ATT&CK in which techniques shared their IDs with mitigations
let validObjects = (results.data as StixObject[]).filter(obj => obj.isValidAttackId());
let retrieved_ids = validObjects.map(obj => obj.attackID);
for (let id of ids) {
if (!retrieved_ids.includes(id)) result.missingLinks.add(id);
}
Expand Down

0 comments on commit 8f9a09c

Please sign in to comment.