@contrast/contrast 2.0.2-beta.3 → 2.0.2-beta.5

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 (358) hide show
  1. package/README.md +51 -1
  2. package/dist/audit/catalogueApplication/catalogueApplication.js +6 -10
  3. package/dist/audit/catalogueApplication/catalogueApplication.js.map +1 -0
  4. package/dist/audit/languageAnalysisEngine/commonApi.js +3 -6
  5. package/dist/audit/languageAnalysisEngine/commonApi.js.map +1 -0
  6. package/dist/audit/languageAnalysisEngine/filterProjectPath.js +2 -1
  7. package/dist/audit/languageAnalysisEngine/filterProjectPath.js.map +1 -0
  8. package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js +9 -12
  9. package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js.map +1 -0
  10. package/dist/audit/languageAnalysisEngine/sendSnapshot.js +15 -19
  11. package/dist/audit/languageAnalysisEngine/sendSnapshot.js.map +1 -0
  12. package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +9 -9
  13. package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js.map +1 -0
  14. package/dist/audit/report/commonReportingFunctions.js +33 -48
  15. package/dist/audit/report/commonReportingFunctions.js.map +1 -0
  16. package/dist/audit/report/models/reportGuidanceModel.js +2 -5
  17. package/dist/audit/report/models/reportGuidanceModel.js.map +1 -0
  18. package/dist/audit/report/models/reportLibraryModel.js +3 -7
  19. package/dist/audit/report/models/reportLibraryModel.js.map +1 -0
  20. package/dist/audit/report/models/reportListModel.js +4 -9
  21. package/dist/audit/report/models/reportListModel.js.map +1 -0
  22. package/dist/audit/report/models/reportOutputModel.js +4 -9
  23. package/dist/audit/report/models/reportOutputModel.js.map +1 -0
  24. package/dist/audit/report/models/reportSeverityModel.js +2 -5
  25. package/dist/audit/report/models/reportSeverityModel.js.map +1 -0
  26. package/dist/audit/report/models/severityCountModel.js +3 -5
  27. package/dist/audit/report/models/severityCountModel.js.map +1 -0
  28. package/dist/audit/report/reportingFeature.js +27 -55
  29. package/dist/audit/report/reportingFeature.js.map +1 -0
  30. package/dist/audit/report/utils/reportUtils.js +28 -59
  31. package/dist/audit/report/utils/reportUtils.js.map +1 -0
  32. package/dist/audit/save.js +14 -16
  33. package/dist/audit/save.js.map +1 -0
  34. package/dist/cliConstants.js +17 -18
  35. package/dist/cliConstants.js.map +1 -0
  36. package/dist/commands/audit/auditConfig.js +7 -10
  37. package/dist/commands/audit/auditConfig.js.map +1 -0
  38. package/dist/commands/audit/auditController.js +9 -13
  39. package/dist/commands/audit/auditController.js.map +1 -0
  40. package/dist/commands/audit/help.js +23 -25
  41. package/dist/commands/audit/help.js.map +1 -0
  42. package/dist/commands/audit/processAudit.js +9 -12
  43. package/dist/commands/audit/processAudit.js.map +1 -0
  44. package/dist/commands/audit/saveFile.js +3 -6
  45. package/dist/commands/audit/saveFile.js.map +1 -0
  46. package/dist/commands/auth/auth.js +25 -24
  47. package/dist/commands/auth/auth.js.map +1 -0
  48. package/dist/commands/config/config.js +12 -13
  49. package/dist/commands/config/config.js.map +1 -0
  50. package/dist/commands/github/fingerprintConfig.js +8 -11
  51. package/dist/commands/github/fingerprintConfig.js.map +1 -0
  52. package/dist/commands/github/processFingerprint.js +12 -15
  53. package/dist/commands/github/processFingerprint.js.map +1 -0
  54. package/dist/commands/github/projectGroup.js +25 -32
  55. package/dist/commands/github/projectGroup.js.map +1 -0
  56. package/dist/commands/github/repoServices.js +11 -21
  57. package/dist/commands/github/repoServices.js.map +1 -0
  58. package/dist/commands/learn/learn.js +3 -6
  59. package/dist/commands/learn/learn.js.map +1 -0
  60. package/dist/commands/learn/processLearn.js +3 -6
  61. package/dist/commands/learn/processLearn.js.map +1 -0
  62. package/dist/commands/scan/processScan.js +11 -14
  63. package/dist/commands/scan/processScan.js.map +1 -0
  64. package/dist/common/HTTPClient.js +123 -94
  65. package/dist/common/HTTPClient.js.map +1 -0
  66. package/dist/common/autoDetection.js +26 -33
  67. package/dist/common/autoDetection.js.map +1 -0
  68. package/dist/common/baseRequest.js +17 -18
  69. package/dist/common/baseRequest.js.map +1 -0
  70. package/dist/common/commonHelp.js +13 -13
  71. package/dist/common/commonHelp.js.map +1 -0
  72. package/dist/common/errorHandling.js +30 -39
  73. package/dist/common/errorHandling.js.map +1 -0
  74. package/dist/common/fail.js +6 -12
  75. package/dist/common/fail.js.map +1 -0
  76. package/dist/common/versionChecker.js +16 -19
  77. package/dist/common/versionChecker.js.map +1 -0
  78. package/dist/constants/constants.js +44 -65
  79. package/dist/constants/constants.js.map +1 -0
  80. package/dist/constants/lambda.js +8 -5
  81. package/dist/constants/lambda.js.map +1 -0
  82. package/dist/constants/locales.js +6 -9
  83. package/dist/constants/locales.js.map +1 -0
  84. package/dist/index.js +36 -39
  85. package/dist/index.js.map +1 -0
  86. package/dist/lambda/analytics.js +6 -9
  87. package/dist/lambda/analytics.js.map +1 -0
  88. package/dist/lambda/arn.js +6 -9
  89. package/dist/lambda/arn.js.map +1 -0
  90. package/dist/lambda/aws.js +29 -34
  91. package/dist/lambda/aws.js.map +1 -0
  92. package/dist/lambda/cliError.js +13 -41
  93. package/dist/lambda/cliError.js.map +1 -0
  94. package/dist/lambda/constants.js +3 -4
  95. package/dist/lambda/constants.js.map +1 -0
  96. package/dist/lambda/help.js +39 -44
  97. package/dist/lambda/help.js.map +1 -0
  98. package/dist/lambda/lambda.js +61 -65
  99. package/dist/lambda/lambda.js.map +1 -0
  100. package/dist/lambda/lambdaUtils.js +38 -32
  101. package/dist/lambda/lambdaUtils.js.map +1 -0
  102. package/dist/lambda/logUtils.js +21 -17
  103. package/dist/lambda/logUtils.js.map +1 -0
  104. package/dist/lambda/scanDetailCompletion.js +19 -25
  105. package/dist/lambda/scanDetailCompletion.js.map +1 -0
  106. package/dist/lambda/scanRequest.js +34 -41
  107. package/dist/lambda/scanRequest.js.map +1 -0
  108. package/dist/lambda/scanResults.js +8 -10
  109. package/dist/lambda/scanResults.js.map +1 -0
  110. package/dist/lambda/types.js +5 -7
  111. package/dist/lambda/types.js.map +1 -0
  112. package/dist/lambda/utils.js +33 -35
  113. package/dist/lambda/utils.js.map +1 -0
  114. package/dist/sbom/generateSbom.js +6 -10
  115. package/dist/sbom/generateSbom.js.map +1 -0
  116. package/dist/scaAnalysis/common/auditReport.js +8 -12
  117. package/dist/scaAnalysis/common/auditReport.js.map +1 -0
  118. package/dist/scaAnalysis/common/commonReportingFunctionsSca.js +26 -32
  119. package/dist/scaAnalysis/common/commonReportingFunctionsSca.js.map +1 -0
  120. package/dist/scaAnalysis/common/formatMessage.js +8 -17
  121. package/dist/scaAnalysis/common/formatMessage.js.map +1 -0
  122. package/dist/scaAnalysis/common/models/ScaReportModel.js +4 -9
  123. package/dist/scaAnalysis/common/models/ScaReportModel.js.map +1 -0
  124. package/dist/scaAnalysis/common/scaParserForGoAndJava.js +10 -9
  125. package/dist/scaAnalysis/common/scaParserForGoAndJava.js.map +1 -0
  126. package/dist/scaAnalysis/common/scaServicesUpload.js +21 -22
  127. package/dist/scaAnalysis/common/scaServicesUpload.js.map +1 -0
  128. package/dist/scaAnalysis/common/treeUpload.js +7 -10
  129. package/dist/scaAnalysis/common/treeUpload.js.map +1 -0
  130. package/dist/scaAnalysis/common/utils/reportUtilsSca.js +21 -29
  131. package/dist/scaAnalysis/common/utils/reportUtilsSca.js.map +1 -0
  132. package/dist/scaAnalysis/dotnet/analysis.js +12 -18
  133. package/dist/scaAnalysis/dotnet/analysis.js.map +1 -0
  134. package/dist/scaAnalysis/dotnet/index.js +4 -7
  135. package/dist/scaAnalysis/dotnet/index.js.map +1 -0
  136. package/dist/scaAnalysis/go/goAnalysis.js +8 -11
  137. package/dist/scaAnalysis/go/goAnalysis.js.map +1 -0
  138. package/dist/scaAnalysis/go/goParseDeps.js +9 -7
  139. package/dist/scaAnalysis/go/goParseDeps.js.map +1 -0
  140. package/dist/scaAnalysis/go/goReadDepFile.js +10 -8
  141. package/dist/scaAnalysis/go/goReadDepFile.js.map +1 -0
  142. package/dist/scaAnalysis/java/analysis.js +23 -20
  143. package/dist/scaAnalysis/java/analysis.js.map +1 -0
  144. package/dist/scaAnalysis/java/index.js +7 -10
  145. package/dist/scaAnalysis/java/index.js.map +1 -0
  146. package/dist/scaAnalysis/java/javaBuildDepsParser.js +43 -43
  147. package/dist/scaAnalysis/java/javaBuildDepsParser.js.map +1 -0
  148. package/dist/scaAnalysis/javascript/analysis.js +16 -20
  149. package/dist/scaAnalysis/javascript/analysis.js.map +1 -0
  150. package/dist/scaAnalysis/javascript/index.js +17 -19
  151. package/dist/scaAnalysis/javascript/index.js.map +1 -0
  152. package/dist/scaAnalysis/javascript/scaServiceParser.js +8 -15
  153. package/dist/scaAnalysis/javascript/scaServiceParser.js.map +1 -0
  154. package/dist/scaAnalysis/legacy/legacyFlow.js +13 -15
  155. package/dist/scaAnalysis/legacy/legacyFlow.js.map +1 -0
  156. package/dist/scaAnalysis/php/analysis.js +15 -16
  157. package/dist/scaAnalysis/php/analysis.js.map +1 -0
  158. package/dist/scaAnalysis/php/index.js +5 -8
  159. package/dist/scaAnalysis/php/index.js.map +1 -0
  160. package/dist/scaAnalysis/php/phpNewServicesMapper.js +9 -12
  161. package/dist/scaAnalysis/php/phpNewServicesMapper.js.map +1 -0
  162. package/dist/scaAnalysis/processServicesFlow.js +50 -25
  163. package/dist/scaAnalysis/processServicesFlow.js.map +1 -0
  164. package/dist/scaAnalysis/python/analysis.js +16 -23
  165. package/dist/scaAnalysis/python/analysis.js.map +1 -0
  166. package/dist/scaAnalysis/python/index.js +4 -7
  167. package/dist/scaAnalysis/python/index.js.map +1 -0
  168. package/dist/scaAnalysis/repoMode/gradleParser.js +7 -13
  169. package/dist/scaAnalysis/repoMode/gradleParser.js.map +1 -0
  170. package/dist/scaAnalysis/repoMode/index.js +9 -12
  171. package/dist/scaAnalysis/repoMode/index.js.map +1 -0
  172. package/dist/scaAnalysis/repoMode/mavenParser.js +12 -12
  173. package/dist/scaAnalysis/repoMode/mavenParser.js.map +1 -0
  174. package/dist/scaAnalysis/ruby/analysis.js +32 -46
  175. package/dist/scaAnalysis/ruby/analysis.js.map +1 -0
  176. package/dist/scaAnalysis/ruby/index.js +5 -8
  177. package/dist/scaAnalysis/ruby/index.js.map +1 -0
  178. package/dist/scaAnalysis/scaAnalysis.js +49 -51
  179. package/dist/scaAnalysis/scaAnalysis.js.map +1 -0
  180. package/dist/scan/fileUtils.js +27 -36
  181. package/dist/scan/fileUtils.js.map +1 -0
  182. package/dist/scan/formatScanOutput.js +47 -61
  183. package/dist/scan/formatScanOutput.js.map +1 -0
  184. package/dist/scan/help.js +8 -11
  185. package/dist/scan/help.js.map +1 -0
  186. package/dist/scan/models/groupedResultsModel.js +2 -5
  187. package/dist/scan/models/groupedResultsModel.js.map +1 -0
  188. package/dist/scan/models/resultContentModel.js +2 -2
  189. package/dist/scan/models/resultContentModel.js.map +1 -0
  190. package/dist/scan/models/scanResultsModel.js +2 -5
  191. package/dist/scan/models/scanResultsModel.js.map +1 -0
  192. package/dist/scan/populateProjectIdAndProjectName.js +9 -12
  193. package/dist/scan/populateProjectIdAndProjectName.js.map +1 -0
  194. package/dist/scan/saveResults.js +3 -6
  195. package/dist/scan/saveResults.js.map +1 -0
  196. package/dist/scan/scan.js +24 -31
  197. package/dist/scan/scan.js.map +1 -0
  198. package/dist/scan/scanConfig.js +14 -12
  199. package/dist/scan/scanConfig.js.map +1 -0
  200. package/dist/scan/scanController.js +17 -20
  201. package/dist/scan/scanController.js.map +1 -0
  202. package/dist/scan/scanResults.js +27 -34
  203. package/dist/scan/scanResults.js.map +1 -0
  204. package/dist/telemetry/telemetry.js +29 -59
  205. package/dist/telemetry/telemetry.js.map +1 -0
  206. package/dist/utils/capabilities.js +2 -1
  207. package/dist/utils/capabilities.js.map +1 -0
  208. package/dist/utils/commonApi.js +15 -24
  209. package/dist/utils/commonApi.js.map +1 -0
  210. package/dist/utils/filterProjectPath.js +2 -1
  211. package/dist/utils/filterProjectPath.js.map +1 -0
  212. package/dist/utils/generalAPI.js +11 -17
  213. package/dist/utils/generalAPI.js.map +1 -0
  214. package/dist/utils/getConfig.js +8 -13
  215. package/dist/utils/getConfig.js.map +1 -0
  216. package/dist/utils/oraWrapper.js +7 -14
  217. package/dist/utils/oraWrapper.js.map +1 -0
  218. package/dist/utils/paramsUtil/commandlineParams.js +2 -5
  219. package/dist/utils/paramsUtil/commandlineParams.js.map +1 -0
  220. package/dist/utils/paramsUtil/configStoreParams.js +9 -10
  221. package/dist/utils/paramsUtil/configStoreParams.js.map +1 -0
  222. package/dist/utils/paramsUtil/envVariableParams.js +2 -3
  223. package/dist/utils/paramsUtil/envVariableParams.js.map +1 -0
  224. package/dist/utils/paramsUtil/paramHandler.js +12 -13
  225. package/dist/utils/paramsUtil/paramHandler.js.map +1 -0
  226. package/dist/utils/parsedCLIOptions.js +4 -7
  227. package/dist/utils/parsedCLIOptions.js.map +1 -0
  228. package/dist/utils/requestUtils.js +7 -13
  229. package/dist/utils/requestUtils.js.map +1 -0
  230. package/dist/utils/saveFile.js +8 -11
  231. package/dist/utils/saveFile.js.map +1 -0
  232. package/dist/utils/validationCheck.js +5 -11
  233. package/dist/utils/validationCheck.js.map +1 -0
  234. package/package.json +33 -42
  235. package/.prettierignore +0 -1
  236. package/bin/contrast.js +0 -2
  237. package/dist/audit/languageAnalysisEngine/util/requestUtils.js +0 -14
  238. package/dist/lambda/__mocks__/aws.js +0 -21
  239. package/dist/lambda/__mocks__/lambdaConfig.json +0 -42
  240. package/src/audit/catalogueApplication/catalogueApplication.js +0 -51
  241. package/src/audit/languageAnalysisEngine/commonApi.js +0 -20
  242. package/src/audit/languageAnalysisEngine/filterProjectPath.js +0 -21
  243. package/src/audit/languageAnalysisEngine/getProjectRootFilenames.js +0 -36
  244. package/src/audit/languageAnalysisEngine/sendSnapshot.js +0 -57
  245. package/src/audit/languageAnalysisEngine/util/requestUtils.js +0 -17
  246. package/src/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +0 -63
  247. package/src/audit/report/commonReportingFunctions.js +0 -412
  248. package/src/audit/report/models/reportGuidanceModel.ts +0 -5
  249. package/src/audit/report/models/reportLibraryModel.ts +0 -30
  250. package/src/audit/report/models/reportListModel.ts +0 -49
  251. package/src/audit/report/models/reportOutputModel.ts +0 -29
  252. package/src/audit/report/models/reportSeverityModel.ts +0 -18
  253. package/src/audit/report/models/severityCountModel.ts +0 -22
  254. package/src/audit/report/reportingFeature.ts +0 -110
  255. package/src/audit/report/utils/reportUtils.ts +0 -165
  256. package/src/audit/save.js +0 -67
  257. package/src/cliConstants.js +0 -523
  258. package/src/commands/audit/auditConfig.js +0 -18
  259. package/src/commands/audit/auditController.js +0 -50
  260. package/src/commands/audit/help.js +0 -72
  261. package/src/commands/audit/processAudit.js +0 -34
  262. package/src/commands/audit/saveFile.js +0 -15
  263. package/src/commands/auth/auth.js +0 -146
  264. package/src/commands/config/config.js +0 -41
  265. package/src/commands/github/fingerprintConfig.js +0 -19
  266. package/src/commands/github/processFingerprint.js +0 -37
  267. package/src/commands/github/projectGroup.js +0 -298
  268. package/src/commands/github/repoServices.js +0 -122
  269. package/src/commands/learn/learn.js +0 -10
  270. package/src/commands/learn/processLearn.js +0 -13
  271. package/src/commands/scan/processScan.js +0 -42
  272. package/src/common/HTTPClient.js +0 -775
  273. package/src/common/autoDetection.js +0 -209
  274. package/src/common/baseRequest.ts +0 -83
  275. package/src/common/commonHelp.js +0 -53
  276. package/src/common/errorHandling.js +0 -157
  277. package/src/common/fail.js +0 -79
  278. package/src/common/versionChecker.js +0 -75
  279. package/src/constants/constants.js +0 -71
  280. package/src/constants/lambda.js +0 -85
  281. package/src/constants/locales.js +0 -365
  282. package/src/index.ts +0 -142
  283. package/src/lambda/__mocks__/aws.ts +0 -32
  284. package/src/lambda/__mocks__/lambdaConfig.json +0 -42
  285. package/src/lambda/analytics.ts +0 -9
  286. package/src/lambda/arn.ts +0 -33
  287. package/src/lambda/aws.ts +0 -248
  288. package/src/lambda/cliError.ts +0 -72
  289. package/src/lambda/constants.ts +0 -11
  290. package/src/lambda/help.ts +0 -92
  291. package/src/lambda/lambda.ts +0 -230
  292. package/src/lambda/lambdaUtils.ts +0 -111
  293. package/src/lambda/logUtils.ts +0 -64
  294. package/src/lambda/scanDetailCompletion.ts +0 -78
  295. package/src/lambda/scanRequest.ts +0 -169
  296. package/src/lambda/scanResults.ts +0 -29
  297. package/src/lambda/types.ts +0 -36
  298. package/src/lambda/utils.ts +0 -188
  299. package/src/sbom/generateSbom.ts +0 -45
  300. package/src/scaAnalysis/common/auditReport.js +0 -59
  301. package/src/scaAnalysis/common/commonReportingFunctionsSca.js +0 -276
  302. package/src/scaAnalysis/common/formatMessage.js +0 -67
  303. package/src/scaAnalysis/common/models/ScaReportModel.ts +0 -81
  304. package/src/scaAnalysis/common/scaParserForGoAndJava.js +0 -41
  305. package/src/scaAnalysis/common/scaServicesUpload.js +0 -159
  306. package/src/scaAnalysis/common/treeUpload.js +0 -51
  307. package/src/scaAnalysis/common/utils/reportUtilsSca.ts +0 -123
  308. package/src/scaAnalysis/dotnet/analysis.js +0 -72
  309. package/src/scaAnalysis/dotnet/index.js +0 -11
  310. package/src/scaAnalysis/go/goAnalysis.js +0 -26
  311. package/src/scaAnalysis/go/goParseDeps.js +0 -203
  312. package/src/scaAnalysis/go/goReadDepFile.js +0 -34
  313. package/src/scaAnalysis/java/analysis.js +0 -148
  314. package/src/scaAnalysis/java/index.js +0 -29
  315. package/src/scaAnalysis/java/javaBuildDepsParser.js +0 -439
  316. package/src/scaAnalysis/javascript/analysis.js +0 -111
  317. package/src/scaAnalysis/javascript/index.js +0 -104
  318. package/src/scaAnalysis/javascript/scaServiceParser.js +0 -151
  319. package/src/scaAnalysis/legacy/legacyFlow.js +0 -43
  320. package/src/scaAnalysis/php/analysis.js +0 -78
  321. package/src/scaAnalysis/php/index.js +0 -28
  322. package/src/scaAnalysis/php/phpNewServicesMapper.js +0 -77
  323. package/src/scaAnalysis/processServicesFlow.js +0 -126
  324. package/src/scaAnalysis/python/analysis.js +0 -93
  325. package/src/scaAnalysis/python/index.js +0 -16
  326. package/src/scaAnalysis/repoMode/gradleParser.js +0 -88
  327. package/src/scaAnalysis/repoMode/index.js +0 -21
  328. package/src/scaAnalysis/repoMode/mavenParser.js +0 -138
  329. package/src/scaAnalysis/ruby/analysis.js +0 -413
  330. package/src/scaAnalysis/ruby/index.js +0 -16
  331. package/src/scaAnalysis/scaAnalysis.js +0 -172
  332. package/src/scan/fileUtils.js +0 -218
  333. package/src/scan/formatScanOutput.ts +0 -225
  334. package/src/scan/help.js +0 -56
  335. package/src/scan/models/groupedResultsModel.ts +0 -20
  336. package/src/scan/models/resultContentModel.ts +0 -86
  337. package/src/scan/models/scanResultsModel.ts +0 -55
  338. package/src/scan/populateProjectIdAndProjectName.js +0 -73
  339. package/src/scan/saveResults.js +0 -14
  340. package/src/scan/scan.ts +0 -68
  341. package/src/scan/scanConfig.js +0 -58
  342. package/src/scan/scanController.js +0 -98
  343. package/src/scan/scanResults.js +0 -171
  344. package/src/telemetry/telemetry.ts +0 -154
  345. package/src/utils/capabilities.js +0 -12
  346. package/src/utils/commonApi.js +0 -103
  347. package/src/utils/filterProjectPath.js +0 -25
  348. package/src/utils/generalAPI.js +0 -52
  349. package/src/utils/getConfig.ts +0 -34
  350. package/src/utils/oraWrapper.js +0 -29
  351. package/src/utils/paramsUtil/commandlineParams.js +0 -12
  352. package/src/utils/paramsUtil/configStoreParams.js +0 -19
  353. package/src/utils/paramsUtil/envVariableParams.js +0 -10
  354. package/src/utils/paramsUtil/paramHandler.js +0 -38
  355. package/src/utils/parsedCLIOptions.js +0 -32
  356. package/src/utils/requestUtils.js +0 -29
  357. package/src/utils/saveFile.js +0 -20
  358. package/src/utils/validationCheck.js +0 -39
@@ -1,81 +0,0 @@
1
- export class ScaReportModel {
2
- uuid: string
3
- groupName: string
4
- artifactName: string
5
- version: string
6
- hash: string
7
- fileName: string
8
- libraryLanguage: string
9
- vulnerable: boolean
10
- privateLibrary: boolean
11
- severity: string
12
- releaseDate: string
13
- latestVersionReleaseDate: string
14
- latestVersion: string
15
- versionsBehind: number
16
- vulnerabilities: ScaReportVulnerabilityModel[]
17
- remediationAdvice: ScaReportRemediationAdviceModel
18
-
19
- constructor(library: any) {
20
- this.uuid = library.uuid
21
- this.groupName = library.groupName
22
- this.artifactName = library.artifactName
23
- this.version = library.version
24
- this.hash = library.hash
25
- this.fileName = library.fileName
26
- this.libraryLanguage = library.libraryLanguage
27
- this.vulnerable = library.vulnerable
28
- this.privateLibrary = library.privateLibrary
29
- this.severity = library.severity
30
- this.releaseDate = library.releaseDate
31
- this.latestVersionReleaseDate = library.latestVersionReleaseDate
32
- this.latestVersion = library.latestVersion
33
- this.versionsBehind = library.versionsBehind
34
- this.vulnerabilities = library.vulnerabilities
35
- this.remediationAdvice = library.remediationAdvice
36
- }
37
- }
38
-
39
- export class ScaReportVulnerabilityModel {
40
- name: string
41
- description: string
42
- cvss2Vector: string
43
- severityValue: number
44
- severity: string
45
- cvss3Vector: string
46
- cvss3SeverityValue: number
47
- cvss3Severity: string
48
- hasCvss3: boolean
49
-
50
- constructor(
51
- name: string,
52
- description: string,
53
- cvss2Vector: string,
54
- severityValue: number,
55
- severity: string,
56
- cvss3Vector: string,
57
- cvss3SeverityValue: number,
58
- cvss3Severity: string,
59
- hasCvss3: boolean
60
- ) {
61
- this.name = name
62
- this.description = description
63
- this.cvss2Vector = cvss2Vector
64
- this.severityValue = severityValue
65
- this.severity = severity
66
- this.cvss3Vector = cvss3Vector
67
- this.cvss3SeverityValue = cvss3SeverityValue
68
- this.cvss3Severity = cvss3Severity
69
- this.hasCvss3 = hasCvss3
70
- }
71
- }
72
-
73
- export class ScaReportRemediationAdviceModel {
74
- closestStableVersion: string
75
- latestStableVersion: string
76
-
77
- constructor(closestStableVersion: string, latestStableVersion: string) {
78
- this.closestStableVersion = closestStableVersion
79
- this.latestStableVersion = latestStableVersion
80
- }
81
- }
@@ -1,41 +0,0 @@
1
- const parseDependenciesForSCAServices = dependencyTreeObject => {
2
- let parsedDependencyTree = {}
3
- let subDeps
4
-
5
- for (let tree in dependencyTreeObject) {
6
- let unParsedDependencyTree = dependencyTreeObject[tree]
7
- for (let dependency in unParsedDependencyTree) {
8
- subDeps = parseSubDependencies(unParsedDependencyTree[dependency].edges)
9
-
10
- let parsedDependency = {
11
- name: unParsedDependencyTree[dependency].artifactID,
12
- group: unParsedDependencyTree[dependency].group,
13
- version: unParsedDependencyTree[dependency].version,
14
- directDependency: unParsedDependencyTree[dependency].type === 'direct',
15
- productionDependency: true,
16
- dependencies: subDeps
17
- }
18
- parsedDependencyTree[dependency] = parsedDependency
19
- }
20
- }
21
- return parsedDependencyTree
22
- }
23
-
24
- const parseSubDependencies = dependencies => {
25
- // converting:
26
- // dependencies: {
27
- // 'gopkg.in/check.v1@v0.0.0-2': 'gopkg.in/check.v1@v0.0.0-2'
28
- // }
29
- // to:
30
- // dependencies: [ 'gopkg.in/check.v1@v0.0.0-2' ]
31
- let subDeps = []
32
- for (let x in dependencies) {
33
- subDeps.push(dependencies[x])
34
- }
35
- return subDeps
36
- }
37
-
38
- module.exports = {
39
- parseDependenciesForSCAServices,
40
- parseSubDependencies
41
- }
@@ -1,159 +0,0 @@
1
- const commonApi = require('../../utils/commonApi')
2
- const { APP_VERSION } = require('../../constants/constants')
3
- const requestUtils = require('../../utils/requestUtils')
4
- const { performance } = require('perf_hooks')
5
-
6
- const scaTreeUpload = async (analysis, config, reportSpinner) => {
7
- if (config.projectId === '') {
8
- console.log(
9
- 'We were unable to create/locate a project for this manifest, please try again or run with --debug for more information'
10
- )
11
- process.exit(1)
12
- }
13
-
14
- config.language = config.language === 'JAVASCRIPT' ? 'NODE' : config.language
15
- const startTime = performance.now()
16
- const timeout = commonApi.getTimeout(config)
17
-
18
- const doINeedParent = config.repositoryId && config.language === 'JAVA'
19
-
20
- const requestBody = {
21
- parentPom: doINeedParent ? analysis.parentPom : null,
22
- dependencyTree: doINeedParent ? analysis.dependencyTree : analysis,
23
- organizationId: config.organizationId,
24
- language: config.language,
25
- tool: {
26
- name: 'Contrast Codesec',
27
- version: APP_VERSION
28
- }
29
- }
30
-
31
- if (config.debug || config.verbose) {
32
- console.log('requestBody', requestBody)
33
- }
34
-
35
- if (config.branch) {
36
- requestBody.branchName = config.branch
37
- }
38
-
39
- const client = commonApi.getHttpClient(config)
40
- const reportID = await client
41
- .scaServiceIngest(requestBody, config)
42
- .then(res => {
43
- if (res.statusCode === 201 || res.statusCode === 200) {
44
- return res.body.libraryIngestJobId
45
- } else {
46
- throw new Error(res.statusCode + ` error ingesting dependencies`)
47
- }
48
- })
49
- .catch(err => {
50
- throw err
51
- })
52
- if (config.debug) {
53
- console.log(' polling report', reportID)
54
- }
55
-
56
- let keepChecking = true
57
- let res
58
- while (keepChecking) {
59
- res = await client.scaServiceReportStatus(config, reportID).then(res => {
60
- if (config.debug) {
61
- console.log('scaServiceReportStatus', res.statusCode)
62
- console.log(res.body)
63
- }
64
- if (res.body.status === 'COMPLETED') {
65
- keepChecking = false
66
- return client.scaServiceReport(config, reportID).then(res => {
67
- const reportBody = res.body
68
- return { reportBody, reportId: reportID }
69
- })
70
- }
71
- })
72
-
73
- if (!keepChecking) {
74
- return { reportArray: res.reportBody, reportId: reportID }
75
- }
76
-
77
- commonApi.handleTimeout(startTime, timeout, reportSpinner)
78
-
79
- await requestUtils.sleep(5000)
80
- }
81
-
82
- return { reportArray: res, reportID }
83
- }
84
-
85
- const noProjectUpload = async (analysis, config, reportSpinner) => {
86
- config.language = config.language === 'JAVASCRIPT' ? 'NODE' : config.language
87
- const startTime = performance.now()
88
- const timeout = commonApi.getTimeout(config)
89
- const requestBody = {
90
- dependencyTree: analysis,
91
- language: config.language,
92
- tool: {
93
- name: 'Contrast Codesec',
94
- version: APP_VERSION
95
- }
96
- }
97
-
98
- if (config.branch) {
99
- requestBody.branchName = config.branch
100
- }
101
-
102
- const client = commonApi.getHttpClient(config)
103
- const reportID = await client
104
- .noProjectIdUpload(requestBody, config)
105
- .then(res => {
106
- if (res.statusCode === 201 || res.statusCode === 200) {
107
- return res.body.libraryIngestJobId
108
- } else {
109
- throw new Error(
110
- res.statusCode + ` error ingesting dependencies with no project id`
111
- )
112
- }
113
- })
114
- .catch(err => {
115
- throw err
116
- })
117
-
118
- if (config.debug) {
119
- console.log(' polling report no project', reportID)
120
- }
121
-
122
- let keepChecking = true
123
- let res
124
- while (keepChecking) {
125
- res = await client
126
- .scaServiceNoProjectIdReportStatus(config, reportID)
127
- .then(res => {
128
- if (config.debug) {
129
- console.log('\nscaServiceReportStatus')
130
- console.log(res.statusCode)
131
- console.log(res.body)
132
- }
133
- if (res.body.status === 'COMPLETED') {
134
- keepChecking = false
135
- return client
136
- .scaServiceReportNoProjectId(config, reportID)
137
- .then(res => {
138
- const reportBody = res.body
139
- return { reportBody, reportId: reportID }
140
- })
141
- }
142
- })
143
-
144
- if (!keepChecking) {
145
- return { reportArray: res.reportBody, reportId: reportID }
146
- }
147
-
148
- commonApi.handleTimeout(startTime, timeout, reportSpinner)
149
-
150
- await requestUtils.sleep(5000)
151
- }
152
-
153
- return { reportArray: res, reportID }
154
- }
155
-
156
- module.exports = {
157
- scaTreeUpload,
158
- noProjectUpload
159
- }
@@ -1,51 +0,0 @@
1
- const commonApi = require('../../utils/commonApi')
2
- const { APP_VERSION } = require('../../constants/constants')
3
-
4
- const commonSendSnapShot = async (analysis, config) => {
5
- let requestBody = {}
6
- config.legacy === false
7
- ? (requestBody = sendToSCAServices(config, analysis))
8
- : (requestBody = {
9
- appID: config.applicationId,
10
- cliVersion: APP_VERSION,
11
- snapshot: analysis
12
- })
13
-
14
- const client = commonApi.getHttpClient(config)
15
- return client
16
- .sendSnapshot(requestBody, config)
17
- .then(res => {
18
- if (res.statusCode === 201) {
19
- return res.body
20
- } else {
21
- if (res.statusCode === 403) {
22
- throw new Error(
23
- `🛑 Contrast audit failed \nPlease check you have the right permissions and the application ${
24
- config.applicationName ? config.applicationName : ''
25
- } has not been archived.`.replace(/ +(?= )/g, '')
26
- )
27
- }
28
- throw new Error(res.statusCode + ` error processing dependencies`)
29
- }
30
- })
31
- .catch(err => {
32
- throw err
33
- })
34
- }
35
-
36
- const sendToSCAServices = (config, analysis) => {
37
- return {
38
- applicationId: config.applicationId,
39
- dependencyTree: analysis,
40
- organizationId: config.organizationId,
41
- language: config.language,
42
- tool: {
43
- name: 'Contrast Codesec',
44
- version: APP_VERSION
45
- }
46
- }
47
- }
48
-
49
- module.exports = {
50
- commonSendSnapShot
51
- }
@@ -1,123 +0,0 @@
1
- import { orderBy } from 'lodash'
2
- import {
3
- CRITICAL_COLOUR,
4
- CRITICAL_PRIORITY,
5
- HIGH_COLOUR,
6
- HIGH_PRIORITY,
7
- LOW_COLOUR,
8
- LOW_PRIORITY,
9
- MEDIUM_COLOUR,
10
- MEDIUM_PRIORITY,
11
- NOTE_COLOUR,
12
- NOTE_PRIORITY
13
- } from '../../../constants/constants'
14
- import { ReportSeverityModel } from '../../../audit/report/models/reportSeverityModel'
15
- import { SeverityCountModel } from '../../../audit/report/models/severityCountModel'
16
- import {
17
- ScaReportModel,
18
- ScaReportVulnerabilityModel
19
- } from '../models/ScaReportModel'
20
-
21
- export function findHighestSeverityCVESca(
22
- cveArray: ScaReportVulnerabilityModel[]
23
- ) {
24
- const mappedToReportSeverityModels = cveArray.map(cve =>
25
- findCVESeveritySca(cve)
26
- )
27
-
28
- //order and get first
29
- return orderBy(mappedToReportSeverityModels, cve => cve?.priority)[0]
30
- }
31
-
32
- export function orderByHighestPrioritySca(
33
- reportSeverityModel: ReportSeverityModel[]
34
- ) {
35
- return orderBy(reportSeverityModel, ['priority'], ['asc'])
36
- }
37
-
38
- export function findCVESeveritySca(
39
- vulnerabilityModel: ScaReportVulnerabilityModel
40
- ) {
41
- const { name } = vulnerabilityModel
42
-
43
- if (
44
- vulnerabilityModel.cvss3Severity === 'CRITICAL' ||
45
- vulnerabilityModel.severity === 'CRITICAL'
46
- ) {
47
- return new ReportSeverityModel(
48
- 'CRITICAL',
49
- CRITICAL_PRIORITY,
50
- CRITICAL_COLOUR,
51
- name
52
- )
53
- } else if (
54
- vulnerabilityModel.cvss3Severity === 'HIGH' ||
55
- vulnerabilityModel.severity === 'HIGH'
56
- ) {
57
- return new ReportSeverityModel('HIGH', HIGH_PRIORITY, HIGH_COLOUR, name)
58
- } else if (
59
- vulnerabilityModel.cvss3Severity === 'MEDIUM' ||
60
- vulnerabilityModel.severity === 'MEDIUM'
61
- ) {
62
- return new ReportSeverityModel(
63
- 'MEDIUM',
64
- MEDIUM_PRIORITY,
65
- MEDIUM_COLOUR,
66
- name
67
- )
68
- } else if (
69
- vulnerabilityModel.cvss3Severity === 'LOW' ||
70
- vulnerabilityModel.severity === 'LOW'
71
- ) {
72
- return new ReportSeverityModel('LOW', LOW_PRIORITY, LOW_COLOUR, name)
73
- } else if (
74
- vulnerabilityModel.cvss3Severity === 'NOTE' ||
75
- vulnerabilityModel.severity === 'NOTE'
76
- ) {
77
- return new ReportSeverityModel('NOTE', NOTE_PRIORITY, NOTE_COLOUR, name)
78
- }
79
- }
80
-
81
- export function convertGenericToTypedReportModelSca(reportArray: any) {
82
- return reportArray.map((library: any) => {
83
- return new ScaReportModel(library)
84
- })
85
- }
86
-
87
- export function severityCountAllLibrariesSca(
88
- vulnerableLibraries: ScaReportModel[],
89
- severityCount: SeverityCountModel
90
- ) {
91
- vulnerableLibraries.forEach(lib =>
92
- severityCountAllCVEsSca(lib.vulnerabilities, severityCount)
93
- )
94
- return severityCount
95
- }
96
-
97
- export function severityCountAllCVEsSca(
98
- cveArray: ScaReportVulnerabilityModel[],
99
- severityCount: SeverityCountModel
100
- ) {
101
- const severityCountInner = severityCount
102
- cveArray.forEach(cve => severityCountSingleCVESca(cve, severityCountInner))
103
- return severityCountInner
104
- }
105
-
106
- export function severityCountSingleCVESca(
107
- cve: ScaReportVulnerabilityModel,
108
- severityCount: SeverityCountModel
109
- ) {
110
- if (cve.cvss3Severity === 'CRITICAL' || cve.severity === 'CRITICAL') {
111
- severityCount.critical += 1
112
- } else if (cve.cvss3Severity === 'HIGH' || cve.severity === 'HIGH') {
113
- severityCount.high += 1
114
- } else if (cve.cvss3Severity === 'MEDIUM' || cve.severity === 'MEDIUM') {
115
- severityCount.medium += 1
116
- } else if (cve.cvss3Severity === 'LOW' || cve.severity === 'LOW') {
117
- severityCount.low += 1
118
- } else if (cve.cvss3Severity === 'NOTE' || cve.severity === 'NOTE') {
119
- severityCount.note += 1
120
- }
121
-
122
- return severityCount
123
- }
@@ -1,72 +0,0 @@
1
- const fs = require('fs')
2
- const xml2js = require('xml2js')
3
- const i18n = require('i18n')
4
-
5
- const readAndParseProjectFile = projectFilePath => {
6
- const projectFile = fs.readFileSync(projectFilePath)
7
-
8
- return new xml2js.Parser({
9
- explicitArray: false,
10
- mergeAttrs: true
11
- }).parseString(projectFile)
12
- }
13
-
14
- const readAndParseLockFile = lockFilePath => {
15
- const lockFile = JSON.parse(fs.readFileSync(lockFilePath).toString())
16
-
17
- let count = 0 // Used to test if some nodes are deleted
18
-
19
- for (const dependenciesNode in lockFile.dependencies) {
20
- for (const innerNode in lockFile.dependencies[dependenciesNode]) {
21
- const nodeValidation = JSON.stringify(
22
- lockFile.dependencies[dependenciesNode][innerNode]
23
- )
24
- if (nodeValidation.includes('"type":"Project"')) {
25
- count += 1
26
- delete lockFile.dependencies[dependenciesNode][innerNode]
27
- lockFile.additionalInfo = 'dependenciesNote'
28
- }
29
- }
30
- }
31
-
32
- if (count > 0) {
33
- const multiLevelProjectWarning = () => {
34
- console.log('')
35
- console.log(i18n.__('dependenciesNote'))
36
- }
37
- setTimeout(multiLevelProjectWarning, 7000)
38
- }
39
-
40
- return lockFile
41
- }
42
-
43
- const checkForCorrectFiles = languageFiles => {
44
- if (!languageFiles.includes('packages.lock.json')) {
45
- throw new Error(i18n.__('languageAnalysisHasNoLockFile', '.NET'))
46
- }
47
-
48
- if (!languageFiles.some(i => i.includes('.csproj'))) {
49
- throw new Error(i18n.__('languageAnalysisProjectFileError', '.NET'))
50
- }
51
- }
52
-
53
- const getDotNetDeps = (filePath, languageFiles) => {
54
- checkForCorrectFiles(languageFiles)
55
- const projectFileName = languageFiles.find(fileName =>
56
- fileName.includes('.csproj')
57
- )
58
- const lockFileName = languageFiles.find(fileName =>
59
- fileName.includes('.json')
60
- )
61
- const projectFile = readAndParseProjectFile(filePath + `/${projectFileName}`)
62
- const lockFile = readAndParseLockFile(filePath + `/${lockFileName}`)
63
-
64
- return { projectFile, lockFile }
65
- }
66
-
67
- module.exports = {
68
- getDotNetDeps,
69
- readAndParseProjectFile,
70
- readAndParseLockFile,
71
- checkForCorrectFiles
72
- }
@@ -1,11 +0,0 @@
1
- const { getDotNetDeps } = require('./analysis')
2
- const { createDotNetTSMessage } = require('../common/formatMessage')
3
-
4
- const dotNetAnalysis = (config, languageFiles) => {
5
- const dotNetDeps = getDotNetDeps(config.file, languageFiles.DOTNET)
6
- return createDotNetTSMessage(dotNetDeps)
7
- }
8
-
9
- module.exports = {
10
- dotNetAnalysis
11
- }
@@ -1,26 +0,0 @@
1
- const { createGoTSMessage } = require('../common/formatMessage')
2
- const {
3
- parseDependenciesForSCAServices
4
- } = require('../common/scaParserForGoAndJava')
5
- const goReadDepFile = require('./goReadDepFile')
6
- const goParseDeps = require('./goParseDeps')
7
-
8
- const goAnalysis = config => {
9
- try {
10
- const rawGoDependencies = goReadDepFile.getGoDependencies(config)
11
- const parsedGoDependencies =
12
- goParseDeps.parseGoDependencies(rawGoDependencies)
13
-
14
- if (config.legacy === false) {
15
- return parseDependenciesForSCAServices(parsedGoDependencies)
16
- } else {
17
- return createGoTSMessage(parsedGoDependencies)
18
- }
19
- } catch (e) {
20
- console.log(e.message.toString())
21
- }
22
- }
23
-
24
- module.exports = {
25
- goAnalysis
26
- }