From 8f9a09c4bd1e64e09ddc7fc0eb05157296431088 Mon Sep 17 00:00:00 2001 From: Charissa Miller <48832936+clemiller@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:48:24 -0500 Subject: [PATCH] update linkbyid validation logic when saving --- app/src/app/classes/stix/stix-object.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/app/classes/stix/stix-object.ts b/app/src/app/classes/stix/stix-object.ts index b0050316..cc360b04 100644 --- a/app/src/app/classes/stix/stix-object.ts +++ b/app/src/app/classes/stix/stix-object.ts @@ -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); }