@contrast/contrast 1.0.17 → 1.0.18
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/dist/cliConstants.js +89 -112
- package/dist/commands/audit/help.js +10 -2
- package/dist/commands/scan/sca/scaAnalysis.js +1 -0
- package/dist/common/HTTPClient.js +1 -1
- package/dist/common/errorHandling.js +11 -1
- package/dist/constants/constants.js +1 -1
- package/dist/constants/locales.js +15 -89
- package/dist/scaAnalysis/java/index.js +1 -2
- package/dist/scan/autoDetection.js +15 -1
- package/dist/scan/help.js +9 -3
- package/dist/utils/commonApi.js +7 -1
- package/package.json +1 -1
- package/src/cliConstants.js +94 -119
- package/src/commands/audit/help.js +11 -2
- package/src/commands/scan/sca/scaAnalysis.js +2 -0
- package/src/common/HTTPClient.js +1 -1
- package/src/common/errorHandling.js +19 -1
- package/src/constants/constants.js +1 -1
- package/src/constants/locales.js +17 -127
- package/src/scaAnalysis/java/index.js +2 -2
- package/src/scan/autoDetection.js +21 -1
- package/src/scan/help.js +10 -3
- package/src/utils/commonApi.js +7 -1
package/src/constants/locales.js
CHANGED
|
@@ -3,23 +3,13 @@ const chalk = require('chalk')
|
|
|
3
3
|
|
|
4
4
|
const en_locales = () => {
|
|
5
5
|
return {
|
|
6
|
-
successHeader: 'SUCCESS',
|
|
7
|
-
snapshotSuccessMessage:
|
|
8
|
-
'Please go to the Contrast UI to view your dependency tree.',
|
|
9
6
|
snapshotFailureHeader: 'FAIL',
|
|
10
7
|
snapshotFailureMessage: 'Library analysis failed',
|
|
11
|
-
snapshotHostMessage:
|
|
12
|
-
"No host supplied. Using default host 'app.contrastsecurity.com'. Please ensure this is correct.",
|
|
13
|
-
vulnerabilitiesSuccessMessage: 'Vulnerability data successfully retrieved',
|
|
14
8
|
vulnerabilitiesFailureMessage: 'Unable to retrieve library vulnerabilities',
|
|
15
|
-
catchErrorMessage: 'Contrast UI error: ',
|
|
16
9
|
dependenciesNote:
|
|
17
10
|
'Please Note: We currently only support projects with one .csproj AND *.package.lock.json',
|
|
18
|
-
languageAnalysisFailureMessage: 'SCA audit Failure',
|
|
19
|
-
languageAnalysisFactoryFailureHeader: 'FAIL',
|
|
20
11
|
libraryAnalysisError:
|
|
21
12
|
'Please ensure the language parameter is set in accordance to the language specified on the project path.\nContrast CLI must be run in the same directory as the project manifest file OR the project_path parameter must be used to identify the directory containing the project manifest file.\n\nFor further information please read our usage guide, which can be accessed with the following command:\n\ncontrast-cli --help',
|
|
22
|
-
yamlMissingParametersHeader: 'Missing Parameters',
|
|
23
13
|
genericErrorMessage:
|
|
24
14
|
'An error has occur please check your command again. For more information use the --help commands.',
|
|
25
15
|
unauthenticatedErrorHeader: '401 error - Unauthenticated',
|
|
@@ -35,21 +25,7 @@ const en_locales = () => {
|
|
|
35
25
|
proxyErrorHeader: '407 error - Proxy Authentication Required',
|
|
36
26
|
proxyErrorMessage:
|
|
37
27
|
'Please provide valid authentication credentials for the proxy server.',
|
|
38
|
-
catalogueSuccessCommand: 'Application Created',
|
|
39
|
-
dotnetAnalysisFailure: '.NET analysis failed because: ',
|
|
40
|
-
dotnetReadLockfile: 'Failed to read the lock file @ %s because: ',
|
|
41
|
-
dotnetParseLockfile: "Failed to parse .NET lock file @ '%s' because: ",
|
|
42
|
-
dotnetParseProjectFile:
|
|
43
|
-
"Failed to parse MSBuild project file @ '%s' because: ",
|
|
44
|
-
dotnetReadProjectFile: 'Failed to read the project file @ "%s" because: ',
|
|
45
|
-
javaAnalysisError: 'JAVA analysis failed because: ',
|
|
46
28
|
javaParseProjectFile: 'Failed to parse mvn output because: ',
|
|
47
|
-
languageAnalysisMultipleLanguages1:
|
|
48
|
-
'Identified multiple languages for the project\n',
|
|
49
|
-
languageAnalysisMultipleLanguages2:
|
|
50
|
-
'Please specify which project file you would like analyzed with the %s CLI option.',
|
|
51
|
-
languageAnalysisProjectFiles:
|
|
52
|
-
"Identified project language as '%s' but found multiple project files: %s. Please specify which project file you would like analyzed with the %s CLI option.",
|
|
53
29
|
languageAnalysisHasNoLockFile:
|
|
54
30
|
"Identified project language as '%s' but no project lock file was found.",
|
|
55
31
|
languageAnalysisHasNoPackageJsonFile:
|
|
@@ -58,100 +34,56 @@ const en_locales = () => {
|
|
|
58
34
|
"Identified project language as '%s' but multiple project lock files were found.",
|
|
59
35
|
languageAnalysisProjectFileError:
|
|
60
36
|
"Identified project language as '%s' but no project file was found.",
|
|
61
|
-
languageAnalysisProjectRootFileNameReadError:
|
|
62
|
-
'Failed to read the contents of the directory @ %s because: ',
|
|
63
|
-
languageAnalysisProjectRootFileNameMissingError:
|
|
64
|
-
"%s isn't a file or directory",
|
|
65
37
|
languageAnalysisProjectRootFileNameFailure:
|
|
66
38
|
'Failed to get information about the file or directory @ %s because: ',
|
|
67
|
-
languageAnalysisFailure: ' analysis failed because: ',
|
|
68
39
|
languageAnalysisNoLanguage:
|
|
69
40
|
'We cannot detect a project, use -f <path> to specify a file or folder to analyze.',
|
|
70
41
|
languageAnalysisNoLanguageHelpLine: `${chalk.bold(
|
|
71
42
|
'contrast audit --help'
|
|
72
43
|
)} for more information.`,
|
|
73
|
-
NodeAnalysisFailure: 'NODE analysis failed because: ',
|
|
74
|
-
phpAnalysisFailure: 'PHP analysis failed because: ',
|
|
75
44
|
NodeParseNPM: 'Failed to parse NODE package-lock.json file because: ',
|
|
76
45
|
phpParseComposerLock:
|
|
77
46
|
"Failed to parse PHP composer.lock file @ '%s' because: ",
|
|
78
|
-
NodeReadNpmError:
|
|
79
|
-
'Failed to read the package-lock.json file @ "%s" because: ',
|
|
80
|
-
phpReadError: 'Failed to read the composer.lock file @ "%s" because: ',
|
|
81
47
|
NodeParseYarn: 'Failed to parse yarn.lock version %s because: ',
|
|
82
48
|
NodeParseYarn2: "Failed to parse Node yarn.lock version 2 @ '%s' because: ",
|
|
83
|
-
nodeReadProjectFileError:
|
|
84
|
-
'Failed to read the NODE project file @ "%s" because: ',
|
|
85
|
-
phpReadProjectFileError:
|
|
86
|
-
'Failed to read the PHP project file @ "%s" because: ',
|
|
87
49
|
nodeReadYarnLockFileError:
|
|
88
50
|
'Failed to read the yarn.lock file @ "%s" because: ',
|
|
89
|
-
pythonAnalysisEngineError: 'Python analysis failed because: ',
|
|
90
|
-
pythonAnalysisEnginePipError:
|
|
91
|
-
"Failed to parse python Pipfile.lock file @ '%s' because: ",
|
|
92
|
-
pythonAnalysisParseProjectFileError:
|
|
93
|
-
'Failed to parse python output "%s" because: ',
|
|
94
|
-
pythonAnalysisReadPipFileError:
|
|
95
|
-
'Failed to read the python Pipfile.lock file @ "%s" because: ',
|
|
96
|
-
pythonAnalysisReadPythonProjectFileError:
|
|
97
|
-
'Failed to read the python pipfile @ "%s" because: ',
|
|
98
|
-
rubyAnalysisEngineError: 'Ruby analysis failed because: ',
|
|
99
|
-
rubyAnalysisEngineParsedGemFileError:
|
|
100
|
-
'Failed to parse ruby output "%s" because: ',
|
|
101
|
-
rubyAnalysisEngineParsedGemLockFileError:
|
|
102
|
-
'Failed to parse ruby Gemfile.lock output because: ',
|
|
103
|
-
rubyAnalysisEngineReadGemFileError:
|
|
104
|
-
'Failed to read the ruby project file @ "%s" because: ',
|
|
105
|
-
rubyAnalysisEngineReadGemLockFileError:
|
|
106
|
-
'Failed to read the ruby Gemfile.lock @ "%s" because: ',
|
|
107
51
|
constantsOptional: '(optional)',
|
|
108
|
-
constantsOptionalForCatalogue: '(optional for catalogue)',
|
|
109
52
|
constantsRequired: '(required)',
|
|
110
|
-
|
|
53
|
+
constantsRequiredEnterprise: '(required for Contrast Enterprise)',
|
|
111
54
|
constantsApiKey: 'An agent API key as provided by Contrast UI',
|
|
112
55
|
constantsAuthorization:
|
|
113
|
-
'
|
|
114
|
-
constantsOrganizationId:
|
|
56
|
+
'An authorization header as provided by Contrast UI',
|
|
57
|
+
constantsOrganizationId:
|
|
58
|
+
'The ID of your organization as provided by Contrast UI',
|
|
115
59
|
constantsApplicationId:
|
|
116
|
-
'The ID of the application
|
|
117
|
-
constantsHostId:
|
|
118
|
-
'Provide the name of the host and optionally the port expressed as "<host>:<port>".',
|
|
60
|
+
'The ID of the application as provided by Contrast UI',
|
|
61
|
+
constantsHostId: 'host name e.g. https://app.contrastsecurity.com',
|
|
119
62
|
constantsApplicationName:
|
|
120
|
-
'The name of the application
|
|
121
|
-
constantsCatalogueApplication:
|
|
122
|
-
'Provide this if you want to catalogue an application',
|
|
63
|
+
'The name of the application as provided by Contrast UI',
|
|
123
64
|
failOptionErrorMessage:
|
|
124
65
|
' FAIL - CVEs have been detected that match at least the cve_severity option specified.',
|
|
125
66
|
failOptionMessage:
|
|
126
67
|
' Use with contrast scan or contrast audit. Detects failures based on the severity level specified with the --severity command. For example, "contrast scan --fail --severity high". Returns all failures if no severity level is specified.',
|
|
127
|
-
constantsLanguage:
|
|
128
|
-
'Valid values are JAVA, DOTNET, NODE, PYTHON and RUBY. If there are multiple project configuration files in the project_path, language is also required. Also, provide this when cataloguing an application',
|
|
129
68
|
constantsFilePath: `Specify a directory or the file where dependencies are declared. (By default, CodeSec will search for project files in the current directory.)`,
|
|
130
|
-
constantsSilent: 'Silences JSON output.',
|
|
131
69
|
constantsAppGroups:
|
|
132
|
-
'Assign your application to one or more pre-existing groups when
|
|
133
|
-
constantsVersion: 'Displays CLI Version you are currently on.',
|
|
70
|
+
'Assign your application to one or more pre-existing groups when on boarding an application. Group lists should be comma separated.',
|
|
134
71
|
constantsProxyServer:
|
|
135
|
-
'Allows for connection via a proxy server. If authentication is required please provide the username and password with the protocol, host and port. For instance: "
|
|
136
|
-
constantsHelp: 'Display this usage guide.',
|
|
72
|
+
'Allows for connection via a proxy server. If authentication is required please provide the username and password with the protocol, host and port. For instance: "https://username:password@<host>:<port>".',
|
|
137
73
|
constantsGradleMultiProject:
|
|
138
74
|
'Specify the sub project within your gradle application.',
|
|
139
|
-
|
|
140
|
-
|
|
75
|
+
constantsDoNotWaitForScan:
|
|
76
|
+
'Fire and forget. Do not wait for the result of the scan.',
|
|
141
77
|
constantsProjectName:
|
|
142
78
|
'Contrast project name. If not specified, Contrast uses contrast.settings to identify the project or creates a project.',
|
|
143
79
|
constantsProjectId:
|
|
144
80
|
'The ID associated with a scan project. Replace <ProjectID> with the ID for the scan project. To find the ID, select a scan project in Contrast and locate the last number in the URL.',
|
|
145
|
-
constantsReport: 'Display vulnerability information for this application',
|
|
146
|
-
constantsFail:
|
|
147
|
-
'Set the process to fail if this option is set in combination with --cve_severity.',
|
|
148
81
|
failThresholdOptionErrorMessage: 'More than 0 vulnerabilities found',
|
|
149
82
|
failSeverityOptionErrorMessage:
|
|
150
83
|
' FAIL - Results detected vulnerabilities over accepted severity level',
|
|
151
84
|
constantsSeverity:
|
|
152
85
|
'Use with "contrast scan --fail --severity high" or "contrast audit --fail --severity high". Set the severity level to detect vulnerabilities or dependencies. Severity levels are critical, high, medium, low or note.',
|
|
153
|
-
|
|
154
|
-
constantsHeader: 'CodeSec by Contrast Security',
|
|
86
|
+
constantsHeader: 'Contrast CLI',
|
|
155
87
|
configHeader2: 'Config options',
|
|
156
88
|
clearHeader: '-c, --clear',
|
|
157
89
|
clearContent: 'Removes stored credentials',
|
|
@@ -161,8 +93,6 @@ const en_locales = () => {
|
|
|
161
93
|
'Use the ‘contrast’ command for fast and accurate security analysis of your applications, APIs, serverless functions, and libraries.',
|
|
162
94
|
constantsContrastCategories:
|
|
163
95
|
'\n Code: Java, .NET, .NET Core, JavaScript\n Serverless: AWS Lambda - Java, Python\n Libraries: Java, .NET, Node, Ruby, Python, Go, PHP\n',
|
|
164
|
-
constantsUsageGuideContentRecommendation:
|
|
165
|
-
'Our recommendation is that this is invoked as part of a CI pipeline so that running the cli is automated as part of your build process.',
|
|
166
96
|
constantsPrerequisitesHeader: 'Pre-requisites',
|
|
167
97
|
constantsAuthUsageHeader: 'Usage',
|
|
168
98
|
constantsAuthUsageContents: 'contrast auth',
|
|
@@ -180,30 +110,9 @@ const en_locales = () => {
|
|
|
180
110
|
'The file argument is optional. If no file is given, Contrast will search for a .jar, .war, .exe or .zip file in the working directory.\n',
|
|
181
111
|
constantsUsageCommandInfo24Hours:
|
|
182
112
|
'Submitted files are encrypted during upload and deleted in 24 hours.',
|
|
183
|
-
constantsAnd: 'AND',
|
|
184
|
-
constantsJava:
|
|
185
|
-
'AND Maven build platform, including the dependency plugin. For a Gradle project, use build.gradle. A gradle-wrapper.properties file is also required. Kotlin is also supported requiring a build.gradle.kts file.',
|
|
186
|
-
constantsJavaNote:
|
|
187
|
-
'Note: Running "mvn dependency:tree" or "./gradlew dependencies" in the project directory locally must be successful.',
|
|
188
|
-
constantsJavaNoteGradle:
|
|
189
|
-
'We currently support v4.8 and upwards on Gradle projects',
|
|
190
|
-
constantsDotNet:
|
|
191
|
-
'MSBuild 15.0 or greater and have a packages.lock.json file are supported.',
|
|
192
|
-
constantsDotNetNote:
|
|
193
|
-
'Please Note: If the packages.lock.json file is not in place it can be generated by setting RestorePackagesWithLockFile to true within each *.csproj and running dotnet build',
|
|
194
|
-
constantsNode: '%s AND a lock file either %s or %s',
|
|
195
|
-
constantsRuby: 'gemfile AND gemfile.lock',
|
|
196
|
-
constantsPython: 'pipfile AND pipfile.lock',
|
|
197
|
-
constantsHowToRunHeader: 'How to run:',
|
|
198
|
-
constantsHowToRunDev1:
|
|
199
|
-
'Begin with contrast auth to authenticate the CLI to perform actions',
|
|
200
|
-
constantsHowToRunDev2:
|
|
201
|
-
'After successful auth try the following command: contrast scan -f "<file>"',
|
|
202
113
|
constantsHowToRunDev3:
|
|
203
114
|
'Allowable languages are java (.jar and .war) and javascript (.js or .zip), if the language is not autodetected please use --language to specify',
|
|
204
115
|
constantsOptions: 'Options',
|
|
205
|
-
constantsSpecialCharacterWarning:
|
|
206
|
-
'Please Note: Parameters may need to be quoted to avoid issues with special characters.',
|
|
207
116
|
constantsProxyKey: 'Path to the Certificate Key',
|
|
208
117
|
constantsProxyCert: 'Path to the Cert file',
|
|
209
118
|
constantsProxyCaCert: 'Path to the CaCert file',
|
|
@@ -220,7 +129,8 @@ const en_locales = () => {
|
|
|
220
129
|
'Apply labels to an application. Labels must be formatted as a comma-delimited list. Example - label1,label2,label3',
|
|
221
130
|
constantsCode:
|
|
222
131
|
'Add the application code this application should use in the Contrast UI',
|
|
223
|
-
|
|
132
|
+
constantsMavenSettingsPath: 'Path to maven settings',
|
|
133
|
+
constantsCertSelfSigned:
|
|
224
134
|
'For EOP users with a local Teamserver install, this will bypass the SSL certificate and recognise a self signed certificate.',
|
|
225
135
|
constantsSave: 'Saves the Scan Results SARIF to file.',
|
|
226
136
|
scanLabel:
|
|
@@ -229,7 +139,7 @@ const en_locales = () => {
|
|
|
229
139
|
'Excludes developer dependencies from the results. All dependencies are included by default.',
|
|
230
140
|
constantsCommands: 'Commands',
|
|
231
141
|
constantsScanOptions: 'Scan Options',
|
|
232
|
-
|
|
142
|
+
constantsAdvancedOptions: 'Advanced',
|
|
233
143
|
foundExistingProjectScan: 'Found existing project...',
|
|
234
144
|
projectCreatedScan: 'Project created',
|
|
235
145
|
uploadingScan: 'Uploading file to scan.',
|
|
@@ -268,10 +178,6 @@ const en_locales = () => {
|
|
|
268
178
|
configName: 'config',
|
|
269
179
|
helpName: 'help',
|
|
270
180
|
scanOptionsLanguageSummary: 'Valid values are JAVA, JAVASCRIPT and DOTNET',
|
|
271
|
-
scanOptionsLanguageSummaryOptional:
|
|
272
|
-
'Language of file to send for analysis. ',
|
|
273
|
-
scanOptionsLanguageSummaryRequired:
|
|
274
|
-
'If you scan a .zip file or you use the --file option.',
|
|
275
181
|
scanOptionsTimeoutSummary:
|
|
276
182
|
'Time in seconds to wait for scan to complete. Default value is 300 seconds.',
|
|
277
183
|
scanOptionsFileNameSummary:
|
|
@@ -295,14 +201,9 @@ const en_locales = () => {
|
|
|
295
201
|
' to learn more about the capabilities.',
|
|
296
202
|
authWaitingMessage: 'Waiting for auth...',
|
|
297
203
|
authTimedOutMessage: 'Auth Timed out, try again',
|
|
298
|
-
zipErrorScan:
|
|
299
|
-
'We only support zip files for JAVASCRIPT language, please set the flag --language JAVASCRIPT',
|
|
300
|
-
unknownFileErrorScan: 'Unsupported file selected for Scan.',
|
|
301
204
|
foundScanFile: 'Found: %s',
|
|
302
205
|
foundDetailedVulnerabilities:
|
|
303
206
|
chalk.bold('%s') + ' | ' + chalk.bold('%s') + ' | %s | %s | %s ',
|
|
304
|
-
requiredParams: 'All required parameters are not present.',
|
|
305
|
-
timeoutScan: 'Timeout set to 5 minutes.',
|
|
306
207
|
searchingScanFileDirectory: 'Searching for file to scan from %s...',
|
|
307
208
|
searchingAuditFileDirectory:
|
|
308
209
|
'Searching for package manager files from %s...',
|
|
@@ -312,13 +213,11 @@ const en_locales = () => {
|
|
|
312
213
|
lambdaSummary:
|
|
313
214
|
'Performs static security scan on an AWS Lambda Function.\nProduces CVE (Vulnerable Dependencies) and Least Privilege violations/remediation results.',
|
|
314
215
|
lambdaUsage: 'contrast lambda --function-name <function> [options]',
|
|
315
|
-
lambdaPrerequisitesContent: '',
|
|
316
216
|
lambdaPrerequisitesContentLambdaLanguages:
|
|
317
217
|
'Supported runtimes: Java & Python',
|
|
318
218
|
lambdaPrerequisitesContentLambdaDescriptionTitle: 'AWS Requirements\n',
|
|
319
219
|
lambdaPrerequisitesContentLambdaDescription:
|
|
320
220
|
'Make sure you have the AWS credentials configured on your local environment. \nYou need the following AWS permissions configured on your IAM user:\n - Lambda: GetFunction, GetLayerVersion, ListFunctions\n - IAM: GetRolePolicy, GetPolicy, GetPolicyVersion, ListRolePolicies, ListAttachedRolePolicies',
|
|
321
|
-
scanFileNameOption: '-f, --file',
|
|
322
221
|
lambdaFunctionNameOption: '-f, --function-name',
|
|
323
222
|
lambdaListFunctionsOption: '-l, --list-functions',
|
|
324
223
|
lambdaEndpointOption: '-e, --endpoint-url',
|
|
@@ -341,13 +240,10 @@ const en_locales = () => {
|
|
|
341
240
|
'Configuration details not found. Try authenticating by using ‘contrast auth’.',
|
|
342
241
|
redirectAuth:
|
|
343
242
|
'\nOpening the authentication page in your web browser.\nSign in and complete the steps.\nReturn here to start using Contrast.\n\nIf your browser has trouble loading, try this:\n%s \n',
|
|
344
|
-
scanZipError:
|
|
345
|
-
'A .zip archive can be used for Javascript Scan. Archive found %s does not contain .JS files for Scan.',
|
|
346
243
|
fileNotExist: 'File specified does not exist, please check and try again.',
|
|
347
244
|
scanFileIsEmpty: 'File specified is empty. Please choose another.',
|
|
348
245
|
fileHasWhiteSpacesError:
|
|
349
246
|
'File cannot have spaces, please rename or choose another file to Scan.',
|
|
350
|
-
zipFileException: 'Error reading zip file',
|
|
351
247
|
connectionError:
|
|
352
248
|
'An error has occurred when trying to get the Project Id please check your internet connection or provide the Project Id manually',
|
|
353
249
|
internalServerErrorHeader: '500 error - Internal server error',
|
|
@@ -400,22 +296,16 @@ const en_locales = () => {
|
|
|
400
296
|
'Please specify file type to save results to, accepted value is SARIF',
|
|
401
297
|
auditSBOMSaveSuccess:
|
|
402
298
|
'\n Software Bill of Materials (SBOM) saved successfully',
|
|
403
|
-
auditNoFiletypeSpecifiedForSave: `\n ${chalk.yellow.bold(
|
|
404
|
-
'No file type specified for --save option to save audit results to. Use audit --help to see valid --save options.'
|
|
405
|
-
)}`,
|
|
406
299
|
auditBadFiletypeSpecifiedForSave: `\n ${chalk.yellow.bold(
|
|
407
300
|
'Bad file type specified for --save option. Use audit --help to see valid --save options.'
|
|
408
301
|
)}`,
|
|
409
302
|
auditServicesMessageForTS:
|
|
410
303
|
'View your vulnerable library list or full dependency tree in Contrast:',
|
|
411
|
-
auditReportWaiting: 'Waiting for report...',
|
|
412
|
-
auditReportFail: 'Report Retrieval Failed, please try again',
|
|
413
|
-
auditReportSuccessMessage: 'Report successfully retrieved',
|
|
414
304
|
auditReportFailureMessage: 'Unable to generate library report',
|
|
415
305
|
auditSCAAnalysisBegins: 'Contrast SCA audit started',
|
|
416
306
|
auditSCAAnalysisComplete: 'Contrast audit complete',
|
|
417
|
-
commonHelpHeader: 'Need More Help?',
|
|
418
|
-
commonHelpEnterpriseHeader: 'Existing Contrast user?',
|
|
307
|
+
commonHelpHeader: 'Need More Help? NEW users',
|
|
308
|
+
commonHelpEnterpriseHeader: 'Existing Contrast Licensed user?',
|
|
419
309
|
commonHelpCheckOutHeader: chalk.hex('#9DC184')('Check out:'),
|
|
420
310
|
commonHelpCheckOutText: ' https://support.contrastsecurity.com',
|
|
421
311
|
commonHelpLearnMoreHeader: chalk.hex('#9DC184')('Learn more at:'),
|
|
@@ -28,8 +28,8 @@ const getAgreement = async config => {
|
|
|
28
28
|
console.log(
|
|
29
29
|
'Java analysis uses maven / gradle which are potentially susceptible to command injection. Be sure that the code you are running Contrast CLI on is trusted before continuing.'
|
|
30
30
|
)
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
if (!process.env.CI && !config?.javaAgreement) {
|
|
33
33
|
return await analysis.agreementPrompt(config)
|
|
34
34
|
}
|
|
35
35
|
return config
|
|
@@ -63,6 +63,25 @@ const hasWhiteSpace = s => {
|
|
|
63
63
|
return filename.indexOf(' ') >= 0
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
const dealWithMultiJava = filesFound => {
|
|
67
|
+
let hasMultiJava =
|
|
68
|
+
filesFound.filter(data => {
|
|
69
|
+
return (
|
|
70
|
+
Object.keys(data)[0] === 'JAVA' &&
|
|
71
|
+
Object.values(data)[0].includes('build.gradle') &&
|
|
72
|
+
Object.values(data)[0].includes('pom.xml')
|
|
73
|
+
)
|
|
74
|
+
}).length > 0
|
|
75
|
+
if (hasMultiJava) {
|
|
76
|
+
console.log('Multiple Java language dependency files detected')
|
|
77
|
+
console.log(
|
|
78
|
+
'Please use --file to audit one only. \nExample: contrast audit --file pom.xml'
|
|
79
|
+
)
|
|
80
|
+
process.exit(1)
|
|
81
|
+
}
|
|
82
|
+
return false
|
|
83
|
+
}
|
|
84
|
+
|
|
66
85
|
const errorOnFileDetection = entries => {
|
|
67
86
|
if (entries.length > 1) {
|
|
68
87
|
console.log(i18n.__('searchingDirectoryScan'))
|
|
@@ -99,5 +118,6 @@ module.exports = {
|
|
|
99
118
|
errorOnFileDetection,
|
|
100
119
|
autoDetectAuditFilesAndLanguages,
|
|
101
120
|
errorOnAuditFileDetection,
|
|
102
|
-
autoDetectFingerprintInfo
|
|
121
|
+
autoDetectFingerprintInfo,
|
|
122
|
+
dealWithMultiJava
|
|
103
123
|
}
|
package/src/scan/help.js
CHANGED
|
@@ -29,13 +29,20 @@ const scanUsageGuide = commandLineUsage([
|
|
|
29
29
|
'proxy',
|
|
30
30
|
'help',
|
|
31
31
|
'ff',
|
|
32
|
-
'
|
|
32
|
+
'cert-self-signed',
|
|
33
|
+
'key',
|
|
34
|
+
'cacert',
|
|
35
|
+
'cert',
|
|
33
36
|
'verbose',
|
|
34
37
|
'debug',
|
|
35
|
-
'experimental'
|
|
36
|
-
'application-name'
|
|
38
|
+
'experimental'
|
|
37
39
|
]
|
|
38
40
|
},
|
|
41
|
+
{
|
|
42
|
+
header: i18n.__('constantsAdvancedOptions'),
|
|
43
|
+
optionList:
|
|
44
|
+
constants.commandLineDefinitions.scanAdvancedOptionDefinitionsForHelp
|
|
45
|
+
},
|
|
39
46
|
commonHelpLinks()[0],
|
|
40
47
|
commonHelpLinks()[1]
|
|
41
48
|
])
|
package/src/utils/commonApi.js
CHANGED
|
@@ -8,7 +8,9 @@ const {
|
|
|
8
8
|
maxAppError,
|
|
9
9
|
snapshotFailureError,
|
|
10
10
|
vulnerabilitiesFailureError,
|
|
11
|
-
reportFailureError
|
|
11
|
+
reportFailureError,
|
|
12
|
+
parametersError,
|
|
13
|
+
invalidHostNameError
|
|
12
14
|
} = require('../common/errorHandling')
|
|
13
15
|
|
|
14
16
|
const handleResponseErrors = (res, api) => {
|
|
@@ -22,6 +24,10 @@ const handleResponseErrors = (res, api) => {
|
|
|
22
24
|
proxyError()
|
|
23
25
|
} else if (res.statusCode === 412) {
|
|
24
26
|
maxAppError()
|
|
27
|
+
} else if (res.statusCode === 301) {
|
|
28
|
+
invalidHostNameError(res.statusCode)
|
|
29
|
+
} else if (res.statusCode === 302) {
|
|
30
|
+
parametersError(res.statusCode)
|
|
25
31
|
} else {
|
|
26
32
|
if (api === 'snapshot' || api === 'catalogue') {
|
|
27
33
|
snapshotFailureError()
|