@mitre/hdf-converters 2.7.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -20
- package/lib/data/converters/xml2json.js +25 -2
- package/lib/data/converters/xml2json.js.map +1 -1
- package/lib/data/converters/xml2json.ts +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +8 -5
- package/lib/src/asff-mapper/asff-mapper.js +94 -74
- package/lib/src/asff-mapper/asff-mapper.js.map +1 -1
- package/lib/src/asff-mapper/case-cms-inspec.js +29 -9
- package/lib/src/asff-mapper/case-cms-inspec.js.map +1 -1
- package/lib/src/asff-mapper/case-firewall-manager.js +25 -5
- package/lib/src/asff-mapper/case-firewall-manager.js.map +1 -1
- package/lib/src/asff-mapper/case-guardduty.js +24 -4
- package/lib/src/asff-mapper/case-guardduty.js.map +1 -1
- package/lib/src/asff-mapper/case-inspector.js +24 -4
- package/lib/src/asff-mapper/case-inspector.js.map +1 -1
- package/lib/src/asff-mapper/case-previously-hdf.js +81 -61
- package/lib/src/asff-mapper/case-previously-hdf.js.map +1 -1
- package/lib/src/asff-mapper/case-prowler.js +26 -6
- package/lib/src/asff-mapper/case-prowler.js.map +1 -1
- package/lib/src/asff-mapper/case-security-hub.js +44 -24
- package/lib/src/asff-mapper/case-security-hub.js.map +1 -1
- package/lib/src/asff-mapper/case-trivy.js +30 -10
- package/lib/src/asff-mapper/case-trivy.js.map +1 -1
- package/lib/src/aws-config-mapper.js +31 -8
- package/lib/src/aws-config-mapper.js.map +1 -1
- package/lib/src/base-converter.d.ts +4 -4
- package/lib/src/base-converter.js +35 -35
- package/lib/src/base-converter.js.map +1 -1
- package/lib/src/burpsuite-mapper.js +31 -11
- package/lib/src/burpsuite-mapper.js.map +1 -1
- package/lib/src/ckl-mapper/checklist-jsonix-converter.d.ts +5 -5
- package/lib/src/ckl-mapper/checklist-jsonix-converter.js +47 -27
- package/lib/src/ckl-mapper/checklist-jsonix-converter.js.map +1 -1
- package/lib/src/ckl-mapper/checklist-mapper.js +2 -5
- package/lib/src/ckl-mapper/checklist-mapper.js.map +1 -1
- package/lib/src/converters-from-hdf/asff/reverse-asff-mapper.d.ts +1 -1
- package/lib/src/converters-from-hdf/asff/reverse-asff-mapper.js +26 -6
- package/lib/src/converters-from-hdf/asff/reverse-asff-mapper.js.map +1 -1
- package/lib/src/converters-from-hdf/asff/transformers.d.ts +1 -1
- package/lib/src/converters-from-hdf/asff/transformers.js +42 -19
- package/lib/src/converters-from-hdf/asff/transformers.js.map +1 -1
- package/lib/src/converters-from-hdf/caat/reverse-caat-mapper.d.ts +31 -0
- package/lib/src/converters-from-hdf/caat/reverse-caat-mapper.js +200 -0
- package/lib/src/converters-from-hdf/caat/reverse-caat-mapper.js.map +1 -0
- package/lib/src/converters-from-hdf/html/html-types.d.ts +74 -0
- package/lib/src/converters-from-hdf/html/html-types.js +3 -0
- package/lib/src/converters-from-hdf/html/html-types.js.map +1 -0
- package/lib/src/converters-from-hdf/html/reverse-html-mapper.d.ts +39 -0
- package/lib/src/converters-from-hdf/html/reverse-html-mapper.js +374 -0
- package/lib/src/converters-from-hdf/html/reverse-html-mapper.js.map +1 -0
- package/lib/src/converters-from-hdf/reverse-any-base-converter.d.ts +1 -1
- package/lib/src/converters-from-hdf/reverse-any-base-converter.js.map +1 -1
- package/lib/src/converters-from-hdf/reverse-base-converter.d.ts +1 -1
- package/lib/src/converters-from-hdf/reverse-base-converter.js +29 -9
- package/lib/src/converters-from-hdf/reverse-base-converter.js.map +1 -1
- package/lib/src/converters-from-hdf/splunk/reverse-splunk-mapper.d.ts +1 -2
- package/lib/src/converters-from-hdf/splunk/reverse-splunk-mapper.js +29 -16
- package/lib/src/converters-from-hdf/splunk/reverse-splunk-mapper.js.map +1 -1
- package/lib/src/converters-from-hdf/xccdf/reverse-xccdf-mapper.js +25 -2
- package/lib/src/converters-from-hdf/xccdf/reverse-xccdf-mapper.js.map +1 -1
- package/lib/src/conveyor-mapper.js +58 -36
- package/lib/src/conveyor-mapper.js.map +1 -1
- package/lib/src/dbprotect-mapper.js +36 -16
- package/lib/src/dbprotect-mapper.js.map +1 -1
- package/lib/src/fortify-mapper.js +50 -30
- package/lib/src/fortify-mapper.js.map +1 -1
- package/lib/src/gosec-mapper.js +26 -6
- package/lib/src/gosec-mapper.js.map +1 -1
- package/lib/src/ionchannel-mapper.js +28 -5
- package/lib/src/ionchannel-mapper.js.map +1 -1
- package/lib/src/jfrog-xray-mapper.js +41 -21
- package/lib/src/jfrog-xray-mapper.js.map +1 -1
- package/lib/src/mappings/AwsConfigMapping.js +24 -4
- package/lib/src/mappings/AwsConfigMapping.js.map +1 -1
- package/lib/src/nessus-mapper.js +70 -50
- package/lib/src/nessus-mapper.js.map +1 -1
- package/lib/src/netsparker-mapper.js +56 -36
- package/lib/src/netsparker-mapper.js.map +1 -1
- package/lib/src/nikto-mapper.js +26 -6
- package/lib/src/nikto-mapper.js.map +1 -1
- package/lib/src/prisma-mapper.d.ts +1 -1
- package/lib/src/prisma-mapper.js +28 -8
- package/lib/src/prisma-mapper.js.map +1 -1
- package/lib/src/sarif-mapper.js +32 -12
- package/lib/src/sarif-mapper.js.map +1 -1
- package/lib/src/scoutsuite-mapper.js +39 -19
- package/lib/src/scoutsuite-mapper.js.map +1 -1
- package/lib/src/snyk-mapper.js +27 -7
- package/lib/src/snyk-mapper.js.map +1 -1
- package/lib/src/sonarqube-mapper.d.ts +2 -2
- package/lib/src/splunk-mapper.d.ts +4 -4
- package/lib/src/splunk-mapper.js +29 -6
- package/lib/src/splunk-mapper.js.map +1 -1
- package/lib/src/twistlock-mapper.js +43 -23
- package/lib/src/twistlock-mapper.js.map +1 -1
- package/lib/src/utils/attestations.d.ts +1 -1
- package/lib/src/utils/attestations.js +31 -8
- package/lib/src/utils/attestations.js.map +1 -1
- package/lib/src/utils/compliance.d.ts +3 -0
- package/lib/src/utils/compliance.js +27 -0
- package/lib/src/utils/compliance.js.map +1 -0
- package/lib/src/utils/fingerprinting.js +27 -7
- package/lib/src/utils/fingerprinting.js.map +1 -1
- package/lib/src/utils/global.d.ts +2 -1
- package/lib/src/utils/global.js +35 -5
- package/lib/src/utils/global.js.map +1 -1
- package/lib/src/utils/splunk-tools.js +26 -3
- package/lib/src/utils/splunk-tools.js.map +1 -1
- package/lib/src/veracode-mapper.js +105 -85
- package/lib/src/veracode-mapper.js.map +1 -1
- package/lib/src/xccdf-results-mapper.js +69 -49
- package/lib/src/xccdf-results-mapper.js.map +1 -1
- package/lib/src/zap-mapper.js +39 -19
- package/lib/src/zap-mapper.js.map +1 -1
- package/lib/types/splunk-config-types.d.ts +1 -1
- package/lib/types/splunk-control-types.d.ts +4 -4
- package/lib/types/splunk-profile-types.d.ts +6 -6
- package/lib/types/splunk-report-types.d.ts +3 -3
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -2,31 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
"[Heimdall Data Format (HDF)](https://saf.mitre.org/#/normalize)" is our common data exchange format to preserve and transform security data.
|
|
4
4
|
|
|
5
|
-
HDF Converters supplies several methods to convert various types of security tool data to and from
|
|
5
|
+
HDF Converters supplies several methods to convert various types of security tool data to and from the HDF standard. HDF Converters can be used in a variety of tools, and is currently well integrated with Heimdall itself, and the [SAF CLI](https://github.com/mitre/saf).
|
|
6
6
|
|
|
7
7
|
## Supported Formats
|
|
8
8
|
1. [**asff-mapper**] - AWS Security Finding Format JSON file, Prowler-derived AWS Security Finding Format results from concatenated JSON blobs, and Trivy-derived AWS Security Finding Format results from concatenated JSON blobs
|
|
9
9
|
2. [**aws-config-mapper**] - AWS Config
|
|
10
10
|
3. [**burpsuite-mapper**] - BurpSuite Pro XML file
|
|
11
|
-
4. [**
|
|
12
|
-
5. [**
|
|
13
|
-
6. [**
|
|
14
|
-
7. [**
|
|
15
|
-
8. [**
|
|
16
|
-
9. [**
|
|
17
|
-
10. [**
|
|
18
|
-
11. [**
|
|
19
|
-
12. [**
|
|
20
|
-
13. [**
|
|
21
|
-
14. [**
|
|
22
|
-
15. [**
|
|
23
|
-
16. [**
|
|
24
|
-
17. [**
|
|
25
|
-
18. [**
|
|
26
|
-
19. [**
|
|
27
|
-
20. [**
|
|
28
|
-
21. [**
|
|
29
|
-
22. [**
|
|
11
|
+
4. [**caat-mapper**] - Compliance Assessment and Audit Tracking (CAAT) file
|
|
12
|
+
5. [**checklist-mapper**] - Checlist Mapper format
|
|
13
|
+
6. [**conveyor-mapper**] - Conveyor JSON file
|
|
14
|
+
7. [**dbprotect-mapper**] - DBProtect report in "Check Results Details" XML format
|
|
15
|
+
8. [**fortify-mapper**] - Fortify results FVDL file
|
|
16
|
+
9. [**ionchannel-mapper**] - SBOM data from Ion Channel
|
|
17
|
+
10. [**jfrog-xray-mapper**] - JFrog Xray results JSON file
|
|
18
|
+
11. [**nessus-mapper**] - Nessus XML results file
|
|
19
|
+
12. [**netsparker-mapper**] - Netsparker XML results file
|
|
20
|
+
13. [**nikto-mapper**] - Nikto results JSON file
|
|
21
|
+
14. [**prisma-mapper**] - Prisma Cloud Scan Report CSV file
|
|
22
|
+
15. [**sarif-mapper**] - SARIF JSON file
|
|
23
|
+
16. [**scoutsuite-mapper**] - ScoutSuite results from a Javascript object
|
|
24
|
+
17. [**snyk-mapper**] - Snyk results JSON file
|
|
25
|
+
18. [**sonarqube-mapper**] - SonarQube vulnerabilities for the specified project name and optional branch or pull/merge request ID name from an API
|
|
26
|
+
19. [**splunk-mapper**] - Splunk instance
|
|
27
|
+
20. [**twistlock-mapper**] - Twistlock CLI output file
|
|
28
|
+
21. [**veracode-mapper**] - Veracode Scan Results XML file
|
|
29
|
+
22. [**xccdf-results-mapper**] - SCAP client XCCDF-Results XML report
|
|
30
|
+
23. [**zap-mapper**] - OWASP ZAP results JSON
|
|
30
31
|
|
|
31
32
|
### NOTICE
|
|
32
33
|
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const
|
|
30
|
+
const _ = __importStar(require("lodash"));
|
|
8
31
|
const xml2js_1 = __importDefault(require("xml2js"));
|
|
9
32
|
const parser = new xml2js_1.default.Parser();
|
|
10
33
|
const pathToInfile = process.argv[2];
|
|
@@ -25,7 +48,7 @@ else {
|
|
|
25
48
|
else {
|
|
26
49
|
const result = {};
|
|
27
50
|
converted.cci_list.cci_items[0].cci_item.forEach((cciItem) => {
|
|
28
|
-
const newestReference =
|
|
51
|
+
const newestReference = _.maxBy(cciItem.references[0].reference, (item) => _.get(item, '$.version'));
|
|
29
52
|
if (newestReference) {
|
|
30
53
|
result[cciItem.$.id] = newestReference.$.index;
|
|
31
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml2json.js","sourceRoot":"","sources":["../../../data/converters/xml2json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xml2json.js","sourceRoot":"","sources":["../../../data/converters/xml2json.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,0CAA4B;AAC5B,oDAA4B;AAE5B,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,MAAM,EAAE,CAAC;AACnC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACrC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAkBtC,IAAI,CAAC,YAAY,IAAI,CAAC,aAAa,EAAE;IACnC,OAAO,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;CAC7E;KAAM;IACL,YAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,aAAa,EAAE,IAAI;QACrD,IAAI,aAAa,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,kBAAkB,YAAY,KAAK,aAAa,EAAE,CAAC,CAAC;SACnE;aAAM;YAEL,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,cAAmB,EAAE,SAAmB,EAAE,EAAE;gBACpE,IAAI,cAAc,EAAE;oBAClB,OAAO,CAAC,KAAK,CAAC,mBAAmB,YAAY,KAAK,cAAc,EAAE,CAAC,CAAC;iBACrE;qBAAM;oBAEL,MAAM,MAAM,GAA2B,EAAE,CAAC;oBAE1C,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;wBAE3D,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAC7B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAC/B,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CACnC,CAAC;wBACF,IAAI,eAAe,EAAE;4BACnB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;yBAChD;6BAAM;4BACL,OAAO,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;yBAC7D;oBACH,CAAC,CAAC,CAAC;oBACH,YAAE,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;iBACzD;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;CACJ"}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './src/aws-config-mapper';
|
|
|
3
3
|
export * from './src/burpsuite-mapper';
|
|
4
4
|
export * from './src/ckl-mapper/checklist-mapper';
|
|
5
5
|
export * from './src/converters-from-hdf/asff/reverse-asff-mapper';
|
|
6
|
+
export * from './src/converters-from-hdf/caat/reverse-caat-mapper';
|
|
7
|
+
export * from './src/converters-from-hdf/html/reverse-html-mapper';
|
|
6
8
|
export * from './src/converters-from-hdf/splunk/reverse-splunk-mapper';
|
|
7
9
|
export * from './src/converters-from-hdf/xccdf/reverse-xccdf-mapper';
|
|
8
10
|
export * from './src/conveyor-mapper';
|
|
@@ -30,6 +32,7 @@ export * from './src/sonarqube-mapper';
|
|
|
30
32
|
export * from './src/splunk-mapper';
|
|
31
33
|
export * from './src/twistlock-mapper';
|
|
32
34
|
export * from './src/utils/attestations';
|
|
35
|
+
export * from './src/utils/compliance';
|
|
33
36
|
export * from './src/utils/fingerprinting';
|
|
34
37
|
export * from './src/veracode-mapper';
|
|
35
38
|
export * from './src/xccdf-results-mapper';
|
package/lib/index.js
CHANGED
|
@@ -33,6 +33,8 @@ __exportStar(require("./src/aws-config-mapper"), exports);
|
|
|
33
33
|
__exportStar(require("./src/burpsuite-mapper"), exports);
|
|
34
34
|
__exportStar(require("./src/ckl-mapper/checklist-mapper"), exports);
|
|
35
35
|
__exportStar(require("./src/converters-from-hdf/asff/reverse-asff-mapper"), exports);
|
|
36
|
+
__exportStar(require("./src/converters-from-hdf/caat/reverse-caat-mapper"), exports);
|
|
37
|
+
__exportStar(require("./src/converters-from-hdf/html/reverse-html-mapper"), exports);
|
|
36
38
|
__exportStar(require("./src/converters-from-hdf/splunk/reverse-splunk-mapper"), exports);
|
|
37
39
|
__exportStar(require("./src/converters-from-hdf/xccdf/reverse-xccdf-mapper"), exports);
|
|
38
40
|
__exportStar(require("./src/conveyor-mapper"), exports);
|
|
@@ -60,6 +62,7 @@ __exportStar(require("./src/sonarqube-mapper"), exports);
|
|
|
60
62
|
__exportStar(require("./src/splunk-mapper"), exports);
|
|
61
63
|
__exportStar(require("./src/twistlock-mapper"), exports);
|
|
62
64
|
__exportStar(require("./src/utils/attestations"), exports);
|
|
65
|
+
__exportStar(require("./src/utils/compliance"), exports);
|
|
63
66
|
__exportStar(require("./src/utils/fingerprinting"), exports);
|
|
64
67
|
__exportStar(require("./src/veracode-mapper"), exports);
|
|
65
68
|
__exportStar(require("./src/xccdf-results-mapper"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0D;AAAlD,0GAAA,WAAW,OAAA;AACnB,0DAAwC;AACxC,yDAAuC;AACvC,oEAAkD;AAClD,qFAAmE;AACnE,yFAAuE;AACvE,uFAAqE;AACrE,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC;AACnC,0DAAwC;AACxC,0DAAwC;AACxC,4FAA4E;AAC5E,wFAAwE;AACxE,wFAAwE;AACxE,0GAA0F;AAC1F,4FAA4E;AAC5E,wFAAwE;AACxE,4FAA4E;AAC5E,sGAAsF;AACtF,sDAAoC;AACpC,0DAAwC;AACxC,qDAAmC;AACnC,sDAAoC;AACpC,qDAAmC;AACnC,0DAAwC;AACxC,oDAAkC;AAClC,yDAAuC;AACvC,sDAAoC;AACpC,yDAAuC;AACvC,2DAAyC;AACzC,6DAA2C;AAC3C,wDAAsC;AACtC,6DAA2C;AAC3C,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0D;AAAlD,0GAAA,WAAW,OAAA;AACnB,0DAAwC;AACxC,yDAAuC;AACvC,oEAAkD;AAClD,qFAAmE;AACnE,qFAAmE;AACnE,qFAAmE;AACnE,yFAAuE;AACvE,uFAAqE;AACrE,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC;AACnC,0DAAwC;AACxC,0DAAwC;AACxC,4FAA4E;AAC5E,wFAAwE;AACxE,wFAAwE;AACxE,0GAA0F;AAC1F,4FAA4E;AAC5E,wFAAwE;AACxE,4FAA4E;AAC5E,sGAAsF;AACtF,sDAAoC;AACpC,0DAAwC;AACxC,qDAAmC;AACnC,sDAAoC;AACpC,qDAAmC;AACnC,0DAAwC;AACxC,oDAAkC;AAClC,yDAAuC;AACvC,sDAAoC;AACpC,yDAAuC;AACvC,2DAAyC;AACzC,yDAAuC;AACvC,6DAA2C;AAC3C,wDAAsC;AACtC,6DAA2C;AAC3C,mDAAiC"}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mitre/hdf-converters",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Converter util library used to transform various scan results into HDF format",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@aws-sdk/client-config-service": "^3.95.0",
|
|
29
|
-
"@
|
|
29
|
+
"@e965/xlsx": "^0.20.0",
|
|
30
|
+
"@mdi/js": "^7.0.96",
|
|
31
|
+
"@mitre/jsonix": "^3.0.7",
|
|
30
32
|
"@types/csv2json": "^1.4.2",
|
|
31
33
|
"@types/ms": "^0.7.31",
|
|
32
34
|
"@types/mustache": "^4.1.2",
|
|
@@ -40,15 +42,16 @@
|
|
|
40
42
|
"fast-xml-parser": "^4.2.0",
|
|
41
43
|
"html-entities": "^2.3.2",
|
|
42
44
|
"htmlparser2": "^6.1.0",
|
|
43
|
-
"inspecjs": "^2.
|
|
45
|
+
"inspecjs": "^2.8.1",
|
|
44
46
|
"lodash": "^4.17.21",
|
|
45
47
|
"moment": "^2.29.1",
|
|
46
48
|
"ms": "^2.1.3",
|
|
47
49
|
"mustache": "^4.2.0",
|
|
48
50
|
"papaparse": "^5.3.1",
|
|
49
51
|
"run-script-os": "^1.1.6",
|
|
52
|
+
"tailwindcss": "^3.3.3",
|
|
53
|
+
"tw-elements": "^1.0.0-beta2",
|
|
50
54
|
"winston": "^3.6.0",
|
|
51
|
-
"xlsx": "^0.18.5",
|
|
52
55
|
"xml2js": "^0.6.0",
|
|
53
56
|
"yaml": "^2.1.1"
|
|
54
57
|
},
|
|
@@ -60,7 +63,7 @@
|
|
|
60
63
|
"quicktype": "^15.0.260",
|
|
61
64
|
"ts-jest": "^29.1.0",
|
|
62
65
|
"ts-node": "^10.0.0",
|
|
63
|
-
"typedoc": "^0.
|
|
66
|
+
"typedoc": "^0.25.0"
|
|
64
67
|
},
|
|
65
68
|
"jest": {
|
|
66
69
|
"moduleNameMapper": {
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.ASFFResults = exports.ASFFMapper = exports.consolidate = exports.SpecialCasing = void 0;
|
|
7
27
|
const compare_versions_1 = require("compare-versions");
|
|
8
28
|
const html_entities_1 = require("html-entities");
|
|
9
29
|
const inspecjs_1 = require("inspecjs");
|
|
10
|
-
const
|
|
30
|
+
const _ = __importStar(require("lodash"));
|
|
11
31
|
const package_json_1 = require("../../package.json");
|
|
12
32
|
const base_converter_1 = require("../base-converter");
|
|
13
33
|
const global_1 = require("../utils/global");
|
|
@@ -41,9 +61,9 @@ var SpecialCasing;
|
|
|
41
61
|
SpecialCasing["Default"] = "Default";
|
|
42
62
|
})(SpecialCasing = exports.SpecialCasing || (exports.SpecialCasing = {}));
|
|
43
63
|
function whichSpecialCase(finding) {
|
|
44
|
-
const productArn =
|
|
45
|
-
if (
|
|
46
|
-
|
|
64
|
+
const productArn = _.get(finding, 'ProductArn');
|
|
65
|
+
if (_.get(finding, 'ProductName') === 'Default' &&
|
|
66
|
+
_.get(finding, 'GeneratorId') === 'cms.Chef Inspec') {
|
|
47
67
|
return SpecialCasing.CMSInSpec;
|
|
48
68
|
}
|
|
49
69
|
else if (productArn.match(/^arn:[^:]+:securityhub:[^:]+:[^:]*:product\/aws\/firewall-manager$/)) {
|
|
@@ -52,9 +72,9 @@ function whichSpecialCase(finding) {
|
|
|
52
72
|
else if (productArn.match(/^arn:[^:]+:securityhub:[^:]+:[^:]*:product\/aws\/guardduty$/)) {
|
|
53
73
|
return SpecialCasing.GuardDuty;
|
|
54
74
|
}
|
|
55
|
-
else if (
|
|
75
|
+
else if (_.some(_.get(finding, 'FindingProviderFields.Types'), (type) => {
|
|
56
76
|
var _a, _b;
|
|
57
|
-
if (!
|
|
77
|
+
if (!_.startsWith(type, 'MITRE/SAF/')) {
|
|
58
78
|
return false;
|
|
59
79
|
}
|
|
60
80
|
const version = (_b = (_a = type.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('-')[0]) !== null && _b !== void 0 ? _b : '';
|
|
@@ -91,12 +111,12 @@ const SPECIAL_CASE_MAPPING = new Map([
|
|
|
91
111
|
function externalProductHandler(context, product, data, func, defaultVal) {
|
|
92
112
|
var _a;
|
|
93
113
|
if (product !== SpecialCasing.Default &&
|
|
94
|
-
|
|
114
|
+
_.has(SPECIAL_CASE_MAPPING.get(product), func)) {
|
|
95
115
|
let keywords = {};
|
|
96
116
|
if (context.supportingDocs.has(product)) {
|
|
97
117
|
keywords = { ...context.supportingDocs.get(product) };
|
|
98
118
|
}
|
|
99
|
-
return (_a =
|
|
119
|
+
return (_a = _.get(SPECIAL_CASE_MAPPING.get(product), func)) === null || _a === void 0 ? void 0 : _a.apply(context, [
|
|
100
120
|
data,
|
|
101
121
|
keywords
|
|
102
122
|
]);
|
|
@@ -114,7 +134,7 @@ function handleIdGroup(context, idGroup) {
|
|
|
114
134
|
const [id, data] = idGroup;
|
|
115
135
|
const group = data.map((d) => d[0]);
|
|
116
136
|
const findings = data.map((d) => d[1]);
|
|
117
|
-
const productInfo =
|
|
137
|
+
const productInfo = _.get(findings[0], 'ProductArn')
|
|
118
138
|
.split(':')
|
|
119
139
|
.slice(-1)[0]
|
|
120
140
|
.split('/');
|
|
@@ -123,19 +143,19 @@ function handleIdGroup(context, idGroup) {
|
|
|
123
143
|
const waiverData = externalProductHandler(context, whichSpecialCase(findings[0]), group, 'waiverData', {});
|
|
124
144
|
return {
|
|
125
145
|
id: id,
|
|
126
|
-
title: `${titlePrefix}${
|
|
127
|
-
tags:
|
|
146
|
+
title: `${titlePrefix}${_.uniq(group.map((d) => d.title)).join(';')}`,
|
|
147
|
+
tags: _.mergeWith({}, ...group.map((d) => d.tags), (acc, cur) => {
|
|
128
148
|
if (acc === undefined || cur === undefined) {
|
|
129
149
|
return acc || cur;
|
|
130
150
|
}
|
|
131
151
|
else {
|
|
132
152
|
return Array.isArray(acc) || Array.isArray(cur)
|
|
133
|
-
?
|
|
153
|
+
? _.uniq(_.concat([], acc, cur))
|
|
134
154
|
: acc;
|
|
135
155
|
}
|
|
136
156
|
}),
|
|
137
157
|
impact: Math.max(...group.map((d) => d.impact)),
|
|
138
|
-
desc: externalProductHandler(context, whichSpecialCase(findings[0]), group, 'desc',
|
|
158
|
+
desc: externalProductHandler(context, whichSpecialCase(findings[0]), group, 'desc', _.uniq(group.map((d) => d.desc)).join('\n')),
|
|
139
159
|
descriptions: group
|
|
140
160
|
.map((d) => d.descriptions)
|
|
141
161
|
.flat()
|
|
@@ -146,9 +166,9 @@ function handleIdGroup(context, idGroup) {
|
|
|
146
166
|
refs: group
|
|
147
167
|
.map((d) => d.refs)
|
|
148
168
|
.flat()
|
|
149
|
-
.filter((element) =>
|
|
169
|
+
.filter((element) => _.get(element, 'url') !== undefined),
|
|
150
170
|
source_location: (() => {
|
|
151
|
-
const locs =
|
|
171
|
+
const locs = _.uniq(group.map((d) => d.source_location)).filter((loc) => Object.keys(loc || {}).length !== 0);
|
|
152
172
|
if (locs.length === 0) {
|
|
153
173
|
return {};
|
|
154
174
|
}
|
|
@@ -167,19 +187,19 @@ function handleIdGroup(context, idGroup) {
|
|
|
167
187
|
};
|
|
168
188
|
}
|
|
169
189
|
function consolidate(context, input, file) {
|
|
170
|
-
const allFindings =
|
|
190
|
+
const allFindings = _.get(file, 'Findings');
|
|
171
191
|
if (input.length !== allFindings.length) {
|
|
172
192
|
throw new Error('The number of generated controls should be the same as the number of findings while consolidating.');
|
|
173
193
|
}
|
|
174
|
-
const idGroups =
|
|
194
|
+
const idGroups = _.groupBy(_.zip(input, allFindings), (value) => {
|
|
175
195
|
const [hdfControl, asffFinding] = value;
|
|
176
|
-
return externalProductHandler(context, whichSpecialCase(asffFinding), asffFinding, 'subfindingsId',
|
|
196
|
+
return externalProductHandler(context, whichSpecialCase(asffFinding), asffFinding, 'subfindingsId', _.get(hdfControl, 'id'));
|
|
177
197
|
});
|
|
178
198
|
return Object.entries(idGroups || {}).map((idGroup) => handleIdGroup(context, idGroup));
|
|
179
199
|
}
|
|
180
200
|
exports.consolidate = consolidate;
|
|
181
201
|
function wrapWithFindingsObject(output) {
|
|
182
|
-
if (!
|
|
202
|
+
if (!_.has(output, 'Findings')) {
|
|
183
203
|
if (Array.isArray(output)) {
|
|
184
204
|
output = { Findings: output };
|
|
185
205
|
}
|
|
@@ -204,6 +224,25 @@ function fixFileInput(asffJson) {
|
|
|
204
224
|
return wrapWithFindingsObject(output);
|
|
205
225
|
}
|
|
206
226
|
class ASFFMapper extends base_converter_1.BaseConverter {
|
|
227
|
+
statusReason(finding) {
|
|
228
|
+
const statusReasons = _.get(finding, 'Compliance.StatusReasons');
|
|
229
|
+
if (statusReasons !== undefined &&
|
|
230
|
+
statusReasons !== null &&
|
|
231
|
+
_.isArray(statusReasons)) {
|
|
232
|
+
return statusReasons
|
|
233
|
+
.map((reason) => Object.entries(reason || {}).map(([key, value]) => {
|
|
234
|
+
return `${(0, html_entities_1.encode)(key)}: ${(0, html_entities_1.encode)(value)}`;
|
|
235
|
+
}))
|
|
236
|
+
.flat()
|
|
237
|
+
.join('\n');
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
setMappings() {
|
|
244
|
+
this.mappings = externalProductHandler(this, whichSpecialCase(_.get(this.data, 'Findings[0]')), this, 'mapping', this.defaultMappings);
|
|
245
|
+
}
|
|
207
246
|
constructor(asff, supportingDocs, meta = undefined) {
|
|
208
247
|
super(asff);
|
|
209
248
|
this.defaultMappings = {
|
|
@@ -212,12 +251,12 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
212
251
|
release: package_json_1.version,
|
|
213
252
|
target_id: {
|
|
214
253
|
transformer: (record) => {
|
|
215
|
-
const productInfo =
|
|
254
|
+
const productInfo = _.get(record, 'Findings[0].ProductArn')
|
|
216
255
|
.split(':')
|
|
217
256
|
.slice(-1)[0]
|
|
218
257
|
.split('/');
|
|
219
258
|
const defaultTargetId = `${productInfo[1]} - ${productInfo[2]}`;
|
|
220
|
-
return externalProductHandler(this, whichSpecialCase(
|
|
259
|
+
return externalProductHandler(this, whichSpecialCase(_.get(record, 'Findings[0]')), [_.get(record, 'Findings[0]'), record.Findings], 'productName', (0, html_entities_1.encode)(defaultTargetId));
|
|
221
260
|
}
|
|
222
261
|
}
|
|
223
262
|
},
|
|
@@ -236,7 +275,7 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
236
275
|
version: '',
|
|
237
276
|
title: {
|
|
238
277
|
transformer: () => {
|
|
239
|
-
return
|
|
278
|
+
return _.get(this.meta, 'title') || 'ASFF Findings';
|
|
240
279
|
}
|
|
241
280
|
},
|
|
242
281
|
maintainer: null,
|
|
@@ -255,24 +294,24 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
255
294
|
key: 'id',
|
|
256
295
|
arrayTransformer: consolidate.bind(this, this),
|
|
257
296
|
id: {
|
|
258
|
-
transformer: (finding) => externalProductHandler(this, whichSpecialCase(finding), finding, 'findingId', (0, html_entities_1.encode)(
|
|
297
|
+
transformer: (finding) => externalProductHandler(this, whichSpecialCase(finding), finding, 'findingId', (0, html_entities_1.encode)(_.get(finding, 'GeneratorId')))
|
|
259
298
|
},
|
|
260
299
|
title: {
|
|
261
|
-
transformer: (finding) => externalProductHandler(this, whichSpecialCase(finding), finding, 'findingTitle', (0, html_entities_1.encode)(
|
|
300
|
+
transformer: (finding) => externalProductHandler(this, whichSpecialCase(finding), finding, 'findingTitle', (0, html_entities_1.encode)(_.get(finding, 'Title')))
|
|
262
301
|
},
|
|
263
302
|
desc: {
|
|
264
|
-
transformer: (finding) => externalProductHandler(this, whichSpecialCase(finding), finding, 'findingDescription', (0, html_entities_1.encode)(
|
|
303
|
+
transformer: (finding) => externalProductHandler(this, whichSpecialCase(finding), finding, 'findingDescription', (0, html_entities_1.encode)(_.get(finding, 'Description')))
|
|
265
304
|
},
|
|
266
305
|
impact: {
|
|
267
306
|
transformer: (finding) => {
|
|
268
307
|
let impact;
|
|
269
|
-
if (
|
|
308
|
+
if (_.get(finding, 'Workflow.Status') === 'SUPPRESSED') {
|
|
270
309
|
impact = 'INFORMATIONAL';
|
|
271
310
|
}
|
|
272
311
|
else {
|
|
273
|
-
const defaultFunc = () =>
|
|
274
|
-
?
|
|
275
|
-
:
|
|
312
|
+
const defaultFunc = () => _.get(finding, SEVERITY_LABEL)
|
|
313
|
+
? _.get(finding, SEVERITY_LABEL)
|
|
314
|
+
: _.get(finding, 'Severity.Normalized') /
|
|
276
315
|
100.0;
|
|
277
316
|
impact = externalProductHandler(this, whichSpecialCase(finding), finding, 'findingImpact', defaultFunc);
|
|
278
317
|
}
|
|
@@ -312,11 +351,11 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
312
351
|
path: 'Remediation.Recommendation',
|
|
313
352
|
transformer: (input) => {
|
|
314
353
|
const data = [];
|
|
315
|
-
if (
|
|
316
|
-
data.push(
|
|
354
|
+
if (_.has(input, 'Text')) {
|
|
355
|
+
data.push(_.get(input, 'Text'));
|
|
317
356
|
}
|
|
318
|
-
if (
|
|
319
|
-
data.push(
|
|
357
|
+
if (_.has(input, 'Url')) {
|
|
358
|
+
data.push(_.get(input, 'Url'));
|
|
320
359
|
}
|
|
321
360
|
return data.join('\n');
|
|
322
361
|
}
|
|
@@ -328,8 +367,8 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
328
367
|
{
|
|
329
368
|
transformer: (finding) => {
|
|
330
369
|
return {
|
|
331
|
-
...(
|
|
332
|
-
url:
|
|
370
|
+
...(_.has(finding, 'SourceUrl') && {
|
|
371
|
+
url: _.get(finding, 'SourceUrl')
|
|
333
372
|
})
|
|
334
373
|
};
|
|
335
374
|
}
|
|
@@ -342,8 +381,8 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
342
381
|
status: {
|
|
343
382
|
transformer: (finding) => {
|
|
344
383
|
const defaultFunc = () => {
|
|
345
|
-
if (
|
|
346
|
-
switch (
|
|
384
|
+
if (_.has(finding, COMPLIANCE_STATUS)) {
|
|
385
|
+
switch (_.get(finding, COMPLIANCE_STATUS)) {
|
|
347
386
|
case 'PASSED':
|
|
348
387
|
return inspecjs_1.ExecJSON.ControlResultStatus.Passed;
|
|
349
388
|
case 'WARNING':
|
|
@@ -369,14 +408,14 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
369
408
|
if (output) {
|
|
370
409
|
output += '; ';
|
|
371
410
|
}
|
|
372
|
-
const resources =
|
|
411
|
+
const resources = _.get(finding, 'Resources')
|
|
373
412
|
.map((resource) => {
|
|
374
|
-
let hash = `Type: ${(0, html_entities_1.encode)(
|
|
375
|
-
if (
|
|
376
|
-
hash += `, Partition: ${(0, html_entities_1.encode)(
|
|
413
|
+
let hash = `Type: ${(0, html_entities_1.encode)(_.get(resource, 'Type'))}, Id: ${(0, html_entities_1.encode)(_.get(resource, 'Id'))}`;
|
|
414
|
+
if (_.has(resource, 'Partition')) {
|
|
415
|
+
hash += `, Partition: ${(0, html_entities_1.encode)(_.get(resource, 'Partition'))}`;
|
|
377
416
|
}
|
|
378
|
-
if (
|
|
379
|
-
hash += `, Region: ${(0, html_entities_1.encode)(
|
|
417
|
+
if (_.has(resource, 'Region')) {
|
|
418
|
+
hash += `, Region: ${(0, html_entities_1.encode)(_.get(resource, 'Region'))}`;
|
|
380
419
|
}
|
|
381
420
|
return hash;
|
|
382
421
|
})
|
|
@@ -389,7 +428,7 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
389
428
|
const message = (() => {
|
|
390
429
|
const defaultFunc = () => {
|
|
391
430
|
const statusReason = this.statusReason(finding);
|
|
392
|
-
switch (
|
|
431
|
+
switch (_.get(finding, COMPLIANCE_STATUS)) {
|
|
393
432
|
case undefined:
|
|
394
433
|
return undefined;
|
|
395
434
|
case 'PASSED':
|
|
@@ -408,7 +447,7 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
408
447
|
})();
|
|
409
448
|
const skipMessage = (() => {
|
|
410
449
|
const statusReason = this.statusReason(finding);
|
|
411
|
-
switch (
|
|
450
|
+
switch (_.get(finding, COMPLIANCE_STATUS)) {
|
|
412
451
|
case undefined:
|
|
413
452
|
return statusReason;
|
|
414
453
|
case 'PASSED':
|
|
@@ -431,8 +470,8 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
431
470
|
};
|
|
432
471
|
},
|
|
433
472
|
start_time: {
|
|
434
|
-
transformer: (finding) =>
|
|
435
|
-
|
|
473
|
+
transformer: (finding) => _.get(finding, 'LastObservedAt') ||
|
|
474
|
+
_.get(finding, 'UpdatedAt')
|
|
436
475
|
}
|
|
437
476
|
}
|
|
438
477
|
]
|
|
@@ -446,37 +485,18 @@ class ASFFMapper extends base_converter_1.BaseConverter {
|
|
|
446
485
|
this.supportingDocs = supportingDocs;
|
|
447
486
|
this.setMappings();
|
|
448
487
|
}
|
|
449
|
-
statusReason(finding) {
|
|
450
|
-
const statusReasons = lodash_1.default.get(finding, 'Compliance.StatusReasons');
|
|
451
|
-
if (statusReasons !== undefined &&
|
|
452
|
-
statusReasons !== null &&
|
|
453
|
-
lodash_1.default.isArray(statusReasons)) {
|
|
454
|
-
return statusReasons
|
|
455
|
-
.map((reason) => Object.entries(reason || {}).map(([key, value]) => {
|
|
456
|
-
return `${(0, html_entities_1.encode)(key)}: ${(0, html_entities_1.encode)(value)}`;
|
|
457
|
-
}))
|
|
458
|
-
.flat()
|
|
459
|
-
.join('\n');
|
|
460
|
-
}
|
|
461
|
-
else {
|
|
462
|
-
return undefined;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
setMappings() {
|
|
466
|
-
this.mappings = externalProductHandler(this, whichSpecialCase(lodash_1.default.get(this.data, 'Findings[0]')), this, 'mapping', this.defaultMappings);
|
|
467
|
-
}
|
|
468
488
|
}
|
|
469
489
|
exports.ASFFMapper = ASFFMapper;
|
|
470
490
|
class ASFFResults {
|
|
471
491
|
constructor(asffJson, securityhubStandardsJsonArray = undefined, meta = undefined) {
|
|
472
492
|
this.meta = meta;
|
|
473
493
|
this.supportingDocs = new Map();
|
|
474
|
-
this.supportingDocs.set(SpecialCasing.SecurityHub,
|
|
494
|
+
this.supportingDocs.set(SpecialCasing.SecurityHub, _.get(SPECIAL_CASE_MAPPING.get(SpecialCasing.SecurityHub), 'securityhubSupportingDocs', (standards) => {
|
|
475
495
|
throw new Error(`supportingDocs function should've been defined: ${standards}`);
|
|
476
496
|
})(securityhubStandardsJsonArray));
|
|
477
|
-
const findings =
|
|
478
|
-
this.data =
|
|
479
|
-
const productInfo =
|
|
497
|
+
const findings = _.get(fixFileInput(asffJson), 'Findings');
|
|
498
|
+
this.data = _.groupBy(findings, (finding) => {
|
|
499
|
+
const productInfo = _.get(finding, 'ProductArn')
|
|
480
500
|
.split(':')
|
|
481
501
|
.slice(-1)[0]
|
|
482
502
|
.split('/');
|
|
@@ -485,9 +505,9 @@ class ASFFResults {
|
|
|
485
505
|
});
|
|
486
506
|
}
|
|
487
507
|
toHdf() {
|
|
488
|
-
return
|
|
508
|
+
return _.mapValues(this.data, (val) => {
|
|
489
509
|
const wrapped = wrapWithFindingsObject(val);
|
|
490
|
-
return new ASFFMapper(externalProductHandler(this, whichSpecialCase(
|
|
510
|
+
return new ASFFMapper(externalProductHandler(this, whichSpecialCase(_.get(wrapped, 'Findings[0]')), wrapped, 'preprocessingASFF', wrapped), externalProductHandler(this, whichSpecialCase(_.get(wrapped, 'Findings[0]')), [wrapped, this.supportingDocs], 'supportingDocs', this.supportingDocs), externalProductHandler(this, whichSpecialCase(_.get(wrapped, 'Findings[0]')), undefined, 'meta', this.meta)).toHdf();
|
|
491
511
|
});
|
|
492
512
|
}
|
|
493
513
|
}
|