Skip to content

Commit

Permalink
Merge pull request #429 from mitre-attack/fix/#326-handle-empty-tacti…
Browse files Browse the repository at this point in the history
…c-names

Added catch and warning alert if user uploads layer with an empty tactic field
  • Loading branch information
clemiller authored Apr 29, 2022
2 parents df96f6f + c3b25a2 commit 17b7976
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

- Fixed a versioning error that occurred when loading a local layer with a previous version of ATT&CK.
- Added a feature to pin a technique cell when viewed in the matrix, enabling the user to scroll the details of the technique in the tooltip. See issue [#320](https://github.com/mitre-attack/attack-navigator/issues/320).
- Added a popup alert to notify users if a layer with an empty tactic field is uploaded, and therefore will not be displayed. See issue [#326](https://github.com/mitre-attack/attack-navigator/issues/326).

# v4.6.0 - 25 April 2022

Expand Down
7 changes: 5 additions & 2 deletions nav-app/src/app/viewmodels.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1653,8 +1653,11 @@ export class TechniqueVM {
if (techniqueID !== undefined) this.techniqueID = techniqueID;
else console.error("ERROR: TechniqueID field not present in technique")

if ("tactic" !== undefined) this.tactic = tactic;
else console.error("ERROR: tactic field not present in technique")
if (tactic !== undefined && tactic !== "") this.tactic = tactic;
else {
console.error("WARNING: tactic field not present in technique");
alert(`WARNING: The tactic field on the technique ID ${techniqueID} is not defined. Annotations for this technique will not be restored.`);
}
if ("comment" in obj) {
if (typeof(obj.comment) === "string") this.comment = obj.comment;
else console.error("TypeError: technique comment field is not a number:", obj.comment, "(",typeof(obj.comment),")")
Expand Down

0 comments on commit 17b7976

Please sign in to comment.