From a4eb2875e199b44769a5fe0ba125d66735e6ccab Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Thu, 24 Oct 2024 16:57:02 -0400 Subject: [PATCH 001/107] Fix typo Signed-off-by: Joyce Quach --- libs/hdf-converters/data/converters/xml2json.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/hdf-converters/data/converters/xml2json.ts b/libs/hdf-converters/data/converters/xml2json.ts index bf27458e8..51ffb1ccc 100644 --- a/libs/hdf-converters/data/converters/xml2json.ts +++ b/libs/hdf-converters/data/converters/xml2json.ts @@ -23,7 +23,7 @@ export interface ICCIList { } if (!pathToInfile || !pathToOutfile) { - console.error(`You must provide the path to both an input and ouput file.`); + console.error(`You must provide the path to both an input and output file.`); } else { fs.readFile(pathToInfile, function (readFileError, data) { if (readFileError) { From e11c5c540a22cee483d20d436127836e37b6f8fd Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 28 Oct 2024 12:04:05 -0400 Subject: [PATCH 002/107] Fix crashing on CCIs who had no references to any NIST controls Signed-off-by: Joyce Quach --- libs/hdf-converters/data/converters/xml2json.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/hdf-converters/data/converters/xml2json.ts b/libs/hdf-converters/data/converters/xml2json.ts index 51ffb1ccc..3f91501f0 100644 --- a/libs/hdf-converters/data/converters/xml2json.ts +++ b/libs/hdf-converters/data/converters/xml2json.ts @@ -12,7 +12,7 @@ export interface ICCIList { cci_items: { cci_item: { $: Record; - references: { + references?: { reference: { $: Record; }[]; @@ -40,7 +40,7 @@ if (!pathToInfile || !pathToOutfile) { converted.cci_list.cci_items[0].cci_item.forEach((cciItem) => { // Get the latest reference const newestReference = _.maxBy( - cciItem.references[0].reference, + cciItem.references?.[0].reference, (item) => _.get(item, '$.version') ); if (newestReference) { From a1c6c64e5febc5cb71356f8b2ced23a0b5f32102 Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 28 Oct 2024 12:25:53 -0400 Subject: [PATCH 003/107] Generate CCI definitions alongside CCI to NIST file Signed-off-by: Joyce Quach --- .../data/converters/xml2json.ts | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libs/hdf-converters/data/converters/xml2json.ts b/libs/hdf-converters/data/converters/xml2json.ts index 3f91501f0..6a21f3559 100644 --- a/libs/hdf-converters/data/converters/xml2json.ts +++ b/libs/hdf-converters/data/converters/xml2json.ts @@ -4,7 +4,8 @@ import xml2js from 'xml2js'; const parser = new xml2js.Parser(); const pathToInfile = process.argv[2]; -const pathToOutfile = process.argv[3]; +const pathToCci2NistOutfile = process.argv[3]; +const pathToCci2DefinitionsOutfile = process.argv[4]; // XML Structure after conversion export interface ICCIList { @@ -17,13 +18,14 @@ export interface ICCIList { $: Record; }[]; }[]; + definition: string[]; }[]; }[]; }; } -if (!pathToInfile || !pathToOutfile) { - console.error(`You must provide the path to both an input and output file.`); +if (!pathToInfile || !pathToCci2NistOutfile || !pathToCci2DefinitionsOutfile) { + console.error(`You must provide the path to the input and two output files.`); } else { fs.readFile(pathToInfile, function (readFileError, data) { if (readFileError) { @@ -34,9 +36,10 @@ if (!pathToInfile || !pathToOutfile) { if (parseFileError) { console.error(`Failed to parse ${pathToInfile}: ${parseFileError}`); } else { - // Stores our CCI->NIST mapping - const result: Record = {}; - // For all cci items + // These store our CCI->NIST names and definitions mappings + const nists: Record = {}; + const definitions: Record = {}; + // For all CCI items converted.cci_list.cci_items[0].cci_item.forEach((cciItem) => { // Get the latest reference const newestReference = _.maxBy( @@ -44,12 +47,17 @@ if (!pathToInfile || !pathToOutfile) { (item) => _.get(item, '$.version') ); if (newestReference) { - result[cciItem.$.id] = newestReference.$.index; + nists[cciItem.$.id] = newestReference.$.index; + definitions[cciItem.$.id] = cciItem.definition[0]; } else { console.error(`No NIST Controls found for ${cciItem.$.id}`); } }); - fs.writeFileSync(pathToOutfile, JSON.stringify(result)); + fs.writeFileSync(pathToCci2NistOutfile, JSON.stringify(nists)); + fs.writeFileSync( + pathToCci2DefinitionsOutfile, + JSON.stringify(definitions) + ); } }); } From 29844bbc2e5ffd1397887c246692be749314c43d Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 28 Oct 2024 13:01:22 -0400 Subject: [PATCH 004/107] Rename xml2json to cciListXml2json Signed-off-by: Joyce Quach --- .../data/converters/{xml2json.ts => cciListXml2json.ts} | 0 libs/hdf-converters/package.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename libs/hdf-converters/data/converters/{xml2json.ts => cciListXml2json.ts} (100%) diff --git a/libs/hdf-converters/data/converters/xml2json.ts b/libs/hdf-converters/data/converters/cciListXml2json.ts similarity index 100% rename from libs/hdf-converters/data/converters/xml2json.ts rename to libs/hdf-converters/data/converters/cciListXml2json.ts diff --git a/libs/hdf-converters/package.json b/libs/hdf-converters/package.json index 9c561c63a..6388d7265 100644 --- a/libs/hdf-converters/package.json +++ b/libs/hdf-converters/package.json @@ -22,7 +22,7 @@ "postpack:win32": "move package.json.orig package.json", "test": "jest", "csv2json": "tsx data/converters/csv2json.ts", - "xml2json": "tsx data/converters/xml2json.ts" + "cciListXml2json": "tsx data/converters/cciListXml2json.ts" }, "dependencies": { "@aws-sdk/client-config-service": "^3.95.0", From a8b7c67e0b4932555fc9178d3972be17124aa4e6 Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 28 Oct 2024 13:05:45 -0400 Subject: [PATCH 005/107] Update CciNistMappingData with converted content from U_CCI_List.xml Signed-off-by: Joyce Quach --- .../src/mappings/CciNistMappingData.ts | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libs/hdf-converters/src/mappings/CciNistMappingData.ts b/libs/hdf-converters/src/mappings/CciNistMappingData.ts index 105e8904b..8d37c0ff0 100644 --- a/libs/hdf-converters/src/mappings/CciNistMappingData.ts +++ b/libs/hdf-converters/src/mappings/CciNistMappingData.ts @@ -301,11 +301,11 @@ export const data = { 'CCI-000302': 'CM-2 (2)', 'CCI-000303': 'CM-2 (2)', 'CCI-000304': 'CM-2 (3)', - 'CCI-000305': 'CM-7 (2)', - 'CCI-000306': 'CM-7 (2)', + 'CCI-000305': 'CM-2 (4) (a)', + 'CCI-000306': 'CM-2 (4) (a)', 'CCI-000307': 'CM-2 (4) (b)', - 'CCI-000308': 'CM-7 (2)', - 'CCI-000309': 'CM-7 (2)', + 'CCI-000308': 'CM-2 (5) (a)', + 'CCI-000309': 'CM-2 (5) (a)', 'CCI-000310': 'CM-2 (5) (b)', 'CCI-000311': 'CM-2 (6)', 'CCI-000312': 'CM-2 (6)', @@ -1063,7 +1063,7 @@ export const data = { 'CCI-001072': 'RA-5 (9) (a)', 'CCI-001073': 'RA-5 (9) (b)', 'CCI-001074': 'SC-1 a 1', - 'CCI-001075': 'SC-1 a 1 ', + 'CCI-001075': 'SC-1 a 1', 'CCI-001076': 'SC-1 c 1', 'CCI-001077': 'SC-1 c 1', 'CCI-001078': 'SC-1 a 2', @@ -1136,7 +1136,7 @@ export const data = { 'CCI-001145': 'SC-13 (1)', 'CCI-001146': 'SC-13 (2)', 'CCI-001147': 'SC-13 (3)', - 'CCI-001148': 'AU-10 (5)', + 'CCI-001148': 'SC-13 (4)', 'CCI-001149': 'SC-14', 'CCI-001150': 'SC-15 a', 'CCI-001151': 'SC-15 a', @@ -1409,7 +1409,7 @@ export const data = { 'CCI-001425': 'AC-16 (2)', 'CCI-001426': 'AC-16 (3)', 'CCI-001427': 'AC-16 (4)', - 'CCI-001428': 'AC-16 (4)', + 'CCI-001428': 'AC-16 (5)', 'CCI-001429': 'AC-16 (5)', 'CCI-001430': 'AC-16 (5)', 'CCI-001431': 'AC-17 (5)', @@ -1475,8 +1475,8 @@ export const data = { 'CCI-001491': 'AU-6 (6)', 'CCI-001492': 'AU-8 (1) (a)', 'CCI-001493': 'AU-9 a', - 'CCI-001494': 'AU-9', - 'CCI-001495': 'AU-9', + 'CCI-001494': 'AU-9 a', + 'CCI-001495': 'AU-9 a', 'CCI-001496': 'AU-9 (3)', 'CCI-001497': 'CM-2 b 1', 'CCI-001498': 'CM-3 (1) (c)', @@ -2217,7 +2217,7 @@ export const data = { 'CCI-002263': 'AC-16 a', 'CCI-002264': 'AC-16 a', 'CCI-002265': 'AC-16 b', - 'CCI-002266': 'AC-16 b ', + 'CCI-002266': 'AC-16 b', 'CCI-002267': 'AC-16 c', 'CCI-002268': 'AC-16 c', 'CCI-002269': 'AC-16 c', @@ -2818,7 +2818,7 @@ export const data = { 'CCI-002864': 'MA-2 (2) (b)', 'CCI-002865': 'MA-2 (2) (b)', 'CCI-002866': 'MA-2 a', - 'CCI-002867': 'MA-2 a ', + 'CCI-002867': 'MA-2 a', 'CCI-002868': 'MA-2 a', 'CCI-002869': 'MA-2 a', 'CCI-002870': 'MA-2 a', @@ -3549,7 +3549,8 @@ export const data = { 'CCI-003595': 'UL-2 c', 'CCI-003596': 'UL-2 d', 'CCI-003597': 'UL-2 d', - 'CCI-003599': 'SC-37 (1)', + 'CCI-003598': 'TR-1 b', + 'CCI-003599': 'SC-37', 'CCI-003601': 'AC-1 a 1 (b)', 'CCI-003602': 'AC-1 a 1 (a)', 'CCI-003603': 'AC-1 a 1 (b)', @@ -5096,5 +5097,7 @@ export const data = { 'CCI-005144': 'SR-12', 'CCI-005145': 'SR-12', 'CCI-005146': 'SR-12', - 'CCI-005147': 'AT-2 a 1' + 'CCI-005147': 'AT-2 a 1', + 'CCI-005149': 'AU-16 (3)', + 'CCI-005150': 'PM-30 (1)' }; From dbd022980d3120737eb00255f1a66f45a2bea527 Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 28 Oct 2024 14:09:27 -0400 Subject: [PATCH 006/107] Update frontend component, CciNistMapping used in converters, delete cci_util.ts, and add NIST_DESCRIPTIONS array produced from cciListXml2json Signed-off-by: Joyce Quach --- .../cards/controltable/ControlRowHeader.vue | 9 +- apps/frontend/src/utilities/cci_util.ts | 14210 ---------------- .../src/mappings/CciNistMapping.ts | 6 +- .../src/mappings/CciNistMappingData.ts | 10012 ++++++++++- 4 files changed, 10020 insertions(+), 14217 deletions(-) delete mode 100644 apps/frontend/src/utilities/cci_util.ts diff --git a/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue b/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue index 29186cfc0..1e48dbd87 100644 --- a/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue +++ b/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue @@ -142,9 +142,12 @@