@contrast/contrast 1.0.10 → 1.0.13
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 +1 -1
- package/dist/audit/{languageAnalysisEngine/report → report}/commonReportingFunctions.js +56 -35
- package/dist/audit/report/models/reportGuidanceModel.js +6 -0
- package/dist/audit/{languageAnalysisEngine/report → report}/models/reportLibraryModel.js +0 -0
- package/dist/audit/{languageAnalysisEngine/report → report}/models/reportListModel.js +0 -0
- package/dist/audit/{languageAnalysisEngine/report → report}/models/reportOutputModel.js +1 -2
- package/dist/audit/{languageAnalysisEngine/report → report}/models/reportSeverityModel.js +0 -0
- package/dist/audit/{languageAnalysisEngine/report → report}/models/severityCountModel.js +1 -0
- package/dist/audit/{languageAnalysisEngine/report → report}/reportingFeature.js +12 -8
- package/dist/audit/{languageAnalysisEngine/report → report}/utils/reportUtils.js +3 -4
- package/dist/commands/audit/auditConfig.js +3 -3
- package/dist/commands/audit/help.js +3 -1
- package/dist/commands/audit/processAudit.js +14 -2
- package/dist/commands/auth/auth.js +1 -1
- package/dist/commands/config/config.js +2 -2
- package/dist/commands/scan/processScan.js +20 -4
- package/dist/commands/scan/sca/scaAnalysis.js +15 -5
- package/dist/common/HTTPClient.js +39 -2
- package/dist/common/commonHelp.js +19 -0
- package/dist/common/fail.js +70 -0
- package/dist/common/versionChecker.js +14 -6
- package/dist/constants/constants.js +2 -2
- package/dist/constants/locales.js +15 -5
- package/dist/constants.js +42 -5
- package/dist/index.js +6 -3
- package/dist/lambda/help.js +2 -3
- package/dist/lambda/lambda.js +7 -0
- package/dist/scaAnalysis/common/scaParserForGoAndJava.js +32 -0
- package/dist/scaAnalysis/common/scaServicesUpload.js +52 -0
- package/dist/scaAnalysis/common/treeUpload.js +20 -5
- package/dist/scaAnalysis/dotnet/analysis.js +15 -3
- package/dist/scaAnalysis/go/goAnalysis.js +8 -2
- package/dist/scaAnalysis/java/analysis.js +10 -6
- package/dist/scaAnalysis/java/index.js +7 -1
- package/dist/scaAnalysis/java/javaBuildDepsParser.js +19 -3
- package/dist/scaAnalysis/javascript/index.js +4 -0
- package/dist/scaAnalysis/javascript/scaServiceParser.js +109 -0
- package/dist/scaAnalysis/php/analysis.js +1 -1
- package/dist/scaAnalysis/php/index.js +12 -6
- package/dist/scaAnalysis/php/phpNewServicesMapper.js +62 -0
- package/dist/scaAnalysis/python/analysis.js +43 -5
- package/dist/scaAnalysis/python/index.js +7 -2
- package/dist/scaAnalysis/ruby/analysis.js +116 -9
- package/dist/scaAnalysis/ruby/index.js +6 -1
- package/dist/scan/formatScanOutput.js +6 -5
- package/dist/scan/help.js +2 -3
- package/dist/scan/populateProjectIdAndProjectName.js +5 -0
- package/dist/scan/scan.js +4 -0
- package/dist/scan/scanConfig.js +4 -4
- package/dist/scan/scanResults.js +46 -3
- package/dist/telemetry/telemetry.js +137 -0
- package/dist/{audit/languageAnalysisEngine/util → utils}/capabilities.js +0 -0
- package/dist/{audit/languageAnalysisEngine/util → utils}/generalAPI.js +14 -5
- package/dist/utils/getConfig.js +2 -4
- package/dist/utils/parsedCLIOptions.js +3 -1
- package/dist/utils/requestUtils.js +7 -1
- package/package.json +4 -2
- package/src/audit/{languageAnalysisEngine/report → report}/commonReportingFunctions.ts +80 -44
- package/src/audit/report/models/reportGuidanceModel.ts +5 -0
- package/src/audit/{languageAnalysisEngine/report → report}/models/reportLibraryModel.ts +0 -0
- package/src/audit/{languageAnalysisEngine/report → report}/models/reportListModel.ts +0 -0
- package/src/audit/{languageAnalysisEngine/report → report}/models/reportOutputModel.ts +1 -7
- package/src/audit/{languageAnalysisEngine/report → report}/models/reportSeverityModel.ts +0 -0
- package/src/audit/{languageAnalysisEngine/report → report}/models/severityCountModel.ts +2 -0
- package/src/audit/{languageAnalysisEngine/report → report}/reportingFeature.ts +16 -9
- package/src/audit/{languageAnalysisEngine/report → report}/utils/reportUtils.ts +4 -4
- package/src/commands/audit/auditConfig.ts +10 -3
- package/src/commands/audit/help.ts +3 -1
- package/src/commands/audit/processAudit.ts +24 -2
- package/src/commands/auth/auth.js +3 -1
- package/src/commands/config/config.js +4 -2
- package/src/commands/scan/processScan.js +32 -4
- package/src/commands/scan/sca/scaAnalysis.js +23 -5
- package/src/common/HTTPClient.js +59 -2
- package/src/common/commonHelp.ts +13 -0
- package/src/common/fail.js +79 -0
- package/src/common/versionChecker.ts +18 -8
- package/src/constants/constants.js +2 -2
- package/src/constants/locales.js +19 -7
- package/src/constants.js +46 -6
- package/src/index.ts +18 -4
- package/src/lambda/help.ts +2 -3
- package/src/lambda/lambda.ts +12 -0
- package/src/scaAnalysis/common/scaParserForGoAndJava.js +41 -0
- package/src/scaAnalysis/common/scaServicesUpload.js +54 -0
- package/src/scaAnalysis/common/treeUpload.js +21 -5
- package/src/scaAnalysis/dotnet/analysis.js +21 -3
- package/src/scaAnalysis/go/goAnalysis.js +9 -2
- package/src/scaAnalysis/java/analysis.js +11 -6
- package/src/scaAnalysis/java/index.js +9 -1
- package/src/scaAnalysis/java/javaBuildDepsParser.js +25 -6
- package/src/scaAnalysis/javascript/index.js +4 -0
- package/src/scaAnalysis/javascript/scaServiceParser.js +145 -0
- package/src/scaAnalysis/php/analysis.js +1 -1
- package/src/scaAnalysis/php/index.js +12 -6
- package/src/scaAnalysis/php/phpNewServicesMapper.js +77 -0
- package/src/scaAnalysis/python/analysis.js +49 -5
- package/src/scaAnalysis/python/index.js +7 -2
- package/src/scaAnalysis/ruby/analysis.js +149 -9
- package/src/scaAnalysis/ruby/index.js +6 -1
- package/src/scan/formatScanOutput.ts +7 -5
- package/src/scan/help.js +2 -3
- package/src/scan/populateProjectIdAndProjectName.js +5 -1
- package/src/scan/scan.ts +4 -0
- package/src/scan/scanConfig.js +6 -4
- package/src/scan/scanResults.js +52 -3
- package/src/telemetry/telemetry.ts +154 -0
- package/src/{audit/languageAnalysisEngine/util → utils}/capabilities.js +0 -0
- package/src/{audit/languageAnalysisEngine/util → utils}/generalAPI.js +16 -6
- package/src/utils/getConfig.ts +2 -11
- package/src/utils/parsedCLIOptions.js +14 -1
- package/src/utils/requestUtils.js +8 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const { featuresTeamServer } = require('./capabilities')
|
|
2
2
|
const semver = require('semver')
|
|
3
|
-
const { handleResponseErrors } = require('
|
|
4
|
-
const
|
|
3
|
+
const { handleResponseErrors } = require('../common/errorHandling')
|
|
4
|
+
const commonApi = require('./commonApi')
|
|
5
|
+
const { isNil } = require('lodash')
|
|
5
6
|
|
|
6
7
|
const getGlobalProperties = async config => {
|
|
7
|
-
const client = getHttpClient(config)
|
|
8
|
-
|
|
8
|
+
const client = commonApi.getHttpClient(config)
|
|
9
9
|
return client
|
|
10
|
-
.getGlobalProperties(config)
|
|
10
|
+
.getGlobalProperties(config.host)
|
|
11
11
|
.then(res => {
|
|
12
12
|
if (res.statusCode === 200) {
|
|
13
13
|
return res.body
|
|
@@ -20,6 +20,15 @@ const getGlobalProperties = async config => {
|
|
|
20
20
|
})
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const getMode = async config => {
|
|
24
|
+
const features = await getGlobalProperties(config)
|
|
25
|
+
|
|
26
|
+
if (!isNil(features?.mode)) {
|
|
27
|
+
return features.mode
|
|
28
|
+
}
|
|
29
|
+
return ''
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
const getFeatures = version => {
|
|
24
33
|
const featuresEnabled = []
|
|
25
34
|
|
|
@@ -39,5 +48,6 @@ const isFeatureEnabled = (features, featureName) => {
|
|
|
39
48
|
module.exports = {
|
|
40
49
|
getGlobalProperties,
|
|
41
50
|
getFeatures,
|
|
42
|
-
isFeatureEnabled
|
|
51
|
+
isFeatureEnabled,
|
|
52
|
+
getMode
|
|
43
53
|
}
|
package/src/utils/getConfig.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Conf from 'conf'
|
|
2
|
+
import { CE_URL } from '../constants/constants'
|
|
2
3
|
|
|
3
4
|
type ContrastConfOptions = Partial<{
|
|
4
5
|
version: string
|
|
@@ -7,7 +8,6 @@ type ContrastConfOptions = Partial<{
|
|
|
7
8
|
orgId: string
|
|
8
9
|
authHeader: string
|
|
9
10
|
numOfRuns: number
|
|
10
|
-
updateMessageHidden: boolean
|
|
11
11
|
}>
|
|
12
12
|
|
|
13
13
|
type ContrastConf = Conf<ContrastConfOptions>
|
|
@@ -18,17 +18,8 @@ const localConfig = (name: string, version: string) => {
|
|
|
18
18
|
})
|
|
19
19
|
config.set('version', version)
|
|
20
20
|
|
|
21
|
-
if (process.env.CONTRAST_CODSEC_DISABLE_UPDATE_MESSAGE) {
|
|
22
|
-
config.set(
|
|
23
|
-
'updateMessageHidden',
|
|
24
|
-
JSON.parse(
|
|
25
|
-
process.env.CONTRAST_CODSEC_DISABLE_UPDATE_MESSAGE.toLowerCase()
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
21
|
if (!config.has('host')) {
|
|
31
|
-
config.set('host',
|
|
22
|
+
config.set('host', CE_URL)
|
|
32
23
|
}
|
|
33
24
|
return config
|
|
34
25
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
const commandLineArgs = require('command-line-args')
|
|
2
|
+
const { sendTelemetryConfigAsConfObj } = require('../telemetry/telemetry')
|
|
2
3
|
|
|
3
|
-
const getCommandLineArgsCustom = (
|
|
4
|
+
const getCommandLineArgsCustom = async (
|
|
5
|
+
contrastConf,
|
|
6
|
+
command,
|
|
7
|
+
parameterList,
|
|
8
|
+
optionDefinitions
|
|
9
|
+
) => {
|
|
4
10
|
try {
|
|
5
11
|
return commandLineArgs(optionDefinitions, {
|
|
6
12
|
argv: parameterList,
|
|
@@ -9,6 +15,13 @@ const getCommandLineArgsCustom = (parameterList, optionDefinitions) => {
|
|
|
9
15
|
caseInsensitive: true
|
|
10
16
|
})
|
|
11
17
|
} catch (e) {
|
|
18
|
+
await sendTelemetryConfigAsConfObj(
|
|
19
|
+
contrastConf,
|
|
20
|
+
command,
|
|
21
|
+
parameterList,
|
|
22
|
+
'FAILURE',
|
|
23
|
+
'undefined'
|
|
24
|
+
)
|
|
12
25
|
console.log(e.message.toString())
|
|
13
26
|
process.exit(1)
|
|
14
27
|
}
|
|
@@ -15,8 +15,15 @@ const sleep = ms => {
|
|
|
15
15
|
return new Promise(resolve => setTimeout(resolve, ms))
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const timeOutError = (ms, reject) => {
|
|
19
|
+
return setTimeout(() => {
|
|
20
|
+
reject(new Error(`No input detected after 30s`))
|
|
21
|
+
}, ms)
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
module.exports = {
|
|
19
25
|
sendRequest: sendRequest,
|
|
20
26
|
sleep: sleep,
|
|
21
|
-
millisToSeconds: millisToSeconds
|
|
27
|
+
millisToSeconds: millisToSeconds,
|
|
28
|
+
timeOutError: timeOutError
|
|
22
29
|
}
|