@contrast/contrast 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +2 -0
- package/README.md +120 -47
- package/dist/audit/AnalysisEngine.js +37 -0
- package/dist/audit/catalogueApplication/catalogueApplication.js +36 -0
- package/dist/audit/dotnetAnalysisEngine/index.js +25 -0
- package/dist/audit/dotnetAnalysisEngine/parseLockFileContents.js +35 -0
- package/dist/audit/dotnetAnalysisEngine/parseProjectFileContents.js +15 -0
- package/dist/audit/dotnetAnalysisEngine/readLockFileContents.js +18 -0
- package/dist/audit/dotnetAnalysisEngine/readProjectFileContents.js +14 -0
- package/dist/audit/dotnetAnalysisEngine/sanitizer.js +9 -0
- package/dist/audit/goAnalysisEngine/index.js +17 -0
- package/dist/audit/goAnalysisEngine/parseProjectFileContents.js +164 -0
- package/dist/audit/goAnalysisEngine/readProjectFileContents.js +21 -0
- package/dist/audit/goAnalysisEngine/sanitizer.js +5 -0
- package/dist/audit/javaAnalysisEngine/index.js +34 -0
- package/dist/audit/javaAnalysisEngine/parseMavenProjectFileContents.js +153 -0
- package/dist/audit/javaAnalysisEngine/parseProjectFileContents.js +353 -0
- package/dist/audit/javaAnalysisEngine/readProjectFileContents.js +98 -0
- package/dist/audit/javaAnalysisEngine/sanitizer.js +5 -0
- package/dist/audit/languageAnalysisEngine/checkForMultipleIdentifiedLanguages.js +24 -0
- package/dist/audit/languageAnalysisEngine/checkForMultipleIdentifiedProjectFiles.js +24 -0
- package/dist/audit/languageAnalysisEngine/checkIdentifiedLanguageHasLockFile.js +35 -0
- package/dist/audit/languageAnalysisEngine/checkIdentifiedLanguageHasProjectFile.js +23 -0
- package/dist/audit/languageAnalysisEngine/commonApi.js +18 -0
- package/dist/audit/languageAnalysisEngine/constants.js +20 -0
- package/dist/audit/languageAnalysisEngine/filterProjectPath.js +20 -0
- package/dist/audit/languageAnalysisEngine/getIdentifiedLanguageInfo.js +25 -0
- package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js +39 -0
- package/dist/audit/languageAnalysisEngine/index.js +39 -0
- package/dist/audit/languageAnalysisEngine/langugageAnalysisFactory.js +70 -0
- package/dist/audit/languageAnalysisEngine/reduceIdentifiedLanguages.js +121 -0
- package/dist/audit/languageAnalysisEngine/report/checkIgnoreDevDep.js +17 -0
- package/dist/audit/languageAnalysisEngine/report/commonReportingFunctions.js +257 -0
- package/dist/audit/languageAnalysisEngine/report/newReportingFeature.js +81 -0
- package/dist/audit/languageAnalysisEngine/report/reportingFeature.js +133 -0
- package/dist/audit/languageAnalysisEngine/sendSnapshot.js +41 -0
- package/dist/audit/languageAnalysisEngine/util/capabilities.js +11 -0
- package/dist/audit/languageAnalysisEngine/util/generalAPI.js +39 -0
- package/dist/audit/languageAnalysisEngine/util/requestUtils.js +14 -0
- package/dist/audit/nodeAnalysisEngine/handleNPMLockFileV2.js +40 -0
- package/dist/audit/nodeAnalysisEngine/index.js +31 -0
- package/dist/audit/nodeAnalysisEngine/parseNPMLockFileContents.js +18 -0
- package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +51 -0
- package/dist/audit/nodeAnalysisEngine/parseYarnLockFileContents.js +18 -0
- package/dist/audit/nodeAnalysisEngine/readNPMLockFileContents.js +17 -0
- package/dist/audit/nodeAnalysisEngine/readProjectFileContents.js +14 -0
- package/dist/audit/nodeAnalysisEngine/readYarnLockFileContents.js +24 -0
- package/dist/audit/nodeAnalysisEngine/sanitizer.js +9 -0
- package/dist/audit/phpAnalysisEngine/index.js +23 -0
- package/dist/audit/phpAnalysisEngine/parseLockFileContents.js +52 -0
- package/dist/audit/phpAnalysisEngine/readLockFileContents.js +13 -0
- package/dist/audit/phpAnalysisEngine/readProjectFileContents.js +16 -0
- package/dist/audit/phpAnalysisEngine/sanitizer.js +5 -0
- package/dist/audit/pythonAnalysisEngine/index.js +25 -0
- package/dist/audit/pythonAnalysisEngine/parsePipfileLockContents.js +17 -0
- package/dist/audit/pythonAnalysisEngine/parseProjectFileContents.js +21 -0
- package/dist/audit/pythonAnalysisEngine/readPipfileLockFileContents.js +13 -0
- package/dist/audit/pythonAnalysisEngine/readPythonProjectFileContents.js +14 -0
- package/dist/audit/pythonAnalysisEngine/sanitizer.js +7 -0
- package/dist/audit/rubyAnalysisEngine/index.js +25 -0
- package/dist/audit/rubyAnalysisEngine/parseGemfileLockContents.js +176 -0
- package/dist/audit/rubyAnalysisEngine/parsedGemfile.js +22 -0
- package/dist/audit/rubyAnalysisEngine/readGemfileContents.js +14 -0
- package/dist/audit/rubyAnalysisEngine/readGemfileLockContents.js +14 -0
- package/dist/audit/rubyAnalysisEngine/sanitizer.js +6 -0
- package/dist/commands/audit/auditConfig.js +25 -0
- package/dist/commands/audit/auditController.js +31 -0
- package/dist/commands/audit/help.js +52 -0
- package/dist/commands/audit/processAudit.js +18 -0
- package/dist/commands/auth/auth.js +1 -1
- package/dist/commands/scan/processScan.js +19 -5
- package/dist/common/HTTPClient.js +101 -13
- package/dist/common/errorHandling.js +49 -1
- package/dist/common/findLatestCLIVersion.js +23 -0
- package/dist/constants/constants.js +1 -1
- package/dist/constants/lambda.js +32 -4
- package/dist/constants/locales.js +39 -16
- package/dist/constants.js +148 -20
- package/dist/index.js +7 -1
- package/dist/lambda/aws.js +14 -11
- package/dist/lambda/help.js +4 -0
- package/dist/lambda/lambda.js +50 -27
- package/dist/lambda/lambdaUtils.js +72 -0
- package/dist/lambda/logUtils.js +11 -1
- package/dist/lambda/scanDetailCompletion.js +4 -4
- package/dist/lambda/scanRequest.js +11 -5
- package/dist/lambda/utils.js +110 -53
- package/dist/scan/autoDetection.js +0 -32
- package/dist/scan/fileUtils.js +1 -1
- package/dist/scan/help.js +12 -40
- package/dist/scan/populateProjectIdAndProjectName.js +4 -0
- package/dist/scan/saveResults.js +15 -0
- package/dist/scan/scan.js +77 -42
- package/dist/scan/scanConfig.js +20 -0
- package/dist/scan/scanController.js +13 -15
- package/dist/scan/scanResults.js +18 -16
- package/dist/utils/commonApi.js +3 -3
- package/dist/utils/fileUtils.js +31 -0
- package/dist/utils/paramsUtil/commandlineParams.js +1 -20
- package/dist/utils/paramsUtil/genericCommandLineParams.js +12 -0
- package/dist/utils/paramsUtil/paramHandler.js +3 -6
- package/dist/utils/parsedCLIOptions.js +14 -8
- package/package.json +26 -21
- package/src/audit/AnalysisEngine.js +103 -0
- package/src/audit/catalogueApplication/catalogueApplication.js +42 -0
- package/src/audit/dotnetAnalysisEngine/index.js +26 -0
- package/src/audit/dotnetAnalysisEngine/parseLockFileContents.js +47 -0
- package/src/audit/dotnetAnalysisEngine/parseProjectFileContents.js +29 -0
- package/src/audit/dotnetAnalysisEngine/readLockFileContents.js +30 -0
- package/src/audit/dotnetAnalysisEngine/readProjectFileContents.js +26 -0
- package/src/audit/dotnetAnalysisEngine/sanitizer.js +11 -0
- package/src/audit/goAnalysisEngine/index.js +18 -0
- package/src/audit/goAnalysisEngine/parseProjectFileContents.js +209 -0
- package/src/audit/goAnalysisEngine/readProjectFileContents.js +31 -0
- package/src/audit/goAnalysisEngine/sanitizer.js +7 -0
- package/src/audit/javaAnalysisEngine/index.js +41 -0
- package/src/audit/javaAnalysisEngine/parseMavenProjectFileContents.js +222 -0
- package/src/audit/javaAnalysisEngine/parseProjectFileContents.js +420 -0
- package/src/audit/javaAnalysisEngine/readProjectFileContents.js +141 -0
- package/src/audit/javaAnalysisEngine/sanitizer.js +6 -0
- package/src/audit/languageAnalysisEngine/checkForMultipleIdentifiedLanguages.js +35 -0
- package/src/audit/languageAnalysisEngine/checkForMultipleIdentifiedProjectFiles.js +41 -0
- package/src/audit/languageAnalysisEngine/checkIdentifiedLanguageHasLockFile.js +54 -0
- package/src/audit/languageAnalysisEngine/checkIdentifiedLanguageHasProjectFile.js +32 -0
- package/src/audit/languageAnalysisEngine/commonApi.js +20 -0
- package/src/audit/languageAnalysisEngine/constants.js +23 -0
- package/src/audit/languageAnalysisEngine/filterProjectPath.js +21 -0
- package/src/audit/languageAnalysisEngine/getIdentifiedLanguageInfo.js +41 -0
- package/src/audit/languageAnalysisEngine/getProjectRootFilenames.js +72 -0
- package/src/audit/languageAnalysisEngine/index.js +45 -0
- package/src/audit/languageAnalysisEngine/langugageAnalysisFactory.js +94 -0
- package/src/audit/languageAnalysisEngine/reduceIdentifiedLanguages.js +177 -0
- package/src/audit/languageAnalysisEngine/report/checkIgnoreDevDep.js +27 -0
- package/src/audit/languageAnalysisEngine/report/commonReportingFunctions.js +303 -0
- package/src/audit/languageAnalysisEngine/report/newReportingFeature.js +124 -0
- package/src/audit/languageAnalysisEngine/report/reportingFeature.js +190 -0
- package/src/audit/languageAnalysisEngine/sendSnapshot.js +51 -0
- package/src/audit/languageAnalysisEngine/util/capabilities.js +12 -0
- package/src/audit/languageAnalysisEngine/util/generalAPI.js +43 -0
- package/src/audit/languageAnalysisEngine/util/requestUtils.js +17 -0
- package/src/audit/nodeAnalysisEngine/handleNPMLockFileV2.js +49 -0
- package/src/audit/nodeAnalysisEngine/index.js +35 -0
- package/src/audit/nodeAnalysisEngine/parseNPMLockFileContents.js +20 -0
- package/src/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +63 -0
- package/src/audit/nodeAnalysisEngine/parseYarnLockFileContents.js +26 -0
- package/src/audit/nodeAnalysisEngine/readNPMLockFileContents.js +23 -0
- package/src/audit/nodeAnalysisEngine/readProjectFileContents.js +27 -0
- package/src/audit/nodeAnalysisEngine/readYarnLockFileContents.js +36 -0
- package/src/audit/nodeAnalysisEngine/sanitizer.js +11 -0
- package/src/audit/phpAnalysisEngine/index.js +27 -0
- package/src/audit/phpAnalysisEngine/parseLockFileContents.js +60 -0
- package/src/audit/phpAnalysisEngine/readLockFileContents.js +14 -0
- package/src/audit/phpAnalysisEngine/readProjectFileContents.js +25 -0
- package/src/audit/phpAnalysisEngine/sanitizer.js +4 -0
- package/src/audit/pythonAnalysisEngine/index.js +55 -0
- package/src/audit/pythonAnalysisEngine/parsePipfileLockContents.js +23 -0
- package/src/audit/pythonAnalysisEngine/parseProjectFileContents.js +33 -0
- package/src/audit/pythonAnalysisEngine/readPipfileLockFileContents.js +16 -0
- package/src/audit/pythonAnalysisEngine/readPythonProjectFileContents.js +22 -0
- package/src/audit/pythonAnalysisEngine/sanitizer.js +9 -0
- package/src/audit/rubyAnalysisEngine/index.js +30 -0
- package/src/audit/rubyAnalysisEngine/parseGemfileLockContents.js +215 -0
- package/src/audit/rubyAnalysisEngine/parsedGemfile.js +39 -0
- package/src/audit/rubyAnalysisEngine/readGemfileContents.js +18 -0
- package/src/audit/rubyAnalysisEngine/readGemfileLockContents.js +17 -0
- package/src/audit/rubyAnalysisEngine/sanitizer.js +8 -0
- package/src/commands/audit/auditConfig.ts +30 -0
- package/src/commands/audit/auditController.ts +31 -0
- package/src/commands/audit/help.ts +48 -0
- package/src/commands/audit/processAudit.ts +19 -0
- package/src/commands/auth/auth.js +1 -1
- package/src/commands/scan/processScan.js +20 -5
- package/src/common/HTTPClient.js +136 -14
- package/src/common/errorHandling.ts +56 -1
- package/src/common/findLatestCLIVersion.ts +27 -0
- package/src/constants/constants.js +1 -1
- package/src/constants/lambda.js +45 -4
- package/src/constants/locales.js +48 -20
- package/src/constants.js +168 -22
- package/src/index.ts +9 -2
- package/src/lambda/aws.ts +13 -12
- package/src/lambda/help.ts +4 -0
- package/src/lambda/lambda.ts +53 -34
- package/src/lambda/lambdaUtils.ts +111 -0
- package/src/lambda/logUtils.ts +19 -1
- package/src/lambda/scanDetailCompletion.ts +4 -4
- package/src/lambda/scanRequest.ts +13 -11
- package/src/lambda/utils.ts +149 -81
- package/src/scan/autoDetection.js +0 -29
- package/src/scan/fileUtils.js +1 -1
- package/src/scan/help.js +12 -45
- package/src/scan/populateProjectIdAndProjectName.js +4 -0
- package/src/scan/saveResults.js +15 -0
- package/src/scan/scan.js +95 -59
- package/src/scan/scanConfig.js +29 -0
- package/src/scan/scanController.js +13 -13
- package/src/scan/scanResults.js +21 -19
- package/src/utils/commonApi.js +2 -3
- package/src/utils/paramsUtil/commandlineParams.js +1 -26
- package/src/utils/paramsUtil/paramHandler.js +3 -7
- package/src/utils/parsedCLIOptions.js +11 -9
|
@@ -6,8 +6,9 @@ const { AUTH_CALLBACK_URL } = require('../constants/constants');
|
|
|
6
6
|
function HTTPClient(config) {
|
|
7
7
|
const apiKey = config.apiKey;
|
|
8
8
|
const authToken = config.authorization;
|
|
9
|
-
|
|
10
|
-
const
|
|
9
|
+
this.rejectUnauthorized = !config.ignoreCertErrors;
|
|
10
|
+
const superApiKey = config.superApiKey;
|
|
11
|
+
const superAuthToken = config.superAuthorization;
|
|
11
12
|
this.requestOptions = {
|
|
12
13
|
forever: true,
|
|
13
14
|
json: true,
|
|
@@ -65,6 +66,11 @@ HTTPClient.prototype.getSpecificScanResult = function getSpecificScanResult(conf
|
|
|
65
66
|
options.url = url;
|
|
66
67
|
return requestUtils.sendRequest({ method: 'get', options });
|
|
67
68
|
};
|
|
69
|
+
HTTPClient.prototype.getSpecificScanResultSarif = function getSpecificScanResultSarif(config, scanId) {
|
|
70
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
71
|
+
options.url = createRawOutputURL(config, scanId);
|
|
72
|
+
return requestUtils.sendRequest({ method: 'get', options });
|
|
73
|
+
};
|
|
68
74
|
HTTPClient.prototype.getScanId = function getScanId(config, codeArtifactId) {
|
|
69
75
|
const options = _.cloneDeep(this.requestOptions);
|
|
70
76
|
let url = createGetScanIdURL(config);
|
|
@@ -89,8 +95,7 @@ HTTPClient.prototype.createProjectId = function createProjectId(config) {
|
|
|
89
95
|
const options = _.cloneDeep(this.requestOptions);
|
|
90
96
|
options.body = {
|
|
91
97
|
name: config.name,
|
|
92
|
-
archived: 'false'
|
|
93
|
-
language: config.language
|
|
98
|
+
archived: 'false'
|
|
94
99
|
};
|
|
95
100
|
options.url = createHarmonyProjectsUrl(config);
|
|
96
101
|
return requestUtils.sendRequest({ method: 'post', options });
|
|
@@ -120,6 +125,58 @@ HTTPClient.prototype.pollForAuth = function pollForAuth(token) {
|
|
|
120
125
|
options.body = requestBody;
|
|
121
126
|
return requestUtils.sendRequest({ method: 'post', options });
|
|
122
127
|
};
|
|
128
|
+
HTTPClient.prototype.catalogueCommand = function catalogueCommand(config) {
|
|
129
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
130
|
+
let url = createAppCreateURL(config);
|
|
131
|
+
options.url = url;
|
|
132
|
+
let requestBody = {};
|
|
133
|
+
requestBody.name = config.applicationName;
|
|
134
|
+
requestBody.language = config.language.toUpperCase();
|
|
135
|
+
requestBody.appGroups = config.appGroups;
|
|
136
|
+
requestBody.metadata = config.metadata;
|
|
137
|
+
requestBody.tags = config.tags;
|
|
138
|
+
requestBody.code = config.code;
|
|
139
|
+
options.body = requestBody;
|
|
140
|
+
return requestUtils.sendRequest({ method: 'post', options });
|
|
141
|
+
};
|
|
142
|
+
HTTPClient.prototype.sendSnapshot = function sendSnapshot(requestBody, config) {
|
|
143
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
144
|
+
let url = createSnapshotURL(config);
|
|
145
|
+
options.url = url;
|
|
146
|
+
options.body = requestBody;
|
|
147
|
+
return requestUtils.sendRequest({ method: 'post', options });
|
|
148
|
+
};
|
|
149
|
+
HTTPClient.prototype.getReport = function getReport(config) {
|
|
150
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
151
|
+
let url = createReportUrl(config);
|
|
152
|
+
options.url = url;
|
|
153
|
+
return requestUtils.sendRequest({ method: 'get', options });
|
|
154
|
+
};
|
|
155
|
+
HTTPClient.prototype.getSpecificReport = function getSpecificReport(config, reportId) {
|
|
156
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
157
|
+
let url = createSpecificReportUrl(config, reportId);
|
|
158
|
+
options.url = url;
|
|
159
|
+
return requestUtils.sendRequest({ method: 'get', options });
|
|
160
|
+
};
|
|
161
|
+
HTTPClient.prototype.getLibraryVulnerabilities = function getLibraryVulnerabilities(requestBody, config) {
|
|
162
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
163
|
+
let url = createLibraryVulnerabilitiesUrl(config);
|
|
164
|
+
options.url = url;
|
|
165
|
+
options.body = requestBody;
|
|
166
|
+
return requestUtils.sendRequest({ method: 'put', options });
|
|
167
|
+
};
|
|
168
|
+
HTTPClient.prototype.getAppId = function getAppId(config) {
|
|
169
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
170
|
+
let url = createAppNameUrl(config);
|
|
171
|
+
options.url = url;
|
|
172
|
+
return requestUtils.sendRequest({ method: 'get', options });
|
|
173
|
+
};
|
|
174
|
+
HTTPClient.prototype.getDependencyTree = function getReport(orgUuid, appId, reportId) {
|
|
175
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
176
|
+
let url = createGetDependencyTree(options.uri, orgUuid, appId, reportId);
|
|
177
|
+
options.url = url;
|
|
178
|
+
return requestUtils.sendRequest({ method: 'get', options });
|
|
179
|
+
};
|
|
123
180
|
function getServerlessHost(config = {}) {
|
|
124
181
|
const originalHost = config?.host || config?.get('host');
|
|
125
182
|
const host = originalHost?.endsWith('/')
|
|
@@ -145,29 +202,36 @@ function createScanResultsGetUrl(config, params, scanId, functionArn) {
|
|
|
145
202
|
const { provider, accountId, organizationId } = params;
|
|
146
203
|
return `${url}/organizations/${organizationId}/providers/${provider}/accounts/${accountId}/scans/${encodedScanId}/resources/${encodedFunctionArn}/results`;
|
|
147
204
|
}
|
|
148
|
-
HTTPClient.prototype.postFunctionScan = async function postFunctionScan(config,
|
|
149
|
-
const url = createScanFunctionPostUrl(config,
|
|
205
|
+
HTTPClient.prototype.postFunctionScan = async function postFunctionScan(config, params, body) {
|
|
206
|
+
const url = createScanFunctionPostUrl(config, params);
|
|
150
207
|
const options = { ...this.requestOptions, body, url };
|
|
151
208
|
return requestUtils.sendRequest({ method: 'post', options });
|
|
152
209
|
};
|
|
153
|
-
HTTPClient.prototype.getScanResources = async function getScanResources(config,
|
|
154
|
-
const url = createScanResourcesGetUrl(config,
|
|
210
|
+
HTTPClient.prototype.getScanResources = async function getScanResources(config, params, scanId) {
|
|
211
|
+
const url = createScanResourcesGetUrl(config, params, scanId);
|
|
155
212
|
const options = { ...this.requestOptions, url };
|
|
156
213
|
return requestUtils.sendRequest({ method: 'get', options });
|
|
157
214
|
};
|
|
158
|
-
HTTPClient.prototype.getFunctionScanResults = async function getFunctionScanResults(config,
|
|
159
|
-
const url = createScanResultsGetUrl(config,
|
|
215
|
+
HTTPClient.prototype.getFunctionScanResults = async function getFunctionScanResults(config, params, scanId, functionArn) {
|
|
216
|
+
const url = createScanResultsGetUrl(config, params, scanId, functionArn);
|
|
160
217
|
const options = { ...this.requestOptions, url };
|
|
161
218
|
return requestUtils.sendRequest({ method: 'get', options });
|
|
162
219
|
};
|
|
220
|
+
HTTPClient.prototype.checkLibrary = function checkLibrary(data) {
|
|
221
|
+
const options = _.cloneDeep(this.requestOptions);
|
|
222
|
+
let url = createDataUrl();
|
|
223
|
+
options.url = url;
|
|
224
|
+
options.body = data;
|
|
225
|
+
return requestUtils.sendRequest({ method: 'post', options });
|
|
226
|
+
};
|
|
163
227
|
const createGetScanIdURL = config => {
|
|
164
228
|
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/`;
|
|
165
229
|
};
|
|
166
230
|
const createScanResultsInstancesURL = (config, scanId) => {
|
|
167
|
-
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/${scanId}/result-instances?sort=severity,asc`;
|
|
231
|
+
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/${scanId}/result-instances/info?size=50&page=0&last=false&sort=severity,asc`;
|
|
168
232
|
};
|
|
169
|
-
const createRawOutputURL = (config,
|
|
170
|
-
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/${
|
|
233
|
+
const createRawOutputURL = (config, scanId) => {
|
|
234
|
+
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/${scanId}/raw-output`;
|
|
171
235
|
};
|
|
172
236
|
const createSpecificScanResultURL = (config, scanId) => {
|
|
173
237
|
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/${scanId}`;
|
|
@@ -187,6 +251,30 @@ const createGlobalPropertiesUrl = protocol => {
|
|
|
187
251
|
const pollForAuthUrl = () => {
|
|
188
252
|
return `${AUTH_CALLBACK_URL}/auth/credentials`;
|
|
189
253
|
};
|
|
254
|
+
function createSnapshotURL(config) {
|
|
255
|
+
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/${config.applicationId}/snapshots`;
|
|
256
|
+
}
|
|
257
|
+
const createAppCreateURL = config => {
|
|
258
|
+
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/create`;
|
|
259
|
+
};
|
|
260
|
+
const createAppNameUrl = config => {
|
|
261
|
+
return `${config.host}/Contrast/api/ng/${config.organizationId}/applications/name?filterText=${config.applicationName}`;
|
|
262
|
+
};
|
|
263
|
+
function createLibraryVulnerabilitiesUrl(config) {
|
|
264
|
+
return `${config.host}/Contrast/api/ng/${config.organizationId}/libraries/artifactsByGroupNameVersion`;
|
|
265
|
+
}
|
|
266
|
+
function createReportUrl(config) {
|
|
267
|
+
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/${config.applicationId}/reports`;
|
|
268
|
+
}
|
|
269
|
+
function createSpecificReportUrl(config, reportId) {
|
|
270
|
+
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/${config.applicationId}/reports/${reportId}?nodesToInclude=PROD`;
|
|
271
|
+
}
|
|
272
|
+
function createDataUrl() {
|
|
273
|
+
return `https://ardy.contrastsecurity.com/production`;
|
|
274
|
+
}
|
|
275
|
+
const createGetDependencyTree = (protocol, orgUuid, appId, reportId) => {
|
|
276
|
+
return `${protocol}/Contrast/api/ng/sca/organizations/${orgUuid}/applications/${appId}/reports/${reportId}`;
|
|
277
|
+
};
|
|
190
278
|
module.exports = HTTPClient;
|
|
191
279
|
module.exports.pollForAuthUrl = pollForAuthUrl;
|
|
192
280
|
module.exports.getServerlessHost = getServerlessHost;
|
|
@@ -3,8 +3,56 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getErrorMessage = exports.generalError = exports.hostWarningError = exports.failOptionError = exports.proxyError = exports.forbiddenError = exports.badRequestError = exports.unauthenticatedError = exports.genericError = void 0;
|
|
6
|
+
exports.libraryAnalysisError = exports.handleResponseErrors = exports.getErrorMessage = exports.generalError = exports.hostWarningError = exports.failOptionError = exports.proxyError = exports.forbiddenError = exports.badRequestError = exports.unauthenticatedError = exports.genericError = void 0;
|
|
7
7
|
const i18n_1 = __importDefault(require("i18n"));
|
|
8
|
+
const handleResponseErrors = (res, api) => {
|
|
9
|
+
if (res.statusCode === 400) {
|
|
10
|
+
api === 'catalogue' ? badRequestError(true) : badRequestError(false);
|
|
11
|
+
}
|
|
12
|
+
else if (res.statusCode === 401) {
|
|
13
|
+
unauthenticatedError();
|
|
14
|
+
}
|
|
15
|
+
else if (res.statusCode === 403) {
|
|
16
|
+
forbiddenError();
|
|
17
|
+
}
|
|
18
|
+
else if (res.statusCode === 407) {
|
|
19
|
+
proxyError();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (api === 'snapshot' || api === 'catalogue') {
|
|
23
|
+
snapshotFailureError();
|
|
24
|
+
}
|
|
25
|
+
if (api === 'vulnerabilities') {
|
|
26
|
+
vulnerabilitiesFailureError();
|
|
27
|
+
}
|
|
28
|
+
if (api === 'report') {
|
|
29
|
+
reportFailureError();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.handleResponseErrors = handleResponseErrors;
|
|
34
|
+
const libraryAnalysisError = () => {
|
|
35
|
+
console.log(i18n_1.default.__('libraryAnalysisError'));
|
|
36
|
+
};
|
|
37
|
+
exports.libraryAnalysisError = libraryAnalysisError;
|
|
38
|
+
const snapshotFailureError = () => {
|
|
39
|
+
console.log('\n ******************************** ' +
|
|
40
|
+
i18n_1.default.__('snapshotFailureHeader') +
|
|
41
|
+
' *********************************\n' +
|
|
42
|
+
i18n_1.default.__('snapshotFailureMessage'));
|
|
43
|
+
};
|
|
44
|
+
const vulnerabilitiesFailureError = () => {
|
|
45
|
+
console.log('\n ******************************** ' +
|
|
46
|
+
i18n_1.default.__('snapshotFailureHeader') +
|
|
47
|
+
' *********************************\n' +
|
|
48
|
+
i18n_1.default.__('vulnerabilitiesFailureMessage'));
|
|
49
|
+
};
|
|
50
|
+
const reportFailureError = () => {
|
|
51
|
+
console.log('\n ******************************** ' +
|
|
52
|
+
i18n_1.default.__('snapshotFailureHeader') +
|
|
53
|
+
' *********************************\n' +
|
|
54
|
+
i18n_1.default.__('reportFailureMessage'));
|
|
55
|
+
};
|
|
8
56
|
const genericError = (missingCliOption) => {
|
|
9
57
|
console.log(`*************************** ${i18n_1.default.__('yamlMissingParametersHeader')} ***************************\n${missingCliOption}`);
|
|
10
58
|
console.error(i18n_1.default.__('yamlMissingParametersMessage'));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const latest_version_1 = __importDefault(require("latest-version"));
|
|
7
|
+
const constants_1 = require("../constants/constants");
|
|
8
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const semver_1 = __importDefault(require("semver"));
|
|
11
|
+
async function findLatestCLIVersion() {
|
|
12
|
+
const latestCLIVersion = await (0, latest_version_1.default)('@contrast/contrast');
|
|
13
|
+
if (semver_1.default.lt(constants_1.APP_VERSION, latestCLIVersion)) {
|
|
14
|
+
const updateAvailableMessage = `Update available ${chalk_1.default.yellow(constants_1.APP_VERSION)} → ${chalk_1.default.green(latestCLIVersion)}`;
|
|
15
|
+
const updateAvailableCommand = `Run ${chalk_1.default.cyan('npm i @contrast/contrast')} to update`;
|
|
16
|
+
console.log((0, boxen_1.default)(`${updateAvailableMessage}\n${updateAvailableCommand}`, {
|
|
17
|
+
margin: 1,
|
|
18
|
+
padding: 1,
|
|
19
|
+
align: 'center'
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = findLatestCLIVersion;
|
|
@@ -12,7 +12,7 @@ const MEDIUM = 'MEDIUM';
|
|
|
12
12
|
const HIGH = 'HIGH';
|
|
13
13
|
const CRITICAL = 'CRITICAL';
|
|
14
14
|
const APP_NAME = 'contrast';
|
|
15
|
-
const APP_VERSION = '1.0.
|
|
15
|
+
const APP_VERSION = '1.0.1';
|
|
16
16
|
const TIMEOUT = 120000;
|
|
17
17
|
const AUTH_UI_URL = 'https://cli-auth.contrastsecurity.com';
|
|
18
18
|
const AUTH_CALLBACK_URL = 'https://cli-auth-api.contrastsecurity.com';
|
package/dist/constants/lambda.js
CHANGED
|
@@ -9,15 +9,43 @@ const lambda = {
|
|
|
9
9
|
missingFunctionName: 'Required parameter --function-name is missing.\nRun command with --help to see usage',
|
|
10
10
|
failedToGetResults: 'Failed to get results',
|
|
11
11
|
missingResults: 'Missing vulnerabilities',
|
|
12
|
-
missingParameter: 'Required function parameter is missing',
|
|
13
12
|
awsError: 'AWS error',
|
|
14
|
-
missingFlagArguments: 'The following flags are missing an arguments:\n
|
|
15
|
-
notSupportedFlags: 'The following flags are not supported:\n
|
|
13
|
+
missingFlagArguments: 'The following flags are missing an arguments:\n{{flags}}',
|
|
14
|
+
notSupportedFlags: 'The following flags are not supported:\n{{flags}}\nRun command with --help to see usage',
|
|
15
|
+
layerNotFound: 'The layer {{layerArn}} could not be found. The scan will continue without it',
|
|
16
|
+
noVulnerabilitiesFound: '👏 No vulnerabilities found',
|
|
17
|
+
scanCompleted: '----- Scan completed {{time}}s -----',
|
|
18
|
+
sendingScanRequest: '{{icon}} Sending Lambda Function scan request to Contrast',
|
|
19
|
+
scanRequestedSuccessfully: '{{icon}} Scan requested successfully',
|
|
20
|
+
fetchingConfiguration: '{{icon}} Fetching configuration and policies for Lambda Function {{functionName}}',
|
|
21
|
+
fetchedConfiguration: '{{icon}} Fetched configuration from AWS',
|
|
22
|
+
scanStarted: 'Scan Started',
|
|
23
|
+
scanFailed: 'Scan Failed',
|
|
24
|
+
scanTimedOut: 'Scan timed out',
|
|
25
|
+
loadingFunctionList: 'Loading lambda function list',
|
|
26
|
+
functionsFound: '{{count}} functions found',
|
|
27
|
+
noFunctionsFound: 'No functions found',
|
|
28
|
+
failedToLoadFunctions: 'Faled to load lambda functions',
|
|
29
|
+
availableForScan: '{{icon}} {{count}} available for scan',
|
|
30
|
+
runtimeCount: '----- {{runtime}} ({{count}}) -----',
|
|
31
|
+
whatHappenedTitle: 'What happened:',
|
|
32
|
+
whatHappenedItem: '{{policy}} have:\n{{comments}}\n',
|
|
33
|
+
recommendation: 'Recommendation:',
|
|
34
|
+
vulnerableDependency: 'Vulnerable dependency',
|
|
35
|
+
dependenciesCount: {
|
|
36
|
+
one: '1 Dependency',
|
|
37
|
+
other: '%s Dependencies'
|
|
38
|
+
},
|
|
39
|
+
foundVulnerabilities: {
|
|
40
|
+
one: 'Found 1 vulnerability',
|
|
41
|
+
other: 'Found %s vulnerabilities'
|
|
42
|
+
},
|
|
43
|
+
vulnerableDependencyDescriptions: '{packageName} (v{version}) has {NUM} known {NUM, plural,one{CVE}other{CVEs}}\n {cves}',
|
|
16
44
|
something_went_wrong: 'Something went wrong',
|
|
17
45
|
not_found_404: '404 error - Not found',
|
|
18
46
|
internal_error: 'Internal error',
|
|
19
47
|
inactive_account: 'Scanning a function of an inactive account is not supported',
|
|
20
|
-
not_supported_runtime: 'Scanning resource of runtime "
|
|
48
|
+
not_supported_runtime: 'Scanning resource of runtime "{{runtime}}" is not supported.\nSupported runtimes: {{supportedRuntimes}}',
|
|
21
49
|
not_supported_onboard_account: 'Scanning a function of onboard account is not supported',
|
|
22
50
|
scan_lock: 'Other scan is still running. Please wait until the previous scan finishes',
|
|
23
51
|
unsupported: 'unsupported',
|
|
@@ -101,10 +101,8 @@ const en_locales = () => {
|
|
|
101
101
|
constantsGradleMultiProject: 'Specify the sub project within your gradle application.',
|
|
102
102
|
constantsScan: 'Upload java binaries to the static scan service',
|
|
103
103
|
constantsWaitForScan: 'Waits for the result of the scan',
|
|
104
|
-
constantsProjectName: '
|
|
105
|
-
constantsFileName: 'The name of the file to Scan',
|
|
104
|
+
constantsProjectName: 'Contrast project name. If not specified, Contrast uses contrast.settings to identify the project or creates a project.',
|
|
106
105
|
constantsProjectId: 'The ID associated with a scan project. Replace <ProjectID> with the ID for the scan project. To find the ID, select a scan project in Contrast and locate the last number in the URL.',
|
|
107
|
-
constantsScanTimeout: 'Set a specific time span before the function times out. Default timeout is 300 seconds if scan_timeout is not set. The format of the value of the parameter is "20" seconds or "80" seconds.',
|
|
108
106
|
constantsReport: 'Display vulnerability information for this application',
|
|
109
107
|
constantsFail: 'Set the process to fail if this option is set in combination with the --report and --cve_severity.',
|
|
110
108
|
failOptionErrorMessage: " FAIL - CVE's have been detected that match at least the cve_severity or cve_threshold option specified.",
|
|
@@ -116,14 +114,15 @@ const en_locales = () => {
|
|
|
116
114
|
constantsUsageGuideContentRecommendation: '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.',
|
|
117
115
|
constantsPrerequisitesHeader: 'Pre-requisites',
|
|
118
116
|
constantsPrerequisitesContent: 'To scan a Java project you will need a .jar or .war file for analysis\n' +
|
|
119
|
-
'To scan a Javascript project you will need a .js or.zip file for analysis\n'
|
|
117
|
+
'To scan a Javascript project you will need a .js or.zip file for analysis\n' +
|
|
118
|
+
'To scan a .NET c# webforms project you will need a .exe or a .zip file for analysis\n',
|
|
120
119
|
constantsUsage: 'Usage',
|
|
121
120
|
constantsUsageCommandExample: 'contrast [command] [options]',
|
|
122
|
-
constantsUsageCommandInfo: 'The file argument is optional. If no file is given, Contrast will search for a .jar, .war, .js or .zip file in the working directory.\n',
|
|
121
|
+
constantsUsageCommandInfo: 'The file argument is optional. If no file is given, Contrast will search for a .jar, .war, .js, .exe or .zip file in the working directory.\n',
|
|
123
122
|
constantsUsageCommandInfo24Hours: 'Submitted files are encrypted during upload and deleted in 24 hours.',
|
|
124
123
|
constantsAnd: 'AND',
|
|
125
124
|
constantsJava: 'AND Maven build platform, including the dependency plugin. For a Gradle project, use build.gradle. A gradle-wrapper.properties file is also required. Kotlin is also supported requiring a build.gradle.kts file.',
|
|
126
|
-
constantsJavaNote: '
|
|
125
|
+
constantsJavaNote: 'Note: Running "mvn dependency:tree" or "./gradlew dependencies" in the project directory locally must be successful.',
|
|
127
126
|
constantsJavaNoteGradle: 'We currently support v4.8 and upwards on Gradle projects',
|
|
128
127
|
constantsDotNet: 'MSBuild 15.0 or greater and have a packages.lock.json file are supported.',
|
|
129
128
|
constantsDotNetNote: 'Please Note: If the packages.lock.json file is not in place it can be generated by setting RestorePackagesWithLockFile to true within each *.csproj and running dotnet build',
|
|
@@ -170,6 +169,7 @@ const en_locales = () => {
|
|
|
170
169
|
constantsTags: 'Apply labels to an application. Labels must be formatted as a comma-delimited list. Example - label1,label2,label3',
|
|
171
170
|
constantsCode: 'Add the application code this application should use in the Contrast UI',
|
|
172
171
|
constantsIgnoreCertErrors: ' For EOP users with a local Teamserver install, this will bypass the SSL certificate and recognise a self signed certificate.',
|
|
172
|
+
constantsSave: ' Saves the Scan Results JSON to file.',
|
|
173
173
|
constantsIgnoreDev: 'Combined with the --report command excludes developer dependencies from the vulnerabilities report. By default all dependencies are included in a report.',
|
|
174
174
|
constantsCommands: 'Commands',
|
|
175
175
|
constantsScanOptions: 'Scan Options',
|
|
@@ -187,6 +187,7 @@ const en_locales = () => {
|
|
|
187
187
|
noFileFoundScan: "We could't find a suitable file in your directories (we go 3 deep)",
|
|
188
188
|
specifyFileScanError: '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>"',
|
|
189
189
|
populateProjectIdMessage: 'project ID is %s',
|
|
190
|
+
permissionsError: 'You do not have the correct permissions here. \n Contact support@contrastsecurity.com to get this fixed.',
|
|
190
191
|
scanErrorFileMessage: 'We only accept the following file types: \nJava - .jar, .war \nJavaScript - .js or .zip files',
|
|
191
192
|
helpAuthSummary: 'Authenticate Contrast using your Github or Google account',
|
|
192
193
|
helpScanSummary: 'Searches for a .jar, .war, .js or .zip file in the working directory, uploads for analysis and returns the results',
|
|
@@ -200,25 +201,18 @@ const en_locales = () => {
|
|
|
200
201
|
versionName: 'version',
|
|
201
202
|
configName: 'config',
|
|
202
203
|
helpName: 'help',
|
|
203
|
-
scanOptionsFileName: '-f, --file',
|
|
204
|
-
scanOptionsLanguage: '-l, --language',
|
|
205
|
-
scanOptionsName: '-n, --name',
|
|
206
|
-
scanOptionsTimeout: '-t, --time-out',
|
|
207
|
-
scanOptionsVerbose: '-v, --verbose',
|
|
208
|
-
scanOptionsFileNameSummary: 'Path of the file you want to scan. If no file is specified, Contrast searches for a .jar, .war, .js. or .zip file in the working directory.',
|
|
209
204
|
scanOptionsLanguageSummaryOptional: 'Language of file to send for analysis. ',
|
|
210
205
|
scanOptionsLanguageSummaryRequired: 'If you scan a .zip file or you use the --file option.',
|
|
211
|
-
scanOptionsNameSummary: 'Contrast project name. If not specified, Contrast uses contrast.settings to identify the project or creates a project.',
|
|
212
206
|
scanOptionsTimeoutSummary: 'Time in seconds to wait for scan to complete. Default value is 300 seconds.',
|
|
213
|
-
|
|
207
|
+
scanOptionsFileNameSummary: 'Path of the file you want to scan. If no file is specified, Contrast searches for a .jar, .war, .js, .exe or .zip file in the working directory.',
|
|
208
|
+
scanOptionsVerboseSummary: ' Returns extended information to the terminal.',
|
|
214
209
|
authSuccessMessage: 'Authentication successful',
|
|
215
|
-
|
|
210
|
+
runAuthSuccessMessage: 'Now you can use Contrast CLI',
|
|
216
211
|
authWaitingMessage: 'Waiting for auth...',
|
|
217
212
|
authTimedOutMessage: 'Auth Timed out, try again',
|
|
218
213
|
zipErrorScan: 'We only support zip files for JAVASCRIPT language, please set the flag --language JAVASCRIPT',
|
|
219
214
|
unknownFileErrorScan: 'Unsupported file selected for Scan.',
|
|
220
215
|
foundScanFile: 'found: %s',
|
|
221
|
-
foundVulnerabilities: 'Found %s vulnerabilities',
|
|
222
216
|
foundDetailedVulnerabilities: '%s Critical %s High %s Medium %s Low %s Note',
|
|
223
217
|
requiredParams: 'All required parameters are not present.',
|
|
224
218
|
timeoutScan: 'Timeout set to 5 minutes.',
|
|
@@ -230,6 +224,7 @@ const en_locales = () => {
|
|
|
230
224
|
lambdaPrerequisitesContent: 'contrast cli',
|
|
231
225
|
scanFileNameOption: ' -f, --file',
|
|
232
226
|
lambdaFunctionNameOption: ' -f, --function-name',
|
|
227
|
+
lambdaListFunctionsOption: ' -l, --list-functions',
|
|
233
228
|
lambdaEndpointOption: '-e, --endpoint-url',
|
|
234
229
|
lambdaRegionOption: '-r, --region',
|
|
235
230
|
lambdaProfileOption: '-p, --profile',
|
|
@@ -237,6 +232,7 @@ const en_locales = () => {
|
|
|
237
232
|
lambdaVerboseOption: '-v, --verbose',
|
|
238
233
|
lambdaHelpOption: '-h, --help',
|
|
239
234
|
lambdaFunctionNameSummery: 'Name of AWS lambda function to scan.',
|
|
235
|
+
lambdaListFunctionsSummery: 'List all available lambda functions to scan.',
|
|
240
236
|
lambdaEndpointSummery: 'AWS Endpoint override, works like in AWS CLI.',
|
|
241
237
|
lambdaRegionSummery: 'Region override, default to AWS_DEAFAULT_REGION env var, works like in AWS CLI.',
|
|
242
238
|
lambdaProfileSummery: 'AWS configuration profile override, works like in AWS CLI.',
|
|
@@ -251,6 +247,33 @@ const en_locales = () => {
|
|
|
251
247
|
connectionError: 'An error has occurred when trying to get the Project Id please check your internet connection or provide the Project Id manually',
|
|
252
248
|
internalServerErrorHeader: '500 error - Internal server error',
|
|
253
249
|
resourceLockedErrorHeader: '423 error - Resource is locked',
|
|
250
|
+
auditHeader: 'Contrast Audit',
|
|
251
|
+
auditHeaderMessage: `
|
|
252
|
+
Performs software composition analysis (SCA) on your application/code time to show you the dependencies between open source libraries, including where vulnerabilities were introduced.\n
|
|
253
|
+
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.`,
|
|
254
|
+
constantsAuditPrerequisitesContentSupportedLanguages: 'Supported languages and their requirements are:',
|
|
255
|
+
constantsAuditPrerequisitesContentJava: 'Java: ',
|
|
256
|
+
constantsAuditPrerequisitesContentMessage: `
|
|
257
|
+
pom.xml AND Maven build platform, including the dependency plugin.
|
|
258
|
+
For a Gradle project (v4.8+) use build.gradle. A gradle-wrapper.properties file is also required.
|
|
259
|
+
Kotlin is also supported requiring a build.gradle.kts file.`,
|
|
260
|
+
constantsAuditPrerequisitesContentDotNet: '.NET framework and .NET core: ',
|
|
261
|
+
constantsAuditPrerequisitesContentDotNetMessage: `
|
|
262
|
+
MSBuild 15.0 or greater and have a packages.lock.json file are supported.\n
|
|
263
|
+
Note: If the packages.lock.json file is unavailable it can be generated by setting RestorePackagesWithLockFile to true within each *.csproj file and running dotnet build.\n`,
|
|
264
|
+
constantsAuditPrerequisitesContentLanguageNode: 'Node: ',
|
|
265
|
+
constantsAuditPrerequisitesContentLanguageRuby: 'Ruby: ',
|
|
266
|
+
constantsAuditPrerequisitesContentLanguagePython: 'Python: ',
|
|
267
|
+
constantsAuditPrerequisitesContentLanguageNodeMessage: '*.package.json AND a lock file either *.package-lock.json or *.yarn.lock',
|
|
268
|
+
constantsAuditPrerequisitesContentLanguageRubyMessage: 'gemfile AND gemfile.lock',
|
|
269
|
+
constantsAuditPrerequisitesContentLanguagePythonMessage: 'pipfile AND pipfile.lock',
|
|
270
|
+
constantsAuditOptions: 'Audit Options',
|
|
271
|
+
auditOptionsIgnoreDevDependencies: '-igd, --ignore-dev',
|
|
272
|
+
auditOptionsIgnoreDevDependenciesDescription: 'ignores DevDependencies',
|
|
273
|
+
auditOptionsSave: '-s, --save',
|
|
274
|
+
auditOptionsSaveDescription: 'saves the output in specified format Txt text, sbom',
|
|
275
|
+
scanNoVulnerabilitiesFound: '👏 No vulnerabilities found',
|
|
276
|
+
scanNoFiletypeSpecifiedForSave: 'Please specify file type to save results to',
|
|
254
277
|
...lambda
|
|
255
278
|
};
|
|
256
279
|
};
|
package/dist/constants.js
CHANGED
|
@@ -23,7 +23,7 @@ const scanOptionDefinitions = [
|
|
|
23
23
|
description: '{bold ' +
|
|
24
24
|
i18n.__('constantsOptional') +
|
|
25
25
|
'}: ' +
|
|
26
|
-
i18n.__('
|
|
26
|
+
i18n.__('scanOptionsFileNameSummary')
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: 'project-id',
|
|
@@ -40,15 +40,7 @@ const scanOptionDefinitions = [
|
|
|
40
40
|
description: '{bold ' +
|
|
41
41
|
i18n.__('constantsOptional') +
|
|
42
42
|
'}: ' +
|
|
43
|
-
i18n.__('
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'language',
|
|
47
|
-
alias: 'l',
|
|
48
|
-
description: '{bold ' +
|
|
49
|
-
i18n.__('constantsRequiredCatalogue') +
|
|
50
|
-
'}: ' +
|
|
51
|
-
i18n.__('constantsLanguage')
|
|
43
|
+
i18n.__('scanOptionsTimeoutSummary')
|
|
52
44
|
},
|
|
53
45
|
{
|
|
54
46
|
name: 'organization-id',
|
|
@@ -58,14 +50,6 @@ const scanOptionDefinitions = [
|
|
|
58
50
|
'}: ' +
|
|
59
51
|
i18n.__('constantsOrganizationId')
|
|
60
52
|
},
|
|
61
|
-
{
|
|
62
|
-
name: 'yaml-path',
|
|
63
|
-
alias: 'y',
|
|
64
|
-
description: '{bold ' +
|
|
65
|
-
i18n.__('constantsOptional') +
|
|
66
|
-
'}: ' +
|
|
67
|
-
i18n.__('constantsYamlPath')
|
|
68
|
-
},
|
|
69
53
|
{
|
|
70
54
|
name: 'api-key',
|
|
71
55
|
description: '{bold ' +
|
|
@@ -83,7 +67,6 @@ const scanOptionDefinitions = [
|
|
|
83
67
|
{
|
|
84
68
|
name: 'host',
|
|
85
69
|
alias: 'h',
|
|
86
|
-
defaultValue: 'app.contrastsecurity.com',
|
|
87
70
|
description: '{bold ' +
|
|
88
71
|
i18n.__('constantsRequired') +
|
|
89
72
|
'}: ' +
|
|
@@ -112,9 +95,153 @@ const scanOptionDefinitions = [
|
|
|
112
95
|
'}:' +
|
|
113
96
|
i18n.__('constantsIgnoreCertErrors')
|
|
114
97
|
},
|
|
98
|
+
{
|
|
99
|
+
name: 'verbose',
|
|
100
|
+
alias: 'v',
|
|
101
|
+
type: Boolean,
|
|
102
|
+
description: '{bold ' +
|
|
103
|
+
i18n.__('constantsOptional') +
|
|
104
|
+
'}:' +
|
|
105
|
+
i18n.__('scanOptionsVerboseSummary')
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'save',
|
|
109
|
+
alias: 's',
|
|
110
|
+
description: '{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('constantsSave')
|
|
111
|
+
},
|
|
115
112
|
{
|
|
116
113
|
name: 'help',
|
|
117
114
|
type: Boolean
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'debug',
|
|
118
|
+
alias: 'd',
|
|
119
|
+
type: Boolean
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
const auditOptionDefinitions = [
|
|
123
|
+
{
|
|
124
|
+
name: 'application-id',
|
|
125
|
+
description: '{bold ' +
|
|
126
|
+
i18n.__('constantsRequired') +
|
|
127
|
+
'}: ' +
|
|
128
|
+
i18n.__('constantsApplicationId')
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'application-name',
|
|
132
|
+
description: '{bold ' +
|
|
133
|
+
i18n.__('constantsOptional') +
|
|
134
|
+
'}: ' +
|
|
135
|
+
i18n.__('constantsApplicationName')
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'project-path',
|
|
139
|
+
defaultValue: process.env.PWD,
|
|
140
|
+
description: '{bold ' +
|
|
141
|
+
i18n.__('constantsOptional') +
|
|
142
|
+
'}: ' +
|
|
143
|
+
i18n.__('constantsProjectPath')
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'app-groups',
|
|
147
|
+
description: '{bold ' +
|
|
148
|
+
i18n.__('constantsOptionalForCatalogue') +
|
|
149
|
+
'}: ' +
|
|
150
|
+
i18n.__('constantsAppGroups')
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'sub-project',
|
|
154
|
+
description: '{bold ' +
|
|
155
|
+
i18n.__('constantsOptional') +
|
|
156
|
+
'}: ' +
|
|
157
|
+
i18n.__('constantsGradleMultiProject')
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'metadata',
|
|
161
|
+
description: '{bold ' +
|
|
162
|
+
i18n.__('constantsOptional') +
|
|
163
|
+
'}: ' +
|
|
164
|
+
i18n.__('constantsMetadata')
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'tags',
|
|
168
|
+
description: '{bold ' + i18n.__('constantsOptional') + '}: ' + i18n.__('constantsTags')
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'code',
|
|
172
|
+
description: '{bold ' + i18n.__('constantsOptional') + '}: ' + i18n.__('constantsCode')
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'ignore-dev',
|
|
176
|
+
type: Boolean,
|
|
177
|
+
description: '{bold ' +
|
|
178
|
+
i18n.__('constantsOptional') +
|
|
179
|
+
'}: ' +
|
|
180
|
+
i18n.__('constantsIgnoreDev')
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'maven-settings-path'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'language',
|
|
187
|
+
alias: 'l',
|
|
188
|
+
description: '{bold ' +
|
|
189
|
+
i18n.__('constantsRequiredCatalogue') +
|
|
190
|
+
'}: ' +
|
|
191
|
+
i18n.__('constantsLanguage')
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'organization-id',
|
|
195
|
+
alias: 'o',
|
|
196
|
+
description: '{bold ' +
|
|
197
|
+
i18n.__('constantsRequired') +
|
|
198
|
+
'}: ' +
|
|
199
|
+
i18n.__('constantsOrganizationId')
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'api-key',
|
|
203
|
+
description: '{bold ' +
|
|
204
|
+
i18n.__('constantsRequired') +
|
|
205
|
+
'}: ' +
|
|
206
|
+
i18n.__('constantsApiKey')
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'authorization',
|
|
210
|
+
description: '{bold ' +
|
|
211
|
+
i18n.__('constantsRequired') +
|
|
212
|
+
'}: ' +
|
|
213
|
+
i18n.__('constantsAuthorization')
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'host',
|
|
217
|
+
alias: 'h',
|
|
218
|
+
description: '{bold ' +
|
|
219
|
+
i18n.__('constantsRequired') +
|
|
220
|
+
'}: ' +
|
|
221
|
+
i18n.__('constantsHostId')
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'proxy',
|
|
225
|
+
description: '{bold ' +
|
|
226
|
+
i18n.__('constantsOptional') +
|
|
227
|
+
'}: ' +
|
|
228
|
+
i18n.__('constantsProxyServer')
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'ignore-cert-errors',
|
|
232
|
+
type: Boolean,
|
|
233
|
+
description: '{bold ' +
|
|
234
|
+
i18n.__('constantsOptional') +
|
|
235
|
+
'}:' +
|
|
236
|
+
i18n.__('constantsIgnoreCertErrors')
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'save',
|
|
240
|
+
alias: 's',
|
|
241
|
+
description: '{bold ' +
|
|
242
|
+
i18n.__('constantsOptional') +
|
|
243
|
+
'}: ' +
|
|
244
|
+
i18n.__('auditOptionsSaveDescription')
|
|
118
245
|
}
|
|
119
246
|
];
|
|
120
247
|
const mainUsageGuide = commandLineUsage([
|
|
@@ -145,6 +272,7 @@ module.exports = {
|
|
|
145
272
|
commandLineDefinitions: {
|
|
146
273
|
mainUsageGuide,
|
|
147
274
|
mainDefinition,
|
|
148
|
-
scanOptionDefinitions
|
|
275
|
+
scanOptionDefinitions,
|
|
276
|
+
auditOptionDefinitions
|
|
149
277
|
}
|
|
150
278
|
};
|