@contrast/contrast 3.2.0 → 3.2.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/dist/auth/auth.js
CHANGED
|
@@ -2,7 +2,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
2
2
|
import i18n from 'i18n';
|
|
3
3
|
import { failSpinner, returnOra, startSpinner, succeedSpinner } from '../utils/oraWrapper.js';
|
|
4
4
|
import { en_locales } from '../constants/locales.js';
|
|
5
|
-
import { AUTH_UI_URL,
|
|
5
|
+
import { AUTH_UI_URL, TIMEOUT } from '../constants/constants.js';
|
|
6
6
|
import { setConfigValues } from '../utils/getConfig.js';
|
|
7
7
|
import commandLineUsage from 'command-line-usage';
|
|
8
8
|
import { commonMessageFormatter } from '../common/errorHandling.js';
|
|
@@ -11,12 +11,12 @@ import { commandLineDefinitions } from '../cliConstants.js';
|
|
|
11
11
|
import { pollForAuth } from './authRequests.js';
|
|
12
12
|
import open from 'open';
|
|
13
13
|
import { logDebug, logInfo } from '../common/logging.js';
|
|
14
|
+
import { checkDeprecatedHost } from '../utils/paramsUtil/paramHandler.js';
|
|
14
15
|
const messages = en_locales();
|
|
15
16
|
export const processAuth = async (argv, config) => {
|
|
16
17
|
const authParams = await getCommandLineArgsCustom(config, 'auth', argv, commandLineDefinitions.authOptionDefinitions);
|
|
17
|
-
if (authParams.host
|
|
18
|
-
|
|
19
|
-
process.exit(0);
|
|
18
|
+
if (authParams.host) {
|
|
19
|
+
checkDeprecatedHost(authParams);
|
|
20
20
|
}
|
|
21
21
|
if (authParams.help) {
|
|
22
22
|
logInfo(authUsageGuide);
|
|
@@ -17,7 +17,7 @@ export const HIGH = 'HIGH';
|
|
|
17
17
|
export const CRITICAL = 'CRITICAL';
|
|
18
18
|
// App
|
|
19
19
|
export const APP_NAME = 'contrast';
|
|
20
|
-
const APP_VERSION = '3.2.
|
|
20
|
+
const APP_VERSION = '3.2.1';
|
|
21
21
|
export const TIMEOUT = 120000;
|
|
22
22
|
export const CRITICAL_PRIORITY = 1;
|
|
23
23
|
export const HIGH_PRIORITY = 2;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { localConfig } from './utils/getConfig.js';
|
|
3
|
-
import { APP_NAME,
|
|
3
|
+
import { APP_NAME, getAppVersion } from './constants/constants.js';
|
|
4
4
|
import commandLineArgs from 'command-line-args';
|
|
5
5
|
import { commandLineDefinitions } from './cliConstants.js';
|
|
6
6
|
import { findLatestCLIVersion, isCorrectNodeVersion } from './common/versionChecker.js';
|
|
@@ -17,8 +17,6 @@ import { processAssess } from './assess/index.js';
|
|
|
17
17
|
import { processSarif } from './sarif/generateSarif.js';
|
|
18
18
|
import { logInfo } from './common/logging.js';
|
|
19
19
|
import { generateYamlConfiguration } from './generateYaml/index.js';
|
|
20
|
-
import i18n from 'i18n';
|
|
21
|
-
import { exit } from 'process';
|
|
22
20
|
const config = localConfig(APP_NAME, getAppVersion());
|
|
23
21
|
const getMainOption = () => {
|
|
24
22
|
const mainOptions = commandLineArgs(commandLineDefinitions.mainDefinition, {
|
|
@@ -61,10 +59,6 @@ const start = async () => {
|
|
|
61
59
|
if (command === 'auth') {
|
|
62
60
|
return await processAuth(argvMain, config);
|
|
63
61
|
}
|
|
64
|
-
if (config.get('host') === CE_URL) {
|
|
65
|
-
logInfo(i18n.__('codeSecEoL'));
|
|
66
|
-
exit(0);
|
|
67
|
-
}
|
|
68
62
|
if (command === 'lambda') {
|
|
69
63
|
return await processLambda(argvMain);
|
|
70
64
|
}
|
|
@@ -4,17 +4,32 @@ import { configStoreGetAuth } from './configStoreParams.js';
|
|
|
4
4
|
import i18n from 'i18n';
|
|
5
5
|
import { validateAuthParams, validateFingerprintParams } from '../validationCheck.js';
|
|
6
6
|
import { logInfo } from '../../common/logging.js';
|
|
7
|
+
import { CE_URL } from '../../constants/constants.js';
|
|
8
|
+
import { exit } from 'process';
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the host is the deprecated CE_URL and exits if it is
|
|
11
|
+
* @param {Object} authParams - Auth parameters object containing host property
|
|
12
|
+
*/
|
|
13
|
+
export function checkDeprecatedHost(authParams) {
|
|
14
|
+
if (authParams.host === CE_URL) {
|
|
15
|
+
logInfo(i18n.__('codeSecEoL'));
|
|
16
|
+
exit(1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
7
19
|
export function getAuth(params) {
|
|
8
20
|
let commandLineAuthParamsAuth = commandGetAuth(params);
|
|
9
21
|
let envVariableParamsAuth = envGetAuth();
|
|
10
22
|
let configStoreParamsAuth = configStoreGetAuth();
|
|
11
23
|
if (validateAuthParams(commandLineAuthParamsAuth)) {
|
|
24
|
+
checkDeprecatedHost(commandLineAuthParamsAuth);
|
|
12
25
|
return commandLineAuthParamsAuth;
|
|
13
26
|
}
|
|
14
27
|
else if (validateAuthParams(envVariableParamsAuth)) {
|
|
28
|
+
checkDeprecatedHost(envVariableParamsAuth);
|
|
15
29
|
return envVariableParamsAuth;
|
|
16
30
|
}
|
|
17
31
|
else if (validateAuthParams(configStoreParamsAuth)) {
|
|
32
|
+
checkDeprecatedHost(configStoreParamsAuth);
|
|
18
33
|
return configStoreParamsAuth;
|
|
19
34
|
}
|
|
20
35
|
else {
|