@contrast/contrast 1.0.3 → 1.0.6

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.
Files changed (107) hide show
  1. package/.prettierignore +4 -0
  2. package/README.md +20 -14
  3. package/dist/audit/autodetection/autoDetectLanguage.js +32 -0
  4. package/dist/audit/catalogueApplication/catalogueApplication.js +2 -11
  5. package/dist/audit/languageAnalysisEngine/{langugageAnalysisFactory.js → languageAnalysisFactory.js} +6 -14
  6. package/dist/audit/languageAnalysisEngine/reduceIdentifiedLanguages.js +29 -0
  7. package/dist/audit/languageAnalysisEngine/report/commonReportingFunctions.js +101 -234
  8. package/dist/audit/languageAnalysisEngine/report/models/reportLibraryModel.js +19 -0
  9. package/dist/audit/languageAnalysisEngine/report/models/reportListModel.js +24 -0
  10. package/dist/audit/languageAnalysisEngine/report/models/reportOutputModel.js +24 -0
  11. package/dist/audit/languageAnalysisEngine/report/models/reportSeverityModel.js +12 -0
  12. package/dist/audit/languageAnalysisEngine/report/models/severityCountModel.js +13 -0
  13. package/dist/audit/languageAnalysisEngine/report/reportingFeature.js +24 -129
  14. package/dist/audit/languageAnalysisEngine/report/utils/reportUtils.js +99 -0
  15. package/dist/audit/languageAnalysisEngine/sendSnapshot.js +2 -14
  16. package/dist/commands/audit/auditConfig.js +8 -2
  17. package/dist/commands/audit/auditController.js +14 -5
  18. package/dist/commands/scan/processScan.js +10 -6
  19. package/dist/commands/scan/sca/scaAnalysis.js +49 -0
  20. package/dist/common/HTTPClient.js +18 -26
  21. package/dist/common/errorHandling.js +7 -17
  22. package/dist/common/versionChecker.js +14 -12
  23. package/dist/constants/constants.js +24 -2
  24. package/dist/constants/lambda.js +3 -1
  25. package/dist/constants/locales.js +42 -42
  26. package/dist/constants.js +25 -1
  27. package/dist/index.js +2 -2
  28. package/dist/lambda/help.js +22 -14
  29. package/dist/lambda/lambda.js +6 -0
  30. package/dist/scaAnalysis/common/formatMessage.js +19 -0
  31. package/dist/scaAnalysis/common/treeUpload.js +29 -0
  32. package/dist/scaAnalysis/go/goAnalysis.js +17 -0
  33. package/dist/scaAnalysis/go/goParseDeps.js +158 -0
  34. package/dist/scaAnalysis/go/goReadDepFile.js +23 -0
  35. package/dist/scaAnalysis/java/analysis.js +108 -0
  36. package/dist/scaAnalysis/java/index.js +18 -0
  37. package/dist/scaAnalysis/java/javaBuildDepsParser.js +339 -0
  38. package/dist/scan/autoDetection.js +46 -1
  39. package/dist/scan/fileUtils.js +73 -1
  40. package/dist/scan/formatScanOutput.js +215 -0
  41. package/dist/scan/help.js +3 -1
  42. package/dist/scan/models/groupedResultsModel.js +11 -0
  43. package/dist/scan/models/resultContentModel.js +2 -0
  44. package/dist/scan/models/scanResultsModel.js +11 -0
  45. package/dist/scan/scan.js +27 -126
  46. package/dist/scan/scanConfig.js +1 -1
  47. package/dist/scan/scanController.js +11 -5
  48. package/dist/scan/scanResults.js +15 -19
  49. package/dist/utils/getConfig.js +3 -0
  50. package/dist/utils/oraWrapper.js +5 -1
  51. package/package.json +3 -2
  52. package/src/audit/autodetection/autoDetectLanguage.ts +40 -0
  53. package/src/audit/catalogueApplication/catalogueApplication.js +4 -16
  54. package/src/audit/languageAnalysisEngine/{langugageAnalysisFactory.js → languageAnalysisFactory.js} +11 -21
  55. package/src/audit/languageAnalysisEngine/reduceIdentifiedLanguages.js +72 -0
  56. package/src/audit/languageAnalysisEngine/report/commonReportingFunctions.ts +204 -0
  57. package/src/audit/languageAnalysisEngine/report/models/reportLibraryModel.ts +30 -0
  58. package/src/audit/languageAnalysisEngine/report/models/reportListModel.ts +32 -0
  59. package/src/audit/languageAnalysisEngine/report/models/reportOutputModel.ts +29 -0
  60. package/src/audit/languageAnalysisEngine/report/models/reportSeverityModel.ts +13 -0
  61. package/src/audit/languageAnalysisEngine/report/models/severityCountModel.ts +16 -0
  62. package/src/audit/languageAnalysisEngine/report/reportingFeature.ts +56 -0
  63. package/src/audit/languageAnalysisEngine/report/utils/reportUtils.ts +116 -0
  64. package/src/audit/languageAnalysisEngine/sendSnapshot.js +2 -22
  65. package/src/commands/audit/auditConfig.ts +12 -3
  66. package/src/commands/audit/auditController.ts +20 -5
  67. package/src/commands/audit/processAudit.ts +3 -0
  68. package/src/commands/scan/processScan.js +13 -9
  69. package/src/commands/scan/sca/scaAnalysis.js +75 -0
  70. package/src/common/HTTPClient.js +31 -38
  71. package/src/common/errorHandling.ts +7 -25
  72. package/src/common/versionChecker.ts +24 -22
  73. package/src/constants/constants.js +24 -2
  74. package/src/constants/lambda.js +3 -1
  75. package/src/constants/locales.js +47 -56
  76. package/src/constants.js +29 -1
  77. package/src/index.ts +2 -3
  78. package/src/lambda/help.ts +22 -14
  79. package/src/lambda/lambda.ts +8 -0
  80. package/src/scaAnalysis/common/formatMessage.js +20 -0
  81. package/src/scaAnalysis/common/treeUpload.js +30 -0
  82. package/src/scaAnalysis/go/goAnalysis.js +20 -0
  83. package/src/scaAnalysis/go/goParseDeps.js +203 -0
  84. package/src/scaAnalysis/go/goReadDepFile.js +32 -0
  85. package/src/scaAnalysis/java/analysis.js +143 -0
  86. package/src/scaAnalysis/java/index.js +21 -0
  87. package/src/scaAnalysis/java/javaBuildDepsParser.js +404 -0
  88. package/src/scan/autoDetection.js +54 -1
  89. package/src/scan/fileUtils.js +91 -1
  90. package/src/scan/formatScanOutput.ts +250 -0
  91. package/src/scan/help.js +3 -1
  92. package/src/scan/models/groupedResultsModel.ts +20 -0
  93. package/src/scan/models/resultContentModel.ts +86 -0
  94. package/src/scan/models/scanResultsModel.ts +52 -0
  95. package/src/scan/scan.ts +63 -0
  96. package/src/scan/scanConfig.js +1 -1
  97. package/src/scan/scanController.js +15 -7
  98. package/src/scan/scanResults.js +21 -18
  99. package/src/utils/getConfig.ts +10 -0
  100. package/src/utils/oraWrapper.js +6 -1
  101. package/dist/audit/languageAnalysisEngine/report/checkIgnoreDevDep.js +0 -17
  102. package/dist/audit/languageAnalysisEngine/report/newReportingFeature.js +0 -81
  103. package/src/audit/languageAnalysisEngine/report/checkIgnoreDevDep.js +0 -27
  104. package/src/audit/languageAnalysisEngine/report/commonReportingFunctions.js +0 -303
  105. package/src/audit/languageAnalysisEngine/report/newReportingFeature.js +0 -124
  106. package/src/audit/languageAnalysisEngine/report/reportingFeature.js +0 -190
  107. package/src/scan/scan.js +0 -195
@@ -13,12 +13,23 @@ const MEDIUM = 'MEDIUM'
13
13
  const HIGH = 'HIGH'
14
14
  const CRITICAL = 'CRITICAL'
15
15
  const APP_NAME = 'contrast'
16
- const APP_VERSION = '1.0.3'
16
+ const APP_VERSION = '1.0.6'
17
17
  const TIMEOUT = 120000
18
+ const HIGH_COLOUR = '#ff9900'
19
+ const CRITICAL_COLOUR = '#e35858'
20
+ const MEDIUM_COLOUR = '#f1c232'
21
+ const LOW_COLOUR = '#b7b7b7'
22
+ const NOTE_COLOUR = '#999999'
23
+ const CRITICAL_PRIORITY = 1
24
+ const HIGH_PRIORITY = 2
25
+ const MEDIUM_PRIORITY = 3
26
+ const LOW_PRIORITY = 4
27
+ const NOTE_PRIORITY = 5
18
28
 
19
29
  const AUTH_UI_URL = 'https://cli-auth.contrastsecurity.com'
20
30
  const AUTH_CALLBACK_URL = 'https://cli-auth-api.contrastsecurity.com'
21
31
  const SARIF_FILE = 'SARIF'
32
+ const CE_URL = 'https://ce.contrastsecurity.com/'
22
33
 
23
34
  module.exports = {
24
35
  supportedLanguages: { NODE, DOTNET, JAVA, RUBY, PYTHON, GO, PHP, JAVASCRIPT },
@@ -31,5 +42,16 @@ module.exports = {
31
42
  TIMEOUT,
32
43
  AUTH_UI_URL,
33
44
  AUTH_CALLBACK_URL,
34
- SARIF_FILE
45
+ SARIF_FILE,
46
+ HIGH_COLOUR,
47
+ CRITICAL_COLOUR,
48
+ MEDIUM_COLOUR,
49
+ LOW_COLOUR,
50
+ NOTE_COLOUR,
51
+ CE_URL,
52
+ CRITICAL_PRIORITY,
53
+ HIGH_PRIORITY,
54
+ MEDIUM_PRIORITY,
55
+ LOW_PRIORITY,
56
+ NOTE_PRIORITY
35
57
  }
@@ -36,11 +36,13 @@ const lambda = {
36
36
  loadingFunctionList: 'Loading lambda function list',
37
37
  functionsFound: '{{count}} functions found',
38
38
  noFunctionsFound: 'No functions found',
39
- failedToLoadFunctions: 'Faled to load lambda functions',
39
+ failedToLoadFunctions: 'Failed to load lambda functions',
40
40
  availableForScan: '{{icon}} {{count}} available for scan',
41
41
  runtimeCount: '----- {{runtime}} ({{count}}) -----',
42
42
 
43
43
  // ====== print vulnerabilities ===== //
44
+ gatherResults: 'Gathering results...',
45
+ doneGatherResults: 'Done gathering results',
44
46
  whatHappenedTitle: 'What happened:',
45
47
  whatHappenedItem: '{{policy}} have:\n{{comments}}\n',
46
48
  recommendation: 'Recommendation:',
@@ -5,48 +5,29 @@ const en_locales = () => {
5
5
  return {
6
6
  successHeader: 'SUCCESS',
7
7
  snapshotSuccessMessage:
8
- ' Please go to the Contrast UI to view your dependency tree.',
8
+ 'Please go to the Contrast UI to view your dependency tree.',
9
9
  snapshotFailureHeader: 'FAIL',
10
- snapshotFailureMessage:
11
- ' Unable to send library analysis to your Contrast UI.',
10
+ snapshotFailureMessage: 'Library analysis failed',
12
11
  snapshotHostMessage:
13
- " No host supplied. Using default host 'app.contrastsecurity.com'. Please ensure this is correct.",
14
- vulnerabilitiesSuccessMessage: ' Vulnerability data successfully retrieved',
15
- vulnerabilitiesFailureMessage:
16
- ' Unable to retrieve library vulnerabilities from Team Server.',
17
- reportSuccessMessage: ' Report successfully retrieved',
18
- reportFailureMessage: ' Unable to generate library report.',
12
+ "No host supplied. Using default host 'app.contrastsecurity.com'. Please ensure this is correct.",
13
+ vulnerabilitiesSuccessMessage: 'Vulnerability data successfully retrieved',
14
+ vulnerabilitiesFailureMessage: 'Unable to retrieve library vulnerabilities',
19
15
  catchErrorMessage: 'Contrast UI error: ',
20
16
  dependenciesNote:
21
17
  'Please Note: We currently only support projects with one .csproj AND *.package.lock.json',
22
- languageAnalysisFailureMessage: 'LANGUAGE ANALYSIS FAILED',
18
+ languageAnalysisFailureMessage: 'SCA Analysis Failure',
23
19
  languageAnalysisFactoryFailureHeader: 'FAIL',
24
- projectPathParameter:
25
- 'Please set the %s to locate the source code for the project',
26
- apiKeyParameter: 'Please set the %s to connect to the Contrast UI',
27
- applicationNameParameter:
28
- 'Please provide a value for %s, to appear in the Contrast UI',
29
- languageParameter:
30
- 'Please set the %s to the language of the source project. Allowable values are JAVA, DOTNET, NODE, PYTHON and RUBY.',
31
- hostParameter:
32
- 'Please set the %s to the hostname and (optionally) the port expressed as <host>:<port> of the Contrast UI',
33
- organizationIdParameter:
34
- 'Please set the %s to correctly identify your organization within the Contrast UI',
35
- authorizationParameter:
36
- 'Please set the %s to your authorization header, found in the Contrast UI',
37
- applicationIdParameter:
38
- 'Please set the %s to the value provided within the Contrast UI for the target application',
39
20
  libraryAnalysisError:
40
- 'Please ensure the language parameter is set in accordance to the language specified on the project path.\nThe Contrast-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',
21
+ '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',
41
22
  yamlMissingParametersHeader: 'Missing Parameters',
42
23
  yamlMissingParametersMessage:
43
- 'The following parameters are required: \n \norganization_id \napi_key \nauthorization \nhost \napplication_name or application_id \nlanguage \n \nThey must be specified as a command line argument or within the yaml file. \nFor further information please read our usage guide, which can be accessed with the following command:\ncontrast-cli --help',
24
+ 'The following parameters are required: \n \norganization-id \napi-key \nauthorization \nhost \nlanguage \n \nThey must be specified as a command line argument. \nFor further information please read our usage guide, which can be accessed with the following command:\ncontrast audit --help',
44
25
  unauthenticatedErrorHeader: '401 error - Unauthenticated',
45
26
  unauthenticatedErrorMessage:
46
- 'Please check the following keys are correct:\n--organization_id, --api_key or --authorization',
27
+ 'Please check the following keys are correct:\n--organization-id, --api-key or --authorization',
47
28
  badRequestErrorHeader: '400 error - Bad Request',
48
29
  badRequestErrorMessage:
49
- 'Please check the following key is correct: \n--application_id',
30
+ 'Please check the following key is correct: \n--application-id',
50
31
  badRequestCatalogueErrorMessage:
51
32
  'The application name already exists, please use a unique name',
52
33
  forbiddenRequestErrorHeader: '403 error - Forbidden',
@@ -55,15 +36,7 @@ const en_locales = () => {
55
36
  proxyErrorHeader: '407 error - Proxy Authentication Required',
56
37
  proxyErrorMessage:
57
38
  'Please provide valid authentication credentials for the proxy server.',
58
- downgradeHttpsHttp:
59
- 'Connection to ContrastUI using https failed. Attempting to connect using http...',
60
- setSpecifiedParameter: 'Please set the %s ',
61
- catalogueFailureCommand:
62
- 'Failed to catalogue a new application for reason: ',
63
- catalogueFailureHostCommand:
64
- 'Failed to catalogue a new application, please ensure you have the correct host and authentication. Error: ',
65
- catalogueSuccessCommand:
66
- 'This application ID can now be used to send dependency data to Contrast: ',
39
+ catalogueSuccessCommand: 'Application Created',
67
40
  dotnetAnalysisFailure: '.NET analysis failed because: ',
68
41
  dotnetReadLockfile: 'Failed to read the lock file @ %s because: ',
69
42
  dotnetParseLockfile: "Failed to parse .NET lock file @ '%s' because: ",
@@ -131,12 +104,10 @@ const en_locales = () => {
131
104
  constantsOptionalForCatalogue: '(optional for catalogue)',
132
105
  constantsRequired: '(required)',
133
106
  constantsRequiredCatalogue: '(required for catalogue)',
134
- constantsYamlPath:
135
- 'If you want to read params from the yaml file then enter the path to the file',
136
107
  constantsApiKey: 'An agent API key as provided by Contrast UI',
137
108
  constantsAuthorization:
138
- 'An agent Authorization credentials as provided by Contrast UI',
139
- constantsOrganizationId: 'The ID of your organization in Contrast UI',
109
+ 'Authorization credentials as provided by Contrast UI',
110
+ constantsOrganizationId: 'The ID of your organization',
140
111
  constantsApplicationId:
141
112
  'The ID of the application cataloged by Contrast UI',
142
113
  constantsHostId:
@@ -175,7 +146,7 @@ const en_locales = () => {
175
146
  constantsHeader: 'CodeSec by Contrast Security',
176
147
  constantsPrerequisitesContentScanLanguages: 'Java & JavaScript supported',
177
148
  constantsContrastContent:
178
- 'Use the Contrast CLI to run a scan(Java, JavaScript and .NET ) or lambda command (Java and Python) to find your vulnerabilities and start securing your code.',
149
+ 'Use the Contrast CLI to run a scan (Java, JavaScript and .NET ) or lambda command (Java and Python) to find your vulnerabilities and start securing your code.',
179
150
  constantsUsageGuideContentRecommendation:
180
151
  '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.',
181
152
  constantsPrerequisitesHeader: 'Pre-requisites',
@@ -255,17 +226,17 @@ const en_locales = () => {
255
226
  goAnalysisError: 'GO analysis failed because: ',
256
227
  goParseProjectFile: 'Failed to parse go mod graph output because: ',
257
228
  mavenNotInstalledError:
258
- " 'mvn' is not available. Please ensure you have Maven installed and available on your path.",
229
+ "'mvn' is not available. Please ensure you have Maven installed and available on your path.",
259
230
  mavenDependencyTreeNonZero:
260
231
  'Building maven dependancy tree failed with a non 0 exit code',
261
232
  gradleWrapperUnavailable:
262
- ' Gradle wrapper not found in root of project. Please ensure gradlew or gradlew.bat is in root of the project.',
233
+ 'Gradle wrapper not found in root of project. Please ensure gradlew or gradlew.bat is in root of the project.',
263
234
  gradleDependencyTreeNonZero:
264
235
  "Building gradle dependancy tree failed with a non 0 exit code. \n Please check you have the correct version of Java installed to compile your project? \n If running against a muti module project ensure you are using the '--sub-project' flag",
265
236
  yamlPathCamelCaseError:
266
- ' Warning: The "yamlPath" parameter will be deprecated in a future release. Please look at our documentation for further guidance.',
237
+ 'Warning: The "yamlPath" parameter will be deprecated in a future release. Please look at our documentation for further guidance.',
267
238
  constantsSbom:
268
- ' Generate the Software Bill of Materials (SBOM) for the given application',
239
+ 'Generate the Software Bill of Materials (SBOM) for the given application',
269
240
  constantsMetadata:
270
241
  'Define a set of key=value pairs (which conforms to RFC 2253) for specifying user-defined metadata associated with the application.',
271
242
  constantsTags:
@@ -273,8 +244,10 @@ const en_locales = () => {
273
244
  constantsCode:
274
245
  'Add the application code this application should use in the Contrast UI',
275
246
  constantsIgnoreCertErrors:
276
- ' For EOP users with a local Teamserver install, this will bypass the SSL certificate and recognise a self signed certificate.',
277
- constantsSave: ' Saves the Scan Results JSON to file.',
247
+ 'For EOP users with a local Teamserver install, this will bypass the SSL certificate and recognise a self signed certificate.',
248
+ constantsSave: 'Saves the Scan Results SARIF to file.',
249
+ scanLabel:
250
+ "adds a label to the scan - defaults to 'Started by CLI tool at current date'",
278
251
  constantsIgnoreDev:
279
252
  'Combined with the --report command excludes developer dependencies from the vulnerabilities report. By default all dependencies are included in a report.',
280
253
  constantsCommands: 'Commands',
@@ -284,18 +257,20 @@ const en_locales = () => {
284
257
  ignoreDevDep: 'No private libraries that are not scoped detected',
285
258
  foundExistingProjectScan: 'Found existing project...',
286
259
  projectCreatedScan: 'Project created',
287
- uploadingScan: 'Uploading...',
260
+ uploadingScan: 'Uploading file to scan.',
288
261
  uploadingScanSuccessful: 'Uploaded file successfully.',
289
262
  uploadingScanFail: 'Unable to upload the file.',
290
263
  waitingTimedOut: 'Timed out.',
291
264
  responseMessage: 'Response: %s',
292
265
  searchingDirectoryScan: 'Searched 3 directory levels & found: ',
293
266
  noFileFoundScan:
294
- "We could't find a suitable file in your directories (we go 3 deep)",
267
+ "We couldn't find a suitable file in your directories (we go 3 deep)",
295
268
  specifyFileScanError:
296
269
  'Java Scan requires a .war or .jar file. Javascript Scan requires a .js or .zip file.\nTo start a Scan enter "contrast scan -f <path-to-file>"',
270
+ specifyFileAuditNotFound: 'No files found for library analysis',
297
271
  populateProjectIdMessage: 'project ID is %s',
298
272
  genericServiceError: 'returned with status code %s',
273
+ projectIdError: 'Your project ID is %s please check this is correct',
299
274
  permissionsError:
300
275
  'You do not have the correct permissions here. \n Contact support@contrastsecurity.com to get this fixed.',
301
276
  scanErrorFileMessage:
@@ -341,16 +316,23 @@ const en_locales = () => {
341
316
  requiredParams: 'All required parameters are not present.',
342
317
  timeoutScan: 'Timeout set to 5 minutes.',
343
318
  searchingScanFileDirectory: 'Searching for file to scan from %s...',
319
+ searchingAuditFileDirectory:
320
+ 'Searching for package manager files from %s...',
344
321
  scanHeader: 'Contrast Scan CLI',
345
322
  authHeader: 'Auth',
346
- lambdaHeader: 'Contrast lambda help',
323
+ lambdaHeader: 'Contrast Lambda CLI',
347
324
  lambdaSummary:
348
325
  'Performs static security scan on an AWS Lambda Function.\nProduces CVE (Vulnerable Dependencies) and Least Privilege violations/remediation results.',
349
326
  lambdaUsage: 'contrast lambda --function-name <function> [options]',
350
- lambdaPrerequisitesContent: 'contrast cli',
351
- scanFileNameOption: ' -f, --file',
352
- lambdaFunctionNameOption: ' -f, --function-name',
353
- lambdaListFunctionsOption: ' -l, --list-functions',
327
+ lambdaPrerequisitesContent: '',
328
+ lambdaPrerequisitesContentLambdaLanguages:
329
+ 'Supported runtimes: Java & Python',
330
+ lambdaPrerequisitesContentLambdaDescriptionTitle: 'AWS Requirements\n',
331
+ lambdaPrerequisitesContentLambdaDescription:
332
+ '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ֿ\n - IAM: GetRolePolicy, GetPolicy, GetPolicyVersion, ListRolePolicies, ListAttachedRolePolicies',
333
+ scanFileNameOption: '-f, --file',
334
+ lambdaFunctionNameOption: '-f, --function-name',
335
+ lambdaListFunctionsOption: '-l, --list-functions',
354
336
  lambdaEndpointOption: '-e, --endpoint-url',
355
337
  lambdaRegionOption: '-r, --region',
356
338
  lambdaProfileOption: '-p, --profile',
@@ -411,7 +393,11 @@ const en_locales = () => {
411
393
  auditOptionsSave: '-s, --save',
412
394
  auditOptionsSaveDescription:
413
395
  'saves the output in specified format Txt text, sbom',
396
+ scanNotCompleted:
397
+ 'Scan not completed. Check for framework and language support here: %s',
414
398
  scanNoVulnerabilitiesFound: '👏 No vulnerabilities found',
399
+ scanNoVulnerabilitiesFoundSecureCode: '👍 Your code looks secure.',
400
+ scanNoVulnerabilitiesFoundGoodWork: '👏 Keep up the good work.',
415
401
  scanNoFiletypeSpecifiedForSave:
416
402
  'Please specify file type to save results to, accepted value is SARIF',
417
403
  auditSBOMSaveSuccess:
@@ -422,6 +408,11 @@ const en_locales = () => {
422
408
  auditBadFiletypeSpecifiedForSave: `\n ${chalk.yellow.bold(
423
409
  'Bad file type specified for --save option. Use audit --help to see valid --save options.'
424
410
  )}`,
411
+ auditReportWaiting: 'Waiting for report...',
412
+ auditReportFail: 'Report Retrieval Failed, please try again',
413
+ auditReportSuccessMessage: 'Report successfully retrieved',
414
+ auditReportFailureMessage: 'Unable to generate library report',
415
+ auditSCAAnalysisBegins: 'Contrast SCA analysis begins',
425
416
  ...lambda
426
417
  }
427
418
  }
package/src/constants.js CHANGED
@@ -47,6 +47,15 @@ const scanOptionDefinitions = [
47
47
  '}: ' +
48
48
  i18n.__('constantsProjectId')
49
49
  },
50
+ {
51
+ name: 'project-path',
52
+ alias: 'i',
53
+ description:
54
+ '{bold ' +
55
+ i18n.__('constantsOptional') +
56
+ '}: ' +
57
+ i18n.__('constantsProjectPath')
58
+ },
50
59
  {
51
60
  name: 'timeout',
52
61
  alias: 't',
@@ -132,6 +141,11 @@ const scanOptionDefinitions = [
132
141
  description:
133
142
  '{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('constantsSave')
134
143
  },
144
+ {
145
+ name: 'label',
146
+ description:
147
+ '{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('scanLabel')
148
+ },
135
149
  {
136
150
  name: 'help',
137
151
  alias: 'h',
@@ -141,6 +155,19 @@ const scanOptionDefinitions = [
141
155
  name: 'debug',
142
156
  alias: 'd',
143
157
  type: Boolean
158
+ },
159
+ {
160
+ name: 'experimental',
161
+ alias: 'e',
162
+ type: Boolean
163
+ },
164
+ {
165
+ name: 'application-name',
166
+ description:
167
+ '{bold ' +
168
+ i18n.__('constantsOptional') +
169
+ '}: ' +
170
+ i18n.__('constantsApplicationName')
144
171
  }
145
172
  ]
146
173
 
@@ -331,7 +358,8 @@ const mainUsageGuide = commandLineUsage([
331
358
  ]
332
359
  },
333
360
  {
334
- content: '{underline https://www.contrastsecurity.com}'
361
+ content:
362
+ '{underline https://developer.contrastsecurity.com/} \n For technical support head to {underline https://support.contrastsecurity.com}'
335
363
  }
336
364
  ])
337
365
 
package/src/index.ts CHANGED
@@ -44,7 +44,7 @@ const start = async () => {
44
44
  argvMain.includes('--version')
45
45
  ) {
46
46
  console.log(APP_VERSION)
47
- await findLatestCLIVersion()
47
+ await findLatestCLIVersion(config.get('updateMessageHidden') as boolean)
48
48
  return
49
49
  }
50
50
 
@@ -53,8 +53,7 @@ const start = async () => {
53
53
 
54
54
  // @ts-ignore
55
55
  if (config.get('numOfRuns') >= 5) {
56
- // @ts-ignore
57
- await findLatestCLIVersion()
56
+ await findLatestCLIVersion(config.get('updateMessageHidden') as boolean)
58
57
  config.set('numOfRuns', 0)
59
58
  }
60
59
 
@@ -8,7 +8,15 @@ const lambdaUsageGuide = commandLineUsage([
8
8
  },
9
9
  {
10
10
  header: i18n.__('constantsPrerequisitesHeader'),
11
- content: [i18n.__('lambdaPrerequisitesContent')]
11
+ content: [
12
+ '{bold ' +
13
+ i18n.__('lambdaPrerequisitesContentLambdaLanguages') +
14
+ '}\n\n' +
15
+ '{bold ' +
16
+ i18n.__('lambdaPrerequisitesContentLambdaDescriptionTitle') +
17
+ '}' +
18
+ i18n.__('lambdaPrerequisitesContentLambdaDescription')
19
+ ]
12
20
  },
13
21
  {
14
22
  header: i18n.__('constantsUsage'),
@@ -18,49 +26,49 @@ const lambdaUsageGuide = commandLineUsage([
18
26
  header: i18n.__('constantsOptions'),
19
27
  content: [
20
28
  {
21
- name: i18n.__('lambdaFunctionNameOption'),
29
+ name: '{bold ' + i18n.__('lambdaFunctionNameOption') + '}',
22
30
  summary: i18n.__('lambdaFunctionNameSummery')
23
31
  },
24
32
  {
25
- name: i18n.__('lambdaListFunctionsOption'),
33
+ name: '{bold ' + i18n.__('lambdaListFunctionsOption') + '}',
26
34
  summary: i18n.__('lambdaListFunctionsSummery')
27
35
  },
28
36
  {
29
- name: i18n.__('lambdaEndpointOption'),
37
+ name: '{bold ' + i18n.__('lambdaEndpointOption') + '}',
30
38
  summary:
31
- '{italic ' +
39
+ '{bold ' +
32
40
  i18n.__('constantsOptional') +
33
41
  '}: ' +
34
42
  i18n.__('lambdaEndpointSummery')
35
43
  },
36
44
  {
37
- name: i18n.__('lambdaRegionOption'),
45
+ name: '{bold ' + i18n.__('lambdaRegionOption') + '}',
38
46
  summary:
39
- '{italic ' +
47
+ '{bold ' +
40
48
  i18n.__('constantsOptional') +
41
49
  '}: ' +
42
50
  i18n.__('lambdaRegionSummery')
43
51
  },
44
52
  {
45
- name: i18n.__('lambdaProfileOption'),
53
+ name: '{bold ' + i18n.__('lambdaProfileOption') + '}',
46
54
  summary:
47
- '{italic ' +
55
+ '{bold ' +
48
56
  i18n.__('constantsOptional') +
49
57
  '}: ' +
50
58
  i18n.__('lambdaProfileSummery')
51
59
  },
52
60
  {
53
- name: i18n.__('lambdaJsonOption'),
61
+ name: '{bold ' + i18n.__('lambdaJsonOption') + '}',
54
62
  summary:
55
- '{italic ' +
63
+ '{bold ' +
56
64
  i18n.__('constantsOptional') +
57
65
  '}: ' +
58
66
  i18n.__('lambdaJsonSummery')
59
67
  },
60
68
  {
61
- name: i18n.__('lambdaVerboseOption'),
69
+ name: '{bold ' + i18n.__('lambdaVerboseOption') + '}',
62
70
  summary:
63
- '{italic ' +
71
+ '{bold ' +
64
72
  i18n.__('constantsOptional') +
65
73
  '}: ' +
66
74
  i18n.__('lambdaVerbosSummery')
@@ -73,7 +81,7 @@ const lambdaUsageGuide = commandLineUsage([
73
81
  ]
74
82
  },
75
83
  {
76
- content: '{underline https://www.contrastsecurity.com}'
84
+ content: '{underline https://www.contrastsecurity.com/developer/codesec}'
77
85
  }
78
86
  ])
79
87
 
@@ -12,6 +12,8 @@ import { requestScanFunctionPost } from './scanRequest'
12
12
  import { getScanResults } from './scanResults'
13
13
  import { printResults } from './utils'
14
14
  import { getAllLambdas, printAvailableLambdas } from './lambdaUtils'
15
+ import { sleep } from '../utils/requestUtils'
16
+ import ora from '../utils/oraWrapper'
15
17
 
16
18
  type LambdaOptions = {
17
19
  functionName?: string
@@ -123,6 +125,12 @@ const actualProcessLambda = async (lambdaOptions: LambdaOptions) => {
123
125
  })
124
126
  }
125
127
 
128
+ // Wait to make sure we will have all the results
129
+ const startGetherResultsSpinner = ora.returnOra(i18n.__('gatherResults'))
130
+ ora.startSpinner(startGetherResultsSpinner)
131
+ await sleep(15 * 1000)
132
+ ora.succeedSpinner(startGetherResultsSpinner, 'Done gathering results')
133
+
126
134
  const resultsResponse = await getScanResults(
127
135
  auth,
128
136
  params,
@@ -0,0 +1,20 @@
1
+ const createJavaTSMessage = javaTree => {
2
+ return {
3
+ java: {
4
+ mavenDependencyTrees: javaTree
5
+ }
6
+ }
7
+ }
8
+
9
+ const createGoTSMessage = goTree => {
10
+ return {
11
+ go: {
12
+ goDependencyTrees: goTree
13
+ }
14
+ }
15
+ }
16
+
17
+ module.exports = {
18
+ createJavaTSMessage,
19
+ createGoTSMessage
20
+ }
@@ -0,0 +1,30 @@
1
+ const { getHttpClient } = require('../../utils/commonApi')
2
+ const { APP_VERSION } = require('../../constants/constants')
3
+
4
+ const commonSendSnapShot = async (analysis, config) => {
5
+ const requestBody = {
6
+ appID: config.applicationId,
7
+ cliVersion: APP_VERSION,
8
+ snapshot: analysis
9
+ }
10
+
11
+ const client = getHttpClient(config)
12
+ return client
13
+ .sendSnapshot(requestBody, config)
14
+ .then(res => {
15
+ if (res.statusCode === 201) {
16
+ console.log('dependencies processed successfully')
17
+ return res.body
18
+ } else {
19
+ console.log(res.statusCode)
20
+ console.log('error processing dependencies')
21
+ }
22
+ })
23
+ .catch(err => {
24
+ console.log(err)
25
+ })
26
+ }
27
+
28
+ module.exports = {
29
+ commonSendSnapShot
30
+ }
@@ -0,0 +1,20 @@
1
+ const { createGoTSMessage } = require('../common/formatMessage')
2
+ const goReadDepFile = require('./goReadDepFile')
3
+ const goParseDeps = require('./goParseDeps')
4
+
5
+ const goAnalysis = (config, languageFiles) => {
6
+ try {
7
+ const rawGoDependencies = goReadDepFile.getGoDependencies(config)
8
+ const parsedGoDependencies = goParseDeps.parseGoDependencies(
9
+ rawGoDependencies
10
+ )
11
+
12
+ return createGoTSMessage(parsedGoDependencies)
13
+ } catch (e) {
14
+ console.log(e.message.toString())
15
+ }
16
+ }
17
+
18
+ module.exports = {
19
+ goAnalysis
20
+ }