Skip to content

Commit

Permalink
same as last
Browse files Browse the repository at this point in the history
  • Loading branch information
elegantmoose committed May 17, 2023
1 parent 827f993 commit 5a72a1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/controllers/matrices-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ exports.deleteById = function(req, res) {
};


exports.retrieveVersionTechniquesById = function(req, res) {
matricesService.retrieveVersionTechniquesById(req.params.stixId, req.params.modified, function (err, matrix) {
exports.retrieveVersionTechniquesById = async function(req, res) {
await matricesService.retrieveVersionTechniquesById(req.params.stixId, req.params.modified, function (err, matrix) {
if (err) {
if (err.message === matricesService.errors.badlyFormattedParameter) {
logger.warn('Badly formatted stix id: ' + req.params.stixId);
Expand Down
9 changes: 4 additions & 5 deletions app/services/matrices-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ exports.retrieveVersionById = function(stixId, modified, callback) {

let retrieveTacticById;
let retrieveTechniquesForTactic;
exports.retrieveVersionTechniquesById = true;
exports.retrieveVersionTechniquesById = async function(stixId, modified, callback) {
// Retrieve the versions of the matrix techniques with the matching stixId and modified date

Expand Down Expand Up @@ -256,15 +255,15 @@ exports.retrieveVersionTechniquesById = async function(stixId, modified, callbac
if (matrix) {
// get tactics, then query for techniques and sub-techniques
const options = { versions: 'latest', offset: 0, limit: 0 };
let tactics_techniques = {};
const tactics_techniques = {};
for (const tactic_id of matrix['stix']['tactic_refs']) {
let tactic = await retrieveTacticById(tactic_id, options);
if (tactic) {
tactic = tactic[0];
let techniques = await retrieveTechniquesForTactic(tactic_id, tactic['stix']['modified'], options);
const techniques = await retrieveTechniquesForTactic(tactic_id, tactic['stix']['modified'], options);
// Organize sub-techniques under super techniques
let super_techniques = [];
let sub_techniques = [];
const super_techniques = [];
const sub_techniques = [];
for (const technique of techniques) {
if (technique['stix']['x_mitre_is_subtechnique'] === false) {
super_techniques.push(technique);
Expand Down

0 comments on commit 5a72a1a

Please sign in to comment.