From 80b65aff7b530cf80be3a0fcae2c4a05393575b8 Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Wed, 18 Sep 2024 17:24:16 -0400 Subject: [PATCH] Modify fingerprints and update neuvector-mapper.ts --- apps/frontend/src/store/report_intake.ts | 6 ++--- .../neuvector-hdf-withraw.json | 26 ++----------------- .../neuvector_mapper/neuvector-hdf.json | 26 ++----------------- libs/hdf-converters/src/neuvector-mapper.ts | 10 ++++--- .../src/utils/fingerprinting.ts | 12 ++++----- 5 files changed, 20 insertions(+), 60 deletions(-) diff --git a/apps/frontend/src/store/report_intake.ts b/apps/frontend/src/store/report_intake.ts index 5a80864c0c..60cf51c6dd 100644 --- a/apps/frontend/src/store/report_intake.ts +++ b/apps/frontend/src/store/report_intake.ts @@ -33,7 +33,7 @@ import { TwistlockResults, VeracodeMapper, XCCDFResultsMapper, - ZapMapper, + ZapMapper } from '@mitre/hdf-converters'; import axios from 'axios'; import { @@ -284,8 +284,8 @@ export class InspecIntake extends VuexModule { return new TrufflehogResults(convertOptions.data).toHdf(); case INPUT_TYPES.GRYPE: return new AnchoreGrypeMapper(convertOptions.data).toHdf(); - case INPUT_TYPES.NEUVECTOR: - return new NeuvectorMapper(convertOptions.data).toHdf(); + case INPUT_TYPES.NEUVECTOR: + return new NeuvectorMapper(convertOptions.data).toHdf(); default: return SnackbarModule.failure( `Invalid file uploaded (${filename}), no fingerprints matched.` diff --git a/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf-withraw.json b/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf-withraw.json index 3420b66895..a7a0e51527 100644 --- a/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf-withraw.json +++ b/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf-withraw.json @@ -23,30 +23,8 @@ "depends": [], "groups": [], "status": "loaded", - "controls": [ - { - "key": "id", - "tags": {}, - "descriptions": [], - "refs": [], - "source_location": {}, - "title": null, - "id": "", - "desc": null, - "impact": 0, - "code": null, - "results": [ - { - "status": "failed", - "code_desc": "", - "message": null, - "run_time": null, - "start_time": "" - } - ] - } - ], - "sha256": "4ab404f54ac68e77cca22f638b4ab695f2788f31f3a27fecf510b5e4cbe6d9b2" + "controls": [], + "sha256": "56a6f4affb2c6c6d22bd258b4e3a99b16880e93b4a99b128a244f91068f5269c" } ], "passthrough": { diff --git a/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf.json b/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf.json index cb183706d7..8bbc26d5c2 100644 --- a/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf.json +++ b/libs/hdf-converters/sample_jsons/neuvector_mapper/neuvector-hdf.json @@ -23,30 +23,8 @@ "depends": [], "groups": [], "status": "loaded", - "controls": [ - { - "key": "id", - "tags": {}, - "descriptions": [], - "refs": [], - "source_location": {}, - "title": null, - "id": "", - "desc": null, - "impact": 0, - "code": null, - "results": [ - { - "status": "failed", - "code_desc": "", - "message": null, - "run_time": null, - "start_time": "" - } - ] - } - ], - "sha256": "4ab404f54ac68e77cca22f638b4ab695f2788f31f3a27fecf510b5e4cbe6d9b2" + "controls": [], + "sha256": "56a6f4affb2c6c6d22bd258b4e3a99b16880e93b4a99b128a244f91068f5269c" } ], "passthrough": { diff --git a/libs/hdf-converters/src/neuvector-mapper.ts b/libs/hdf-converters/src/neuvector-mapper.ts index 585dc94d94..13c421562d 100644 --- a/libs/hdf-converters/src/neuvector-mapper.ts +++ b/libs/hdf-converters/src/neuvector-mapper.ts @@ -41,14 +41,18 @@ export class NeuvectorMapper extends BaseConverter { status: 'loaded', //Insert data controls: [ { + path: 'report.Vulnerabilities', key: 'id', - tags: {}, //Insert data + tags: { + nist: ['RA-5', 'SA-10'], + cve: {path: 'name'} + }, //Insert data descriptions: [], //Insert data refs: [], //Insert data source_location: {}, //Insert data title: null, //Insert data - id: '', //Insert data - desc: null, //Insert data + id: {path: 'name'}, //Insert data + desc: {path: 'description'}, //Insert data impact: 0, //Insert data code: null, //Insert data results: [ diff --git a/libs/hdf-converters/src/utils/fingerprinting.ts b/libs/hdf-converters/src/utils/fingerprinting.ts index f077d2478e..9e9ae8c3af 100644 --- a/libs/hdf-converters/src/utils/fingerprinting.ts +++ b/libs/hdf-converters/src/utils/fingerprinting.ts @@ -53,11 +53,11 @@ const fileTypeFingerprints: Record = { [INPUT_TYPES.JFROG]: ['total_count', 'data'], [INPUT_TYPES.MSFT_SEC_SCORE]: ['secureScore', 'profiles'], [INPUT_TYPES.NEUVECTOR]: [ - 'verification_timestamp', - 'feed_rating', - 'cvedb_version', - 'cvedb_create_time', - 'signature_data' + 'report.signature_data', + 'report.signature_data.verification_timestamp', + 'report.vulnerabilities[0].feed_rating', + 'report.cvedb_version', + 'report.cvedb_create_time' ], [INPUT_TYPES.NIKTO]: ['banner', 'host', 'ip', 'port', 'vulnerabilities'], [INPUT_TYPES.SARIF]: ['$schema', 'version', 'runs'], @@ -94,7 +94,7 @@ const fileTypeFingerprints: Record = { [INPUT_TYPES.SCOUTSUITE]: [], [INPUT_TYPES.VERACODE]: [], [INPUT_TYPES.XCCDF]: [], - [INPUT_TYPES.NOT_FOUND]: [], + [INPUT_TYPES.NOT_FOUND]: [] }; export function fingerprint(guessOptions: {