@contrast/contrast 2.0.2-beta.0 → 2.0.2-beta.10

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 (395) hide show
  1. package/README.md +2 -1
  2. package/dist/assess/assessConfig.js +9 -0
  3. package/dist/assess/assessConfig.js.map +1 -0
  4. package/dist/assess/help.js +37 -0
  5. package/dist/assess/help.js.map +1 -0
  6. package/dist/assess/http/index.js +39 -0
  7. package/dist/assess/http/index.js.map +1 -0
  8. package/dist/assess/index.js +69 -0
  9. package/dist/assess/index.js.map +1 -0
  10. package/dist/assess/metadata/findYamlFile.js +59 -0
  11. package/dist/assess/metadata/findYamlFile.js.map +1 -0
  12. package/dist/assess/metadata/index.js +37 -0
  13. package/dist/assess/metadata/index.js.map +1 -0
  14. package/dist/assess/metadata/utils.js +159 -0
  15. package/dist/assess/metadata/utils.js.map +1 -0
  16. package/dist/assess/printing/index.js +11 -0
  17. package/dist/assess/printing/index.js.map +1 -0
  18. package/dist/assess/printing/utils.js +119 -0
  19. package/dist/assess/printing/utils.js.map +1 -0
  20. package/dist/audit/auditConfig.js +9 -0
  21. package/dist/audit/auditConfig.js.map +1 -0
  22. package/dist/{commands/audit → audit}/auditController.js +9 -13
  23. package/dist/audit/auditController.js.map +1 -0
  24. package/dist/audit/auditRequests.js +193 -0
  25. package/dist/audit/auditRequests.js.map +1 -0
  26. package/dist/audit/auditRequestsLegacy.js +63 -0
  27. package/dist/audit/auditRequestsLegacy.js.map +1 -0
  28. package/dist/audit/catalogueApplication/catalogueApplication.js +16 -29
  29. package/dist/audit/catalogueApplication/catalogueApplication.js.map +1 -0
  30. package/dist/audit/help.js +68 -0
  31. package/dist/audit/help.js.map +1 -0
  32. package/dist/audit/languageAnalysisEngine/commonApi.js +12 -14
  33. package/dist/audit/languageAnalysisEngine/commonApi.js.map +1 -0
  34. package/dist/audit/languageAnalysisEngine/filterProjectPath.js +2 -1
  35. package/dist/audit/languageAnalysisEngine/filterProjectPath.js.map +1 -0
  36. package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js +9 -12
  37. package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js.map +1 -0
  38. package/dist/audit/languageAnalysisEngine/sendSnapshot.js +18 -30
  39. package/dist/audit/languageAnalysisEngine/sendSnapshot.js.map +1 -0
  40. package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +9 -9
  41. package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js.map +1 -0
  42. package/dist/audit/processAudit.js +21 -0
  43. package/dist/audit/processAudit.js.map +1 -0
  44. package/dist/audit/report/commonReportingFunctions.js +33 -61
  45. package/dist/audit/report/commonReportingFunctions.js.map +1 -0
  46. package/dist/audit/report/models/reportGuidanceModel.js +2 -5
  47. package/dist/audit/report/models/reportGuidanceModel.js.map +1 -0
  48. package/dist/audit/report/models/reportLibraryModel.js +3 -7
  49. package/dist/audit/report/models/reportLibraryModel.js.map +1 -0
  50. package/dist/audit/report/models/reportListModel.js +4 -9
  51. package/dist/audit/report/models/reportListModel.js.map +1 -0
  52. package/dist/audit/report/models/reportOutputModel.js +4 -9
  53. package/dist/audit/report/models/reportOutputModel.js.map +1 -0
  54. package/dist/audit/report/models/reportSeverityModel.js +2 -5
  55. package/dist/audit/report/models/reportSeverityModel.js.map +1 -0
  56. package/dist/audit/report/models/severityCountModel.js +3 -5
  57. package/dist/audit/report/models/severityCountModel.js.map +1 -0
  58. package/dist/audit/report/reportingFeature.js +27 -55
  59. package/dist/audit/report/reportingFeature.js.map +1 -0
  60. package/dist/audit/report/utils/reportUtils.js +28 -59
  61. package/dist/audit/report/utils/reportUtils.js.map +1 -0
  62. package/dist/audit/save.js +14 -16
  63. package/dist/audit/save.js.map +1 -0
  64. package/dist/{commands/audit → audit}/saveFile.js +3 -6
  65. package/dist/audit/saveFile.js.map +1 -0
  66. package/dist/auth/auth.js +103 -0
  67. package/dist/auth/auth.js.map +1 -0
  68. package/dist/auth/authRequests.js +18 -0
  69. package/dist/auth/authRequests.js.map +1 -0
  70. package/dist/cliConstants.js +48 -18
  71. package/dist/cliConstants.js.map +1 -0
  72. package/dist/commands/config/config.js +12 -13
  73. package/dist/commands/config/config.js.map +1 -0
  74. package/dist/commands/learn/learn.js +3 -6
  75. package/dist/commands/learn/learn.js.map +1 -0
  76. package/dist/commands/learn/processLearn.js +3 -6
  77. package/dist/commands/learn/processLearn.js.map +1 -0
  78. package/dist/common/HTTPClient.js +193 -94
  79. package/dist/common/HTTPClient.js.map +1 -0
  80. package/dist/{scan → common}/autoDetection.js +53 -36
  81. package/dist/common/autoDetection.js.map +1 -0
  82. package/dist/common/baseRequest.js +59 -23
  83. package/dist/common/baseRequest.js.map +1 -0
  84. package/dist/common/commonHelp.js +13 -13
  85. package/dist/common/commonHelp.js.map +1 -0
  86. package/dist/common/errorHandling.js +49 -63
  87. package/dist/common/errorHandling.js.map +1 -0
  88. package/dist/common/fail.js +6 -12
  89. package/dist/common/fail.js.map +1 -0
  90. package/dist/common/stringManipulations.js +8 -0
  91. package/dist/common/stringManipulations.js.map +1 -0
  92. package/dist/common/versionChecker.js +16 -19
  93. package/dist/common/versionChecker.js.map +1 -0
  94. package/dist/constants/constants.js +46 -65
  95. package/dist/constants/constants.js.map +1 -0
  96. package/dist/constants/lambda.js +8 -5
  97. package/dist/constants/lambda.js.map +1 -0
  98. package/dist/constants/locales.js +14 -10
  99. package/dist/constants/locales.js.map +1 -0
  100. package/dist/github/fingerprintConfig.js +10 -0
  101. package/dist/github/fingerprintConfig.js.map +1 -0
  102. package/dist/github/processFingerprint.js +25 -0
  103. package/dist/github/processFingerprint.js.map +1 -0
  104. package/dist/github/projectGroup.js +225 -0
  105. package/dist/github/projectGroup.js.map +1 -0
  106. package/dist/github/repoServices.js +91 -0
  107. package/dist/github/repoServices.js.map +1 -0
  108. package/dist/index.js +42 -39
  109. package/dist/index.js.map +1 -0
  110. package/dist/lambda/analytics.js +6 -9
  111. package/dist/lambda/analytics.js.map +1 -0
  112. package/dist/lambda/arn.js +6 -9
  113. package/dist/lambda/arn.js.map +1 -0
  114. package/dist/lambda/aws.js +29 -34
  115. package/dist/lambda/aws.js.map +1 -0
  116. package/dist/lambda/cliError.js +13 -41
  117. package/dist/lambda/cliError.js.map +1 -0
  118. package/dist/lambda/constants.js +3 -4
  119. package/dist/lambda/constants.js.map +1 -0
  120. package/dist/lambda/help.js +39 -44
  121. package/dist/lambda/help.js.map +1 -0
  122. package/dist/lambda/lambda.js +61 -65
  123. package/dist/lambda/lambda.js.map +1 -0
  124. package/dist/lambda/lambdaUtils.js +38 -32
  125. package/dist/lambda/lambdaUtils.js.map +1 -0
  126. package/dist/lambda/logUtils.js +21 -17
  127. package/dist/lambda/logUtils.js.map +1 -0
  128. package/dist/lambda/scanDetailCompletion.js +19 -25
  129. package/dist/lambda/scanDetailCompletion.js.map +1 -0
  130. package/dist/lambda/scanRequest.js +34 -41
  131. package/dist/lambda/scanRequest.js.map +1 -0
  132. package/dist/lambda/scanResults.js +8 -10
  133. package/dist/lambda/scanResults.js.map +1 -0
  134. package/dist/lambda/types.js +5 -7
  135. package/dist/lambda/types.js.map +1 -0
  136. package/dist/lambda/utils.js +33 -35
  137. package/dist/lambda/utils.js.map +1 -0
  138. package/dist/sbom/generateSbom.js +6 -10
  139. package/dist/sbom/generateSbom.js.map +1 -0
  140. package/dist/scaAnalysis/common/auditReport.js +8 -12
  141. package/dist/scaAnalysis/common/auditReport.js.map +1 -0
  142. package/dist/scaAnalysis/common/commonReportingFunctionsSca.js +26 -32
  143. package/dist/scaAnalysis/common/commonReportingFunctionsSca.js.map +1 -0
  144. package/dist/scaAnalysis/common/formatMessage.js +8 -17
  145. package/dist/scaAnalysis/common/formatMessage.js.map +1 -0
  146. package/dist/scaAnalysis/common/models/ScaReportModel.js +4 -9
  147. package/dist/scaAnalysis/common/models/ScaReportModel.js.map +1 -0
  148. package/dist/scaAnalysis/common/scaParserForGoAndJava.js +10 -9
  149. package/dist/scaAnalysis/common/scaParserForGoAndJava.js.map +1 -0
  150. package/dist/scaAnalysis/common/scaServicesUpload.js +59 -90
  151. package/dist/scaAnalysis/common/scaServicesUpload.js.map +1 -0
  152. package/dist/scaAnalysis/common/treeUpload.js +15 -25
  153. package/dist/scaAnalysis/common/treeUpload.js.map +1 -0
  154. package/dist/scaAnalysis/common/utils/reportUtilsSca.js +21 -29
  155. package/dist/scaAnalysis/common/utils/reportUtilsSca.js.map +1 -0
  156. package/dist/scaAnalysis/dotnet/analysis.js +12 -18
  157. package/dist/scaAnalysis/dotnet/analysis.js.map +1 -0
  158. package/dist/scaAnalysis/dotnet/index.js +4 -7
  159. package/dist/scaAnalysis/dotnet/index.js.map +1 -0
  160. package/dist/scaAnalysis/go/goAnalysis.js +8 -11
  161. package/dist/scaAnalysis/go/goAnalysis.js.map +1 -0
  162. package/dist/scaAnalysis/go/goParseDeps.js +9 -7
  163. package/dist/scaAnalysis/go/goParseDeps.js.map +1 -0
  164. package/dist/scaAnalysis/go/goReadDepFile.js +10 -8
  165. package/dist/scaAnalysis/go/goReadDepFile.js.map +1 -0
  166. package/dist/scaAnalysis/java/analysis.js +23 -20
  167. package/dist/scaAnalysis/java/analysis.js.map +1 -0
  168. package/dist/scaAnalysis/java/index.js +7 -10
  169. package/dist/scaAnalysis/java/index.js.map +1 -0
  170. package/dist/scaAnalysis/java/javaBuildDepsParser.js +43 -43
  171. package/dist/scaAnalysis/java/javaBuildDepsParser.js.map +1 -0
  172. package/dist/scaAnalysis/javascript/analysis.js +16 -20
  173. package/dist/scaAnalysis/javascript/analysis.js.map +1 -0
  174. package/dist/scaAnalysis/javascript/index.js +17 -19
  175. package/dist/scaAnalysis/javascript/index.js.map +1 -0
  176. package/dist/scaAnalysis/javascript/scaServiceParser.js +8 -15
  177. package/dist/scaAnalysis/javascript/scaServiceParser.js.map +1 -0
  178. package/dist/scaAnalysis/legacy/legacyFlow.js +13 -15
  179. package/dist/scaAnalysis/legacy/legacyFlow.js.map +1 -0
  180. package/dist/scaAnalysis/php/analysis.js +15 -16
  181. package/dist/scaAnalysis/php/analysis.js.map +1 -0
  182. package/dist/scaAnalysis/php/index.js +5 -8
  183. package/dist/scaAnalysis/php/index.js.map +1 -0
  184. package/dist/scaAnalysis/php/phpNewServicesMapper.js +9 -12
  185. package/dist/scaAnalysis/php/phpNewServicesMapper.js.map +1 -0
  186. package/dist/scaAnalysis/processServicesFlow.js +86 -32
  187. package/dist/scaAnalysis/processServicesFlow.js.map +1 -0
  188. package/dist/scaAnalysis/python/analysis.js +16 -23
  189. package/dist/scaAnalysis/python/analysis.js.map +1 -0
  190. package/dist/scaAnalysis/python/index.js +4 -7
  191. package/dist/scaAnalysis/python/index.js.map +1 -0
  192. package/dist/scaAnalysis/repoMode/gradleParser.js +7 -13
  193. package/dist/scaAnalysis/repoMode/gradleParser.js.map +1 -0
  194. package/dist/scaAnalysis/repoMode/index.js +9 -12
  195. package/dist/scaAnalysis/repoMode/index.js.map +1 -0
  196. package/dist/scaAnalysis/repoMode/mavenParser.js +109 -73
  197. package/dist/scaAnalysis/repoMode/mavenParser.js.map +1 -0
  198. package/dist/scaAnalysis/ruby/analysis.js +32 -46
  199. package/dist/scaAnalysis/ruby/analysis.js.map +1 -0
  200. package/dist/scaAnalysis/ruby/index.js +5 -8
  201. package/dist/scaAnalysis/ruby/index.js.map +1 -0
  202. package/dist/scaAnalysis/scaAnalysis.js +49 -51
  203. package/dist/scaAnalysis/scaAnalysis.js.map +1 -0
  204. package/dist/scan/fileUtils.js +36 -40
  205. package/dist/scan/fileUtils.js.map +1 -0
  206. package/dist/scan/formatScanOutput.js +47 -61
  207. package/dist/scan/formatScanOutput.js.map +1 -0
  208. package/dist/scan/help.js +8 -11
  209. package/dist/scan/help.js.map +1 -0
  210. package/dist/scan/models/groupedResultsModel.js +2 -5
  211. package/dist/scan/models/groupedResultsModel.js.map +1 -0
  212. package/dist/scan/models/resultContentModel.js +2 -2
  213. package/dist/scan/models/resultContentModel.js.map +1 -0
  214. package/dist/scan/models/scanResultsModel.js +2 -5
  215. package/dist/scan/models/scanResultsModel.js.map +1 -0
  216. package/dist/scan/populateProjectIdAndProjectName.js +22 -60
  217. package/dist/scan/populateProjectIdAndProjectName.js.map +1 -0
  218. package/dist/scan/processScan.js +28 -0
  219. package/dist/scan/processScan.js.map +1 -0
  220. package/dist/scan/saveResults.js +3 -6
  221. package/dist/scan/saveResults.js.map +1 -0
  222. package/dist/scan/scan.js +33 -53
  223. package/dist/scan/scan.js.map +1 -0
  224. package/dist/scan/scanConfig.js +14 -12
  225. package/dist/scan/scanConfig.js.map +1 -0
  226. package/dist/scan/scanController.js +19 -21
  227. package/dist/scan/scanController.js.map +1 -0
  228. package/dist/scan/scanRequests.js +86 -0
  229. package/dist/scan/scanRequests.js.map +1 -0
  230. package/dist/scan/scanResults.js +26 -72
  231. package/dist/scan/scanResults.js.map +1 -0
  232. package/dist/telemetry/telemetry.js +29 -59
  233. package/dist/telemetry/telemetry.js.map +1 -0
  234. package/dist/utils/capabilities.js +2 -1
  235. package/dist/utils/capabilities.js.map +1 -0
  236. package/dist/utils/commonApi.js +58 -50
  237. package/dist/utils/commonApi.js.map +1 -0
  238. package/dist/utils/filterProjectPath.js +2 -1
  239. package/dist/utils/filterProjectPath.js.map +1 -0
  240. package/dist/utils/generalAPI.js +11 -33
  241. package/dist/utils/generalAPI.js.map +1 -0
  242. package/dist/utils/getConfig.js +8 -13
  243. package/dist/utils/getConfig.js.map +1 -0
  244. package/dist/utils/oraWrapper.js +7 -14
  245. package/dist/utils/oraWrapper.js.map +1 -0
  246. package/dist/utils/paramsUtil/commandlineParams.js +2 -5
  247. package/dist/utils/paramsUtil/commandlineParams.js.map +1 -0
  248. package/dist/utils/paramsUtil/configStoreParams.js +9 -10
  249. package/dist/utils/paramsUtil/configStoreParams.js.map +1 -0
  250. package/dist/utils/paramsUtil/envVariableParams.js +2 -3
  251. package/dist/utils/paramsUtil/envVariableParams.js.map +1 -0
  252. package/dist/utils/paramsUtil/paramHandler.js +12 -13
  253. package/dist/utils/paramsUtil/paramHandler.js.map +1 -0
  254. package/dist/utils/parsedCLIOptions.js +4 -7
  255. package/dist/utils/parsedCLIOptions.js.map +1 -0
  256. package/dist/utils/requestUtils.js +7 -13
  257. package/dist/utils/requestUtils.js.map +1 -0
  258. package/dist/utils/saveFile.js +8 -11
  259. package/dist/utils/saveFile.js.map +1 -0
  260. package/dist/utils/validationCheck.js +5 -11
  261. package/dist/utils/validationCheck.js.map +1 -0
  262. package/package.json +40 -48
  263. package/.prettierignore +0 -1
  264. package/bin/contrast.js +0 -2
  265. package/dist/audit/languageAnalysisEngine/util/requestUtils.js +0 -14
  266. package/dist/commands/audit/auditConfig.js +0 -12
  267. package/dist/commands/audit/help.js +0 -70
  268. package/dist/commands/audit/processAudit.js +0 -24
  269. package/dist/commands/auth/auth.js +0 -120
  270. package/dist/commands/github/fingerprintConfig.js +0 -13
  271. package/dist/commands/github/processFingerprint.js +0 -28
  272. package/dist/commands/github/projectGroup.js +0 -254
  273. package/dist/commands/github/repoServices.js +0 -108
  274. package/dist/commands/scan/processScan.js +0 -31
  275. package/dist/lambda/__mocks__/aws.js +0 -21
  276. package/dist/lambda/__mocks__/lambdaConfig.json +0 -42
  277. package/src/audit/catalogueApplication/catalogueApplication.js +0 -51
  278. package/src/audit/languageAnalysisEngine/commonApi.js +0 -20
  279. package/src/audit/languageAnalysisEngine/filterProjectPath.js +0 -21
  280. package/src/audit/languageAnalysisEngine/getProjectRootFilenames.js +0 -36
  281. package/src/audit/languageAnalysisEngine/sendSnapshot.js +0 -57
  282. package/src/audit/languageAnalysisEngine/util/requestUtils.js +0 -17
  283. package/src/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +0 -63
  284. package/src/audit/report/commonReportingFunctions.js +0 -412
  285. package/src/audit/report/models/reportGuidanceModel.ts +0 -5
  286. package/src/audit/report/models/reportLibraryModel.ts +0 -30
  287. package/src/audit/report/models/reportListModel.ts +0 -49
  288. package/src/audit/report/models/reportOutputModel.ts +0 -29
  289. package/src/audit/report/models/reportSeverityModel.ts +0 -18
  290. package/src/audit/report/models/severityCountModel.ts +0 -22
  291. package/src/audit/report/reportingFeature.ts +0 -110
  292. package/src/audit/report/utils/reportUtils.ts +0 -165
  293. package/src/audit/save.js +0 -67
  294. package/src/cliConstants.js +0 -522
  295. package/src/commands/audit/auditConfig.js +0 -18
  296. package/src/commands/audit/auditController.js +0 -50
  297. package/src/commands/audit/help.js +0 -72
  298. package/src/commands/audit/processAudit.js +0 -34
  299. package/src/commands/audit/saveFile.js +0 -15
  300. package/src/commands/auth/auth.js +0 -146
  301. package/src/commands/config/config.js +0 -41
  302. package/src/commands/github/fingerprintConfig.js +0 -19
  303. package/src/commands/github/processFingerprint.js +0 -37
  304. package/src/commands/github/projectGroup.js +0 -294
  305. package/src/commands/github/repoServices.js +0 -122
  306. package/src/commands/learn/learn.js +0 -10
  307. package/src/commands/learn/processLearn.js +0 -13
  308. package/src/commands/scan/processScan.js +0 -42
  309. package/src/common/HTTPClient.js +0 -775
  310. package/src/common/baseRequest.ts +0 -83
  311. package/src/common/commonHelp.js +0 -53
  312. package/src/common/errorHandling.js +0 -157
  313. package/src/common/fail.js +0 -79
  314. package/src/common/versionChecker.js +0 -75
  315. package/src/constants/constants.js +0 -71
  316. package/src/constants/lambda.js +0 -85
  317. package/src/constants/locales.js +0 -365
  318. package/src/index.ts +0 -142
  319. package/src/lambda/__mocks__/aws.ts +0 -32
  320. package/src/lambda/__mocks__/lambdaConfig.json +0 -42
  321. package/src/lambda/analytics.ts +0 -9
  322. package/src/lambda/arn.ts +0 -33
  323. package/src/lambda/aws.ts +0 -248
  324. package/src/lambda/cliError.ts +0 -72
  325. package/src/lambda/constants.ts +0 -11
  326. package/src/lambda/help.ts +0 -92
  327. package/src/lambda/lambda.ts +0 -230
  328. package/src/lambda/lambdaUtils.ts +0 -111
  329. package/src/lambda/logUtils.ts +0 -64
  330. package/src/lambda/scanDetailCompletion.ts +0 -78
  331. package/src/lambda/scanRequest.ts +0 -169
  332. package/src/lambda/scanResults.ts +0 -29
  333. package/src/lambda/types.ts +0 -36
  334. package/src/lambda/utils.ts +0 -188
  335. package/src/sbom/generateSbom.ts +0 -45
  336. package/src/scaAnalysis/common/auditReport.js +0 -59
  337. package/src/scaAnalysis/common/commonReportingFunctionsSca.js +0 -276
  338. package/src/scaAnalysis/common/formatMessage.js +0 -67
  339. package/src/scaAnalysis/common/models/ScaReportModel.ts +0 -81
  340. package/src/scaAnalysis/common/scaParserForGoAndJava.js +0 -41
  341. package/src/scaAnalysis/common/scaServicesUpload.js +0 -155
  342. package/src/scaAnalysis/common/treeUpload.js +0 -51
  343. package/src/scaAnalysis/common/utils/reportUtilsSca.ts +0 -123
  344. package/src/scaAnalysis/dotnet/analysis.js +0 -72
  345. package/src/scaAnalysis/dotnet/index.js +0 -11
  346. package/src/scaAnalysis/go/goAnalysis.js +0 -26
  347. package/src/scaAnalysis/go/goParseDeps.js +0 -203
  348. package/src/scaAnalysis/go/goReadDepFile.js +0 -34
  349. package/src/scaAnalysis/java/analysis.js +0 -148
  350. package/src/scaAnalysis/java/index.js +0 -29
  351. package/src/scaAnalysis/java/javaBuildDepsParser.js +0 -439
  352. package/src/scaAnalysis/javascript/analysis.js +0 -111
  353. package/src/scaAnalysis/javascript/index.js +0 -104
  354. package/src/scaAnalysis/javascript/scaServiceParser.js +0 -151
  355. package/src/scaAnalysis/legacy/legacyFlow.js +0 -43
  356. package/src/scaAnalysis/php/analysis.js +0 -78
  357. package/src/scaAnalysis/php/index.js +0 -28
  358. package/src/scaAnalysis/php/phpNewServicesMapper.js +0 -77
  359. package/src/scaAnalysis/processServicesFlow.js +0 -119
  360. package/src/scaAnalysis/python/analysis.js +0 -93
  361. package/src/scaAnalysis/python/index.js +0 -16
  362. package/src/scaAnalysis/repoMode/gradleParser.js +0 -88
  363. package/src/scaAnalysis/repoMode/index.js +0 -21
  364. package/src/scaAnalysis/repoMode/mavenParser.js +0 -112
  365. package/src/scaAnalysis/ruby/analysis.js +0 -413
  366. package/src/scaAnalysis/ruby/index.js +0 -16
  367. package/src/scaAnalysis/scaAnalysis.js +0 -171
  368. package/src/scan/autoDetection.js +0 -175
  369. package/src/scan/fileUtils.js +0 -206
  370. package/src/scan/formatScanOutput.ts +0 -225
  371. package/src/scan/help.js +0 -56
  372. package/src/scan/models/groupedResultsModel.ts +0 -20
  373. package/src/scan/models/resultContentModel.ts +0 -86
  374. package/src/scan/models/scanResultsModel.ts +0 -55
  375. package/src/scan/populateProjectIdAndProjectName.js +0 -73
  376. package/src/scan/saveResults.js +0 -14
  377. package/src/scan/scan.ts +0 -68
  378. package/src/scan/scanConfig.js +0 -58
  379. package/src/scan/scanController.js +0 -98
  380. package/src/scan/scanResults.js +0 -171
  381. package/src/telemetry/telemetry.ts +0 -154
  382. package/src/utils/capabilities.js +0 -12
  383. package/src/utils/commonApi.js +0 -103
  384. package/src/utils/filterProjectPath.js +0 -25
  385. package/src/utils/generalAPI.js +0 -52
  386. package/src/utils/getConfig.ts +0 -34
  387. package/src/utils/oraWrapper.js +0 -29
  388. package/src/utils/paramsUtil/commandlineParams.js +0 -12
  389. package/src/utils/paramsUtil/configStoreParams.js +0 -19
  390. package/src/utils/paramsUtil/envVariableParams.js +0 -10
  391. package/src/utils/paramsUtil/paramHandler.js +0 -38
  392. package/src/utils/parsedCLIOptions.js +0 -32
  393. package/src/utils/requestUtils.js +0 -29
  394. package/src/utils/saveFile.js +0 -20
  395. package/src/utils/validationCheck.js +0 -39
@@ -1,83 +0,0 @@
1
- import { HttpsProxyAgent } from 'hpagent'
2
- import fs from 'fs'
3
- import got, { Options } from 'got'
4
- import { Agents, HTTPSOptions } from 'got/dist/source/core'
5
-
6
- export function gotInstance(config: any) {
7
- return got.extend({ retry: { limit: 0 }, ...buildBaseRequestOptions(config) })
8
- }
9
-
10
- export function buildBaseRequestOptions(config: any) {
11
- const { apiKey, authorization } = config
12
- const rejectUnauthorized = !config.certSelfSigned
13
-
14
- const superApiKey = config.superApiKey
15
- const superAuthToken = config.superAuthorization
16
-
17
- const requestOptions = {
18
- responseType: 'json',
19
- forever: true,
20
- uri: config.host,
21
- followRedirect: false,
22
- headers: {
23
- 'Content-Type': 'application/json; charset=utf-8',
24
- Authorization: authorization,
25
- 'API-Key': apiKey,
26
- SuperAuthorization: superAuthToken,
27
- 'Super-API-Key': superApiKey,
28
- 'User-Agent': 'contrast-cli-v2'
29
- },
30
- agent: getAgent(config)
31
- } as Options
32
-
33
- requestOptions.https = {
34
- rejectUnauthorized: rejectUnauthorized
35
- }
36
-
37
- maybeAddCertsToRequest(config, requestOptions.https)
38
- return requestOptions
39
- }
40
-
41
- function getAgent(config: any) {
42
- return config.proxy
43
- ? (new HttpsProxyAgent({ proxy: config.proxy }) as Agents)
44
- : false
45
- }
46
-
47
- function maybeAddCertsToRequest(config: any, https: HTTPSOptions) {
48
- // cacert
49
- const caCertFilePath = config.cacert
50
- if (caCertFilePath) {
51
- try {
52
- https.certificateAuthority = fs.readFileSync(caCertFilePath)
53
- } catch (error: any) {
54
- throw new Error(
55
- `Unable to read CA from ${caCertFilePath}, msg: ${error.message}`
56
- )
57
- }
58
- }
59
-
60
- // cert
61
- const certPath = config.cert
62
- if (certPath) {
63
- try {
64
- https.certificate = fs.readFileSync(certPath)
65
- } catch (error: any) {
66
- throw new Error(
67
- `Unable to read Certificate PEM file from config option contrast.api.certificate.cert_file='${certPath}', msg: ${error.message}`
68
- )
69
- }
70
- }
71
-
72
- // key
73
- const keyPath = config.key
74
- if (keyPath) {
75
- try {
76
- https.key = fs.readFileSync(keyPath)
77
- } catch (error: any) {
78
- throw new Error(
79
- `Unable to read Key PEM file from config option contrast.api.certificate.key_file='${keyPath}', msg: ${error.message}`
80
- )
81
- }
82
- }
83
- }
@@ -1,53 +0,0 @@
1
- const i18n = require('i18n')
2
- const chalk = require('chalk')
3
-
4
- const commonHelpLinks = () => {
5
- return [
6
- {
7
- header: i18n.__('commonHelpHeader'),
8
- content: [
9
- i18n.__('commonHelpCheckOutHeader') + i18n.__('commonHelpCheckOutText'),
10
- i18n.__('commonHelpLearnMoreHeader') +
11
- i18n.__('commonHelpLearnMoreText'),
12
- i18n.__('commonHelpJoinDiscussionHeader') +
13
- i18n.__('commonHelpJoinDiscussionText')
14
- ]
15
- },
16
- {
17
- header: i18n.__('commonHelpEnterpriseHeader'),
18
- content: [
19
- i18n.__('commonHelpLearnMoreEnterpriseHeader') +
20
- i18n.__('commonHelpLearnMoreEnterpriseText')
21
- ]
22
- },
23
- {
24
- content: [
25
- i18n.__('commonHelpLearnHeader') + i18n.__('commonHelpLearnText')
26
- ]
27
- }
28
- ]
29
- }
30
-
31
- const postRunMessage = commandName => {
32
- console.log('\n' + chalk.underline.bold('Other Features:'))
33
- if (commandName !== 'scan')
34
- console.log(
35
- "'contrast scan' to run Contrast's industry leading SAST scanner"
36
- )
37
- if (commandName !== 'audit')
38
- console.log(
39
- "'contrast audit' to find vulnerabilities in your open source dependencies"
40
- )
41
- if (commandName !== 'lambda')
42
- console.log("'contrast lambda' to secure your AWS serverless functions")
43
-
44
- if (commandName !== 'learn')
45
- console.log(
46
- "'contrast learn' launches Contrast's Secure Code Learning Hub."
47
- )
48
- }
49
-
50
- module.exports = {
51
- commonHelpLinks,
52
- postRunMessage
53
- }
@@ -1,157 +0,0 @@
1
- const i18n = require('i18n')
2
- const chalk = require('chalk')
3
-
4
- const libraryAnalysisError = () => {
5
- console.log(i18n.__('libraryAnalysisError'))
6
- }
7
-
8
- const snapshotFailureError = () => {
9
- console.log(i18n.__('snapshotFailureMessage'))
10
- }
11
-
12
- const vulnerabilitiesFailureError = () => {
13
- console.log(i18n.__('vulnerabilitiesFailureMessage'))
14
- }
15
-
16
- const reportFailureError = () => {
17
- console.log(i18n.__('auditReportFailureMessage'))
18
- }
19
-
20
- const genericError = () => {
21
- console.error(i18n.__('genericErrorMessage'))
22
- process.exit(1)
23
- }
24
-
25
- const unauthenticatedError = () => {
26
- generalError('unauthenticatedErrorHeader', 'unauthenticatedErrorMessage')
27
- }
28
-
29
- const badRequestError = catalogue => {
30
- catalogue === true
31
- ? generalError('badRequestErrorHeader', 'badRequestCatalogueErrorMessage')
32
- : generalError('badRequestErrorHeader', 'badRequestErrorMessage')
33
- }
34
-
35
- const forbiddenError = () => {
36
- generalError('forbiddenRequestErrorHeader', 'forbiddenRequestErrorMessage')
37
- process.exit(1)
38
- }
39
-
40
- const proxyError = () => {
41
- generalError('proxyErrorHeader', 'proxyErrorMessage')
42
- }
43
-
44
- const maxAppError = () => {
45
- generalError(
46
- 'No applications remaining',
47
- 'You have reached the maximum number of application you can create.'
48
- )
49
- process.exit(1)
50
- }
51
-
52
- const parametersError = () => {
53
- generalError(
54
- `Credentials not recognized`,
55
- 'Check your command & keys again for hidden characters / verify that the credentials are correct.\nFor more information use contrast help.'
56
- )
57
- process.exit(1)
58
- }
59
-
60
- const invalidHostNameError = () => {
61
- generalError(
62
- `Invalid host`,
63
- 'Check that the host parameter does not include a trailing "/".'
64
- )
65
- process.exit(1)
66
- }
67
-
68
- const failOptionError = () => {
69
- console.log(
70
- '\n ******************************** ' +
71
- i18n.__('snapshotFailureHeader') +
72
- ' ********************************\n' +
73
- i18n.__('failOptionErrorMessage')
74
- )
75
- }
76
-
77
- /**
78
- * You don't have to pass `i18n` translation.
79
- * String that didn't exists on translations will pass as regular string
80
- * @param header title for the error
81
- * @param message message for the error
82
- * @returns error in general format
83
- */
84
- const getErrorMessage = (header, message) => {
85
- // prettier-ignore
86
- const title = `******************************** ${i18n.__(header)} ********************************`
87
- const multiLine = message?.includes('\n')
88
- let finalMessage = ''
89
-
90
- // i18n split the line if it includes '\n'
91
- if (multiLine) {
92
- finalMessage = `\n${message}`
93
- } else if (message) {
94
- finalMessage = `\n${i18n.__(message)}`
95
- }
96
-
97
- return `${title}${finalMessage}`
98
- }
99
-
100
- const generalError = (header, message) => {
101
- const finalMessage = getErrorMessage(header, message)
102
- console.log(finalMessage)
103
- }
104
-
105
- const findCommandOnError = unknownOptions => {
106
- const commandKeywords = {
107
- auth: 'auth',
108
- audit: 'audit',
109
- scan: 'scan',
110
- lambda: 'lambda',
111
- config: 'config'
112
- }
113
-
114
- const containsCommandKeyword = unknownOptions.some(
115
- command => commandKeywords[command]
116
- )
117
-
118
- if (containsCommandKeyword) {
119
- const foundCommands = unknownOptions.filter(
120
- command => commandKeywords[command]
121
- )
122
-
123
- //return the first command found
124
- return foundCommands[0]
125
- }
126
- }
127
-
128
- const commonMessageFormatter = (message, fail) => {
129
- console.log(chalk.bold(i18n.__(message.title)))
130
- console.log(i18n.__(message.body))
131
- if (message.extra) {
132
- console.log(i18n.__(message.extra))
133
- }
134
- if (fail) {
135
- process.exit(1)
136
- }
137
- }
138
-
139
- module.exports = {
140
- genericError,
141
- unauthenticatedError,
142
- badRequestError,
143
- forbiddenError,
144
- proxyError,
145
- failOptionError,
146
- generalError,
147
- getErrorMessage,
148
- libraryAnalysisError,
149
- findCommandOnError,
150
- snapshotFailureError,
151
- vulnerabilitiesFailureError,
152
- reportFailureError,
153
- maxAppError,
154
- parametersError,
155
- invalidHostNameError,
156
- commonMessageFormatter
157
- }
@@ -1,79 +0,0 @@
1
- const i18n = require('i18n')
2
-
3
- const processFail = (config, reportResults) => {
4
- if (config.severity !== undefined) {
5
- if (
6
- reportResults[config.severity] !== undefined &&
7
- isSeverityViolation(config.severity, reportResults)
8
- ) {
9
- failPipeline('failSeverityOptionErrorMessage')
10
- }
11
- }
12
-
13
- if (config.severity === undefined && reportResults.total > 0) {
14
- failPipeline('failThresholdOptionErrorMessage')
15
- }
16
- }
17
-
18
- const isSeverityViolation = (severity, reportResults) => {
19
- let count = 0
20
- switch (severity) {
21
- case 'critical':
22
- count += reportResults.critical
23
- break
24
- case 'high':
25
- count += reportResults.high + reportResults.critical
26
- break
27
- case 'medium':
28
- count +=
29
- reportResults.medium + reportResults.high + reportResults.critical
30
- break
31
- case 'low':
32
- count +=
33
- reportResults.high +
34
- reportResults.critical +
35
- reportResults.medium +
36
- reportResults.low
37
- break
38
- case 'note':
39
- if (reportResults.note == reportResults.total) {
40
- count = 0
41
- } else {
42
- count = reportResults.total
43
- }
44
- break
45
- default:
46
- count = 0
47
- }
48
- return count > 0
49
- }
50
-
51
- const failPipeline = (message = '') => {
52
- console.log(
53
- '\n ******************************** ' +
54
- i18n.__('snapshotFailureHeader') +
55
- ' *********************************\n' +
56
- i18n.__(message)
57
- )
58
- process.exit(2)
59
- }
60
-
61
- const parseSeverity = severity => {
62
- const severities = ['NOTE', 'LOW', 'MEDIUM', 'HIGH', 'CRITICAL']
63
- if (severities.includes(severity.toUpperCase())) {
64
- return severity.toLowerCase()
65
- } else {
66
- console.log(
67
- severity +
68
- ' Not recognised as a severity type please use LOW, MEDIUM, HIGH, CRITICAL, NOTE'
69
- )
70
- return undefined
71
- }
72
- }
73
-
74
- module.exports = {
75
- failPipeline,
76
- processFail,
77
- isSeverityViolation,
78
- parseSeverity
79
- }
@@ -1,75 +0,0 @@
1
- const { APP_VERSION } = require('../constants/constants')
2
- const boxen = require('boxen')
3
- const chalk = require('chalk')
4
- const semver = require('semver')
5
- const commonApi = require('../utils/commonApi')
6
- const { constants } = require('http2')
7
-
8
- const getLatestVersion = async config => {
9
- const client = commonApi.getHttpClient(config)
10
- try {
11
- const res = await client.getLatestVersion()
12
- if (res.statusCode === constants.HTTP_STATUS_OK) {
13
- return res.body
14
- }
15
- } catch (e) {
16
- return undefined
17
- }
18
- }
19
-
20
- const findLatestCLIVersion = async config => {
21
- const isCI = process.env.CONTRAST_CODESEC_CI
22
- ? JSON.parse(process.env.CONTRAST_CODESEC_CI.toLowerCase())
23
- : false
24
-
25
- if (!isCI) {
26
- let latestCLIVersion = await getLatestVersion(config)
27
-
28
- if (latestCLIVersion === undefined) {
29
- config.set('numOfRuns', 0)
30
- console.log(
31
- 'Failed to retrieve latest version info. Continuing execution.'
32
- )
33
- return
34
- }
35
-
36
- //strip key and remove new lines
37
- latestCLIVersion = latestCLIVersion.substring(8).replace('\n', '')
38
-
39
- if (semver.lt(APP_VERSION, latestCLIVersion)) {
40
- const updateAvailableMessage = `Update available ${chalk.yellow(
41
- APP_VERSION
42
- )} → ${chalk.green(latestCLIVersion)}`
43
-
44
- const npmUpdateAvailableCommand = `Run ${chalk.cyan(
45
- 'npm i @contrast/contrast -g'
46
- )} to update via npm`
47
-
48
- const homebrewUpdateAvailableCommand = `Run ${chalk.cyan(
49
- 'brew install contrastsecurity/tap/contrast'
50
- )} to update via brew`
51
-
52
- console.log(
53
- boxen(
54
- `${updateAvailableMessage}\n${npmUpdateAvailableCommand}\n\n${homebrewUpdateAvailableCommand}`,
55
- {
56
- titleAlignment: 'center',
57
- margin: 1,
58
- padding: 1,
59
- align: 'center'
60
- }
61
- )
62
- )
63
- }
64
- }
65
- }
66
-
67
- const isCorrectNodeVersion = async currentVersion => {
68
- return semver.satisfies(currentVersion, '>=16')
69
- }
70
-
71
- module.exports = {
72
- getLatestVersion,
73
- findLatestCLIVersion,
74
- isCorrectNodeVersion
75
- }
@@ -1,71 +0,0 @@
1
- // Language identifiers
2
- const NODE = 'NODE'
3
- const DOTNET = 'DOTNET'
4
- const JAVA = 'JAVA'
5
- const RUBY = 'RUBY'
6
- const PYTHON = 'PYTHON'
7
- const GO = 'GO'
8
- const PHP = 'PHP'
9
- const JAVASCRIPT = 'JAVASCRIPT'
10
- // Severity
11
- const LOW = 'LOW'
12
- const MEDIUM = 'MEDIUM'
13
- const HIGH = 'HIGH'
14
- const CRITICAL = 'CRITICAL'
15
- // App
16
- const APP_NAME = 'contrast'
17
- const APP_VERSION = '2.0.2-beta.0'
18
- const TIMEOUT = 120000
19
- const HIGH_COLOUR = '#ff9900'
20
- const CRITICAL_COLOUR = '#e35858'
21
- const MEDIUM_COLOUR = '#f1c232'
22
- const LOW_COLOUR = '#b7b7b7'
23
- const NOTE_COLOUR = '#999999'
24
- const CRITICAL_PRIORITY = 1
25
- const HIGH_PRIORITY = 2
26
- const MEDIUM_PRIORITY = 3
27
- const LOW_PRIORITY = 4
28
- const NOTE_PRIORITY = 5
29
-
30
- const AUTH_UI_URL = 'https://cli-auth.contrastsecurity.com'
31
- const AUTH_CALLBACK_URL = 'https://cli-auth-api.contrastsecurity.com'
32
- const SARIF_FILE = 'SARIF'
33
- const SBOM_CYCLONE_DX_FILE = 'CYCLONEDX'
34
- const SBOM_SPDX_FILE = 'SPDX'
35
- const CE_URL = 'https://ce.contrastsecurity.com'
36
-
37
- //configuration
38
- const SAAS = 'SAAS'
39
- const EOP = 'EOP'
40
- const MODE_REPO = 'REPO'
41
-
42
- module.exports = {
43
- supportedLanguages: { NODE, DOTNET, JAVA, RUBY, PYTHON, GO, PHP, JAVASCRIPT },
44
- supportedLanguagesScan: { JAVASCRIPT, DOTNET, JAVA },
45
- LOW,
46
- MEDIUM,
47
- HIGH,
48
- CRITICAL,
49
- APP_VERSION,
50
- APP_NAME,
51
- TIMEOUT,
52
- AUTH_UI_URL,
53
- AUTH_CALLBACK_URL,
54
- SARIF_FILE,
55
- HIGH_COLOUR,
56
- CRITICAL_COLOUR,
57
- MEDIUM_COLOUR,
58
- LOW_COLOUR,
59
- NOTE_COLOUR,
60
- CE_URL,
61
- CRITICAL_PRIORITY,
62
- HIGH_PRIORITY,
63
- MEDIUM_PRIORITY,
64
- LOW_PRIORITY,
65
- NOTE_PRIORITY,
66
- SBOM_CYCLONE_DX_FILE,
67
- SBOM_SPDX_FILE,
68
- SAAS,
69
- EOP,
70
- MODE_REPO
71
- }
@@ -1,85 +0,0 @@
1
- const lambda = {
2
- failedToStartScan: 'Failed to start scan',
3
- failedToParseArn: 'Failed to parse ARN',
4
- failedToGetScan: 'Failed to get scan',
5
- missingLambdaConfig: 'Missing Lambda Configuration',
6
- missingLambdaArn: 'Missing Lambda ARN',
7
- validationFailed: 'Request validation failed',
8
- missingFunctionName:
9
- 'Required parameter --function-name is missing.\nRun command with --help to see usage',
10
- failedToGetResults: 'Failed to get results',
11
- missingResults: 'Missing vulnerabilities',
12
- awsError: 'AWS error',
13
- missingFlagArguments:
14
- 'The following flags are missing an arguments:\n{{flags}}',
15
- notSupportedFlags:
16
- 'The following flags are not supported:\n{{flags}}\nRun command with --help to see usage',
17
- layerNotFound:
18
- 'The layer {{layerArn}} could not be found. The scan will continue without it',
19
-
20
- // ====== general ===== //
21
- noVulnerabilitiesFound: '👏 No vulnerabilities found',
22
- scanCompleted: '----- Scan completed {{time}}s -----',
23
- sendingScanRequest:
24
- '{{icon}} Sending Lambda Function scan request to Contrast',
25
- scanRequestedSuccessfully: '{{icon}} Scan requested successfully',
26
- fetchingConfiguration:
27
- '{{icon}} Fetching configuration and policies for Lambda Function {{functionName}}',
28
- fetchedConfiguration: '{{icon}} Fetched configuration from AWS',
29
-
30
- // ====== scan polling ===== //
31
- scanStarted: 'Scan Started',
32
- scanFailed: 'Scan Failed',
33
- scanTimedOut: 'Scan timed out',
34
-
35
- // ====== lambda utils ===== //
36
- loadingFunctionList: 'Loading lambda function list',
37
- functionsFound: '{{count}} functions found',
38
- noFunctionsFound: 'No functions found',
39
- failedToLoadFunctions: 'Failed to load lambda functions',
40
- availableForScan: '{{icon}} {{count}} available for scan',
41
- runtimeCount: '----- {{runtime}} ({{count}}) -----',
42
-
43
- // ====== print vulnerabilities ===== //
44
- gatherResults: 'Gathering results...',
45
- doneGatherResults: 'Done gathering results',
46
- whatHappenedTitle: 'What happened:',
47
- whatHappenedItem: '{{policy}} have:\n{{comments}}\n',
48
- recommendation: 'Recommendation:',
49
- vulnerableDependency: 'Vulnerable dependency',
50
- dependenciesCount: {
51
- one: '1 Dependency',
52
- other: '%s Dependencies'
53
- },
54
- foundVulnerabilities: {
55
- one: 'Found 1 vulnerability',
56
- other: 'Found %s vulnerabilities'
57
- },
58
- vulnerableDependencyDescriptions:
59
- '{packageName} (v{version}) has {NUM} known {NUM, plural,one{CVE}other{CVEs}}\n {cves}',
60
-
61
- // ====== errorCodes ===== //
62
- something_went_wrong: 'Something went wrong',
63
- not_found_404: '404 error - Not found',
64
- internal_error: 'Internal error',
65
- inactive_account:
66
- 'Scanning a function of an inactive account is not supported',
67
- not_supported_runtime:
68
- 'Scanning resource of runtime "{{runtime}}" is not supported.\nSupported runtimes: {{supportedRuntimes}}',
69
- not_supported_lambda: 'This function cannot be scanned',
70
- not_supported_onboard_account:
71
- 'Scanning a function of onboard account is not supported',
72
- scan_lock:
73
- 'Other scan is still running. Please wait until the previous scan finishes',
74
-
75
- // ====== statuses ===== //
76
- unsupported: 'unsupported',
77
- excluded: 'excluded',
78
- canceled: 'canceled',
79
- failed: 'failed',
80
- dismissed: 'dismissed'
81
- }
82
-
83
- module.exports = {
84
- lambda
85
- }