From c0db3343544b3ae026cc45741d611f4313dc7803 Mon Sep 17 00:00:00 2001 From: Davis Plumlee Date: Fri, 4 Dec 2020 00:01:24 -0500 Subject: [PATCH] adds documentation to script --- .../public/detections/mitre/mitre_tactics_techniques.ts | 9 +++++++-- .../scripts/extract_tactics_techniques_mitre.js | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/mitre/mitre_tactics_techniques.ts b/x-pack/plugins/security_solution/public/detections/mitre/mitre_tactics_techniques.ts index d2d358a66d7bd..3684820b5383a 100644 --- a/x-pack/plugins/security_solution/public/detections/mitre/mitre_tactics_techniques.ts +++ b/x-pack/plugins/security_solution/public/detections/mitre/mitre_tactics_techniques.ts @@ -10044,11 +10044,16 @@ export const subtechniquesOptions: MitreSubtechniquesOptions[] = [ }, ]; +/** + * A full object of Mitre Attack Threat data that is taken directly from the `mitre_tactics_techniques.ts` file + * + * Is built alongside and sampled from the data in the file so to always be valid with the most up to date MITRE ATT&CK data + */ export const mockThreatData = { tactic: { name: 'Privilege Escalation', - id: 'TA0009', - reference: 'https://attack.mitre.org/tactics/TA0009', + id: 'TA0004', + reference: 'https://attack.mitre.org/tactics/TA0004', }, technique: { name: 'Event Triggered Execution', diff --git a/x-pack/plugins/security_solution/scripts/extract_tactics_techniques_mitre.js b/x-pack/plugins/security_solution/scripts/extract_tactics_techniques_mitre.js index 108c56bc9723c..5aa301a4dbe65 100644 --- a/x-pack/plugins/security_solution/scripts/extract_tactics_techniques_mitre.js +++ b/x-pack/plugins/security_solution/scripts/extract_tactics_techniques_mitre.js @@ -84,7 +84,7 @@ const buildMockThreatData = (tactics, techniques, subtechniques) => { const subtechnique = subtechniques[0]; const technique = techniques.find((technique) => technique.id === subtechnique.techniqueId); const tactic = tactics.find( - (tactic) => (tactic.name = startCase(camelCase(subtechnique.tactics[0]))) + (tactic) => tactic.name === startCase(camelCase(technique.tactics[0])) ); return { @@ -190,6 +190,11 @@ async function main() { .replace(/}"/g, '}') .replace(/"{/g, '{')}; + /** + * A full object of Mitre Attack Threat data that is taken directly from the \`mitre_tactics_techniques.ts\` file + * + * Is built alongside and sampled from the data in the file so to always be valid with the most up to date MITRE ATT&CK data + */ export const mockThreatData = ${JSON.stringify( buildMockThreatData(tactics, techniques, subtechniques), null,