Skip to content

Commit

Permalink
Merge pull request #368 from mitre-attack/bugs/multi-digit-versions
Browse files Browse the repository at this point in the history
Fix bug where multi-digit versions wouldn't get loaded properly
  • Loading branch information
isaisabel authored Oct 21, 2021
2 parents 1b9a662 + 389b228 commit 13227ee
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v4.5.1 - 21 October 2021

## Fixes
- Fixes support for ATT&CK versions with more than 1 digit (ex. ATT&CK v10).
- Uploaded layers without a specified ATT&CK version will no longer try and fail to load ATT&CK v1
- Uploaded layers uring ATT&CK v10 will no longer try and fail to load ATT&CK v1
- Downloaded layers using ATT&CK v10 will no longer claim they use ATT&CK v1

# v4.5.0 - 21 October 2021

## New Features
Expand Down
2 changes: 1 addition & 1 deletion nav-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nav-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "git",
"url": "https://github.com/mitre-attack/attack-navigator.git"
},
"version": "4.5.0",
"version": "4.5.1",
"license": "Apache-2.0",
"scripts": {
"ng": "ng",
Expand Down
6 changes: 3 additions & 3 deletions nav-app/src/app/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ export class DataService {
* Retrieves the first version defined in the config file
*/
getCurrentVersion() {
return this.versions[0].match(/v[0-9]/g)[0].toLowerCase();
return this.versions[0].match(/v[0-9]+/g)[0].toLowerCase();
}

/**
* Is the given version supported?
*/
isSupported(version: string) {
return version.match(/[0-9]/g)[0] < this.versions[this.versions.length - 1].match(/[0-9]/g)[0]? false : true;
return version.match(/[0-9]+/g)[0] < this.versions[this.versions.length - 1].match(/[0-9]+/g)[0]? false : true;
}

/**
Expand Down Expand Up @@ -801,6 +801,6 @@ export class Domain {
* Get version of this domain
*/
getVersion() {
return this.version.match(/[0-9]/g)[0];
return this.version.match(/[0-9]+/g)[0];
}
}
2 changes: 1 addition & 1 deletion nav-app/src/app/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
//
'use strict';

export const nav_version: string="4.5.0"
export const nav_version: string="4.5.1"
export const layer_version: string="4.2"
4 changes: 2 additions & 2 deletions nav-app/src/app/viewmodels.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ export class ViewModel {
"layer": globals.layer_version
}

rep.domain = this.domainVersionID.substr(0, this.domainVersionID.search(/-v[0-9]/g));
rep.domain = this.domainVersionID.substr(0, this.domainVersionID.search(/-v[0-9]+/g));
rep.description = this.description;
rep.filters = JSON.parse(this.filters.serialize());
rep.sorting = this.sorting;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ export class ViewModel {
if ("versions" in obj) {
if ("attack" in obj.versions) {
if (typeof(obj.versions.attack) === "string") {
if (obj.versions.attack.length > 0) this.version = "v" + obj.versions.attack.match(/[0-9]/g)[0];
if (obj.versions.attack.length > 0) this.version = "v" + obj.versions.attack.match(/[0-9]+/g)[0];
}
else console.error("TypeError: attack version field is not a string");
}
Expand Down

0 comments on commit 13227ee

Please sign in to comment.