@contrast/contrast 1.0.22 → 2.0.0
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 -138
- package/dist/audit/languageAnalysisEngine/sendSnapshot.js +2 -19
- package/dist/audit/report/commonReportingFunctions.js +1 -1
- package/dist/audit/save.js +16 -5
- package/dist/cliConstants.js +29 -0
- package/dist/commands/audit/auditController.js +2 -1
- package/dist/commands/audit/help.js +3 -3
- package/dist/commands/audit/processAudit.js +3 -1
- package/dist/commands/audit/saveFile.js +5 -1
- package/dist/commands/github/projectGroup.js +164 -0
- package/dist/common/HTTPClient.js +165 -13
- package/dist/constants/constants.js +3 -5
- package/dist/constants/locales.js +7 -3
- package/dist/index.js +0 -4
- package/dist/lambda/lambda.js +3 -1
- package/dist/sbom/generateSbom.js +7 -0
- package/dist/scaAnalysis/common/commonReportingFunctionsSca.js +6 -6
- package/dist/scaAnalysis/common/scaServicesUpload.js +77 -7
- package/dist/scaAnalysis/common/treeUpload.js +1 -1
- package/dist/scaAnalysis/go/goAnalysis.js +1 -1
- package/dist/scaAnalysis/java/analysis.js +24 -32
- package/dist/scaAnalysis/java/index.js +1 -1
- package/dist/scaAnalysis/javascript/index.js +3 -3
- package/dist/scaAnalysis/legacy/legacyFlow.js +33 -0
- package/dist/scaAnalysis/php/index.js +1 -1
- package/dist/scaAnalysis/processServicesFlow.js +21 -0
- package/dist/scaAnalysis/python/analysis.js +1 -1
- package/dist/scaAnalysis/python/index.js +1 -1
- package/dist/scaAnalysis/repoMode/index.js +2 -2
- package/dist/scaAnalysis/ruby/analysis.js +1 -1
- package/dist/scaAnalysis/ruby/index.js +1 -1
- package/dist/scaAnalysis/scaAnalysis.js +16 -36
- package/dist/scan/autoDetection.js +41 -2
- package/dist/scan/fileUtils.js +5 -4
- package/dist/utils/commonApi.js +26 -1
- package/dist/utils/settingsHelper.js +7 -17
- package/package.json +6 -6
- package/src/audit/languageAnalysisEngine/sendSnapshot.js +3 -22
- package/src/audit/report/commonReportingFunctions.js +1 -1
- package/src/audit/save.js +21 -10
- package/src/cliConstants.js +32 -0
- package/src/commands/audit/auditController.js +2 -1
- package/src/commands/audit/help.js +3 -3
- package/src/commands/audit/processAudit.js +4 -5
- package/src/commands/audit/saveFile.js +6 -1
- package/src/commands/github/projectGroup.js +187 -0
- package/src/common/HTTPClient.js +221 -13
- package/src/constants/constants.js +3 -5
- package/src/constants/locales.js +9 -3
- package/src/index.ts +0 -5
- package/src/lambda/lambda.ts +3 -1
- package/src/lambda/lambdaUtils.ts +1 -1
- package/src/sbom/generateSbom.ts +8 -0
- package/src/scaAnalysis/common/commonReportingFunctionsSca.js +6 -6
- package/src/scaAnalysis/common/scaServicesUpload.js +92 -7
- package/src/scaAnalysis/common/treeUpload.js +1 -1
- package/src/scaAnalysis/go/goAnalysis.js +1 -1
- package/src/scaAnalysis/java/analysis.js +29 -34
- package/src/scaAnalysis/java/index.js +1 -1
- package/src/scaAnalysis/javascript/index.js +3 -6
- package/src/scaAnalysis/legacy/legacyFlow.js +48 -0
- package/src/scaAnalysis/php/index.js +1 -1
- package/src/scaAnalysis/processServicesFlow.js +29 -0
- package/src/scaAnalysis/python/analysis.js +1 -1
- package/src/scaAnalysis/python/index.js +1 -1
- package/src/scaAnalysis/repoMode/index.js +2 -2
- package/src/scaAnalysis/ruby/analysis.js +1 -1
- package/src/scaAnalysis/ruby/index.js +1 -1
- package/src/scaAnalysis/scaAnalysis.js +21 -57
- package/src/scan/autoDetection.js +44 -3
- package/src/scan/fileUtils.js +5 -4
- package/src/utils/commonApi.js +29 -1
- package/src/utils/settingsHelper.js +8 -18
- package/dist/commands/fingerprint/processFingerprint.js +0 -14
- package/src/commands/fingerprint/processFingerprint.js +0 -21
- /package/dist/commands/{fingerprint → github}/fingerprintConfig.js +0 -0
- /package/src/commands/{fingerprint → github}/fingerprintConfig.js +0 -0
package/src/utils/commonApi.js
CHANGED
|
@@ -12,7 +12,33 @@ const {
|
|
|
12
12
|
parametersError,
|
|
13
13
|
invalidHostNameError
|
|
14
14
|
} = require('../common/errorHandling')
|
|
15
|
+
const { performance } = require('perf_hooks')
|
|
16
|
+
const requestUtils = require('./requestUtils')
|
|
17
|
+
const oraFunctions = require('./oraWrapper')
|
|
15
18
|
|
|
19
|
+
const getTimeout = config => {
|
|
20
|
+
if (config.timeout) {
|
|
21
|
+
return config.timeout
|
|
22
|
+
} else {
|
|
23
|
+
if (config.verbose) {
|
|
24
|
+
console.log('Timeout set to 5 minutes')
|
|
25
|
+
}
|
|
26
|
+
return 300
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const handleTimeout = (startTime, timeout, reportSpinner) => {
|
|
31
|
+
const endTime = performance.now() - startTime
|
|
32
|
+
if (requestUtils.millisToSeconds(endTime) > timeout) {
|
|
33
|
+
oraFunctions.failSpinner(
|
|
34
|
+
reportSpinner,
|
|
35
|
+
'Contrast audit timed out at the specified timeout of ' +
|
|
36
|
+
timeout +
|
|
37
|
+
' seconds.'
|
|
38
|
+
)
|
|
39
|
+
throw new Error('You can update the timeout using --timeout')
|
|
40
|
+
}
|
|
41
|
+
}
|
|
16
42
|
const handleResponseErrors = (res, api) => {
|
|
17
43
|
if (res.statusCode === 400) {
|
|
18
44
|
api === 'catalogue' ? badRequestError(true) : badRequestError(false)
|
|
@@ -71,5 +97,7 @@ module.exports = {
|
|
|
71
97
|
getValidHost: getValidHost,
|
|
72
98
|
getProtocol: getProtocol,
|
|
73
99
|
handleResponseErrors: handleResponseErrors,
|
|
74
|
-
getHttpClient: getHttpClient
|
|
100
|
+
getHttpClient: getHttpClient,
|
|
101
|
+
handleTimeout: handleTimeout,
|
|
102
|
+
getTimeout: getTimeout
|
|
75
103
|
}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const {
|
|
3
|
-
const { SAAS, MODE_BUILD } = require('../constants/constants')
|
|
1
|
+
const generalAPI = require('./generalAPI')
|
|
2
|
+
const { SAAS } = require('../constants/constants')
|
|
4
3
|
|
|
5
4
|
const getSettings = async config => {
|
|
6
|
-
config.isEOP =
|
|
7
|
-
|
|
8
|
-
config.scaServices = await isSCAServicesAvailable(config)
|
|
9
|
-
return config
|
|
10
|
-
}
|
|
5
|
+
config.isEOP =
|
|
6
|
+
(await generalAPI.getMode(config)).toUpperCase() === SAAS ? false : true
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.then(res => {
|
|
17
|
-
return res.body.status === 'UP'
|
|
18
|
-
})
|
|
19
|
-
.catch(err => {
|
|
20
|
-
console.log(err)
|
|
21
|
-
})
|
|
8
|
+
if (config.legacy === undefined) {
|
|
9
|
+
config.legacy = config.isEOP
|
|
10
|
+
}
|
|
11
|
+
return config
|
|
22
12
|
}
|
|
23
13
|
|
|
24
14
|
module.exports = {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const fingerprintConfig = require('./fingerprintConfig');
|
|
3
|
-
const autoDetection = require('../../scan/autoDetection');
|
|
4
|
-
const saveResults = require('../../scan/saveResults');
|
|
5
|
-
const processFingerprint = async (contrastConf, argvMain) => {
|
|
6
|
-
const config = await fingerprintConfig.getFingerprintConfig(contrastConf, 'fingerprint', argvMain);
|
|
7
|
-
let fingerprint = await autoDetection.autoDetectFingerprintInfo(config.file, config.depth);
|
|
8
|
-
let idArray = fingerprint.map(x => x.id);
|
|
9
|
-
await saveResults.writeResultsToFile(fingerprint, 'fingerPrintInfo.json');
|
|
10
|
-
return console.log(idArray);
|
|
11
|
-
};
|
|
12
|
-
module.exports = {
|
|
13
|
-
processFingerprint
|
|
14
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const fingerprintConfig = require('./fingerprintConfig')
|
|
2
|
-
const autoDetection = require('../../scan/autoDetection')
|
|
3
|
-
const saveResults = require('../../scan/saveResults')
|
|
4
|
-
const processFingerprint = async (contrastConf, argvMain) => {
|
|
5
|
-
const config = await fingerprintConfig.getFingerprintConfig(
|
|
6
|
-
contrastConf,
|
|
7
|
-
'fingerprint',
|
|
8
|
-
argvMain
|
|
9
|
-
)
|
|
10
|
-
let fingerprint = await autoDetection.autoDetectFingerprintInfo(
|
|
11
|
-
config.file,
|
|
12
|
-
config.depth
|
|
13
|
-
)
|
|
14
|
-
let idArray = fingerprint.map(x => x.id)
|
|
15
|
-
await saveResults.writeResultsToFile(fingerprint, 'fingerPrintInfo.json')
|
|
16
|
-
return console.log(idArray)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
processFingerprint
|
|
21
|
-
}
|
|
File without changes
|
|
File without changes
|