@sap/cli-core 2025.16.0 → 2025.17.0
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/CHANGELOG.md +14 -0
- package/cache/secrets/SecretsStorageImpl.d.ts +0 -1
- package/cache/secrets/SecretsStorageImpl.js +0 -3
- package/commands/handler/authentication/oauth/index.d.ts +1 -1
- package/commands/handler/authentication/oauth/index.js +2 -2
- package/commands/handler/authentication/oauth/tokenProvider/getToken.d.ts +1 -1
- package/commands/handler/authentication/oauth/tokenProvider/getToken.js +3 -4
- package/commands/handler/authentication/oauth/tokenProvider/index.d.ts +1 -1
- package/commands/handler/authentication/oauth/tokenProvider/index.js +1 -1
- package/commands/handler/fetch/utils.js +1 -1
- package/commands/login.command.js +12 -6
- package/constants.d.ts +3 -0
- package/constants.js +10 -1
- package/package.json +1 -1
- package/utils/http/httpsAgent.d.ts +6 -0
- package/utils/http/httpsAgent.js +54 -0
- package/utils/http/index.js +17 -14
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 2025.17.0
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Enhanced TLS configuration for improved security.** The CLI now uses TLS 1.2 by default for all HTTPS requests, ensuring secure communication with servers. Users can adjust the TLS version if needed using the `--tls-version` flag with options "TLSv1.2" or "TLSv1.3".
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **New environment variable `CLI_LEGACY_TLS_DETECTION`.** When set to `"true"`, this disables TLS version enforcement and lets Node.js decide the default TLS version. This provides compatibility with older Node.js versions or specific environments where TLS version enforcement might cause issues.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- The CLI now correctly handles the secrets overwrite confirmation when using the `--secrets-file` option. If the cached secret already exists the user is prompted to confirm whether to overwrite the existing secret or not. If the user chooses to overwrite, the CLI deletes the existing secret and continues with the default login process.
|
|
21
|
+
|
|
8
22
|
## 2025.13.0
|
|
9
23
|
|
|
10
24
|
### Changed
|
|
@@ -142,8 +142,5 @@ class SecretsStorageImpl {
|
|
|
142
142
|
getAllSecrets() {
|
|
143
143
|
return this.secrets;
|
|
144
144
|
}
|
|
145
|
-
hasSecretForTenant(tenantUrl) {
|
|
146
|
-
return this.secrets.some((secret) => secret.tenantUrl === tenantUrl);
|
|
147
|
-
}
|
|
148
145
|
}
|
|
149
146
|
exports.SecretsStorageImpl = SecretsStorageImpl;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Handler } from "../../../../types";
|
|
2
|
-
export declare const create: (
|
|
2
|
+
export declare const create: () => Handler;
|
|
@@ -9,9 +9,9 @@ const tokenProvider_1 = require("./tokenProvider");
|
|
|
9
9
|
const checkOptionsExistence_1 = require("../../checkOptionsExistence");
|
|
10
10
|
const constants_1 = require("../../../../constants");
|
|
11
11
|
const core_1 = require("../../../../config/core");
|
|
12
|
-
const create = (
|
|
12
|
+
const create = () => {
|
|
13
13
|
if ((0, core_1.getAuthenticationMethods)().includes(constants_1.AuthenticationMethod.oauth)) {
|
|
14
|
-
return (0, error_1.create)("failed to handle OAuth authorization", (0, next_1.create)("commands.handler.authentication.oauth", (0, checkOptionsExistence_1.create)(constants_1.OPTION_PASSCODE), (0, secretsProvider_1.create)(), (0, tokenProvider_1.create)(
|
|
14
|
+
return (0, error_1.create)("failed to handle OAuth authorization", (0, next_1.create)("commands.handler.authentication.oauth", (0, checkOptionsExistence_1.create)(constants_1.OPTION_PASSCODE), (0, secretsProvider_1.create)(), (0, tokenProvider_1.create)()));
|
|
15
15
|
}
|
|
16
16
|
return (0, fail_1.create)();
|
|
17
17
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Handler } from "../../../../../types";
|
|
2
|
-
export declare const create: (
|
|
2
|
+
export declare const create: () => Handler;
|
|
@@ -10,13 +10,12 @@ const utils_1 = require("../utils");
|
|
|
10
10
|
const utils_2 = require("./utils");
|
|
11
11
|
const SecretsStorageSingleton_1 = require("../../../../../cache/secrets/SecretsStorageSingleton");
|
|
12
12
|
const getLogger = () => (0, logger_1.get)("commands.handler.authentication.oauth.tokenProvider.getToken");
|
|
13
|
-
const createGetTokenHandler = (
|
|
13
|
+
const createGetTokenHandler = () => {
|
|
14
14
|
const handler = async () => async () => {
|
|
15
15
|
const { info: logInfo, debug } = getLogger();
|
|
16
16
|
logInfo("checking token existence");
|
|
17
17
|
const secrets = await SecretsStorageSingleton_1.SecretsStorageSingleton.SINGLETON.getDefaultSecret();
|
|
18
|
-
if (
|
|
19
|
-
debug(`access token not available or overrideExisting=${overrideExisting}, retrieving token from server`);
|
|
18
|
+
if (!secrets.access_token && !secrets.refresh_token) {
|
|
20
19
|
if (secrets.authorization_flow === types_1.GrantType.authorization_code) {
|
|
21
20
|
const code = await (0, utils_2.getCode)(secrets.authorization_url, secrets.client_id);
|
|
22
21
|
debug("code received, reading token");
|
|
@@ -38,5 +37,5 @@ const createGetTokenHandler = (overrideExisting) => {
|
|
|
38
37
|
};
|
|
39
38
|
return handler;
|
|
40
39
|
};
|
|
41
|
-
const create = (
|
|
40
|
+
const create = () => (0, next_1.create)("commands.handler.authentication.oauth.tokenProvider.getToken", (0, options_1.create)(constants_1.OPTION_CODE), createGetTokenHandler());
|
|
42
41
|
exports.create = create;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Handler } from "../../../../../types";
|
|
2
|
-
export declare const create: (
|
|
2
|
+
export declare const create: () => Handler;
|
|
@@ -7,5 +7,5 @@ const or_1 = require("../../../or");
|
|
|
7
7
|
const refreshToken_1 = require("./refreshToken");
|
|
8
8
|
const setAuthorization_1 = require("./setAuthorization");
|
|
9
9
|
const getToken_1 = require("./getToken");
|
|
10
|
-
const create = (
|
|
10
|
+
const create = () => (0, error_1.create)("failed to handle token", (0, next_1.create)("commands.handler.authentication.oauth.tokenProvider", (0, or_1.create)("commands.handler.authentication.oauth.tokenProvider", (0, getToken_1.create)(), (0, refreshToken_1.create)(true)), (0, setAuthorization_1.create)()));
|
|
11
11
|
exports.create = create;
|
|
@@ -226,7 +226,7 @@ const buildHttpConfig = async (method, path, parameterMappings) => {
|
|
|
226
226
|
},
|
|
227
227
|
};
|
|
228
228
|
if ((0, utils_1.getAuthenticationMethod)() === constants_1.AuthenticationMethod.oauth) {
|
|
229
|
-
delete httpConfig.headers
|
|
229
|
+
delete httpConfig.headers?.publicfqdn;
|
|
230
230
|
}
|
|
231
231
|
return httpConfig;
|
|
232
232
|
};
|
|
@@ -56,23 +56,28 @@ const fetchSupportedBrowsers = async () => {
|
|
|
56
56
|
const saveSecrets = async () => async () => {
|
|
57
57
|
await SecretsStorageSingleton_1.SecretsStorageSingleton.SINGLETON.synchronizeSecretsToStorage();
|
|
58
58
|
};
|
|
59
|
-
const
|
|
59
|
+
const warnIfSecretExistsInCache = async () => {
|
|
60
60
|
return async () => {
|
|
61
61
|
const logger = getLogger();
|
|
62
62
|
const tenantUrl = (0, utils_1.getTenantUrl)();
|
|
63
63
|
const secretsStorage = SecretsStorageSingleton_1.SecretsStorageSingleton.SINGLETON;
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
// Default secret is from cache since secrets file and options aren't loaded yet
|
|
65
|
+
const cachedSecret = await secretsStorage.getDefaultSecret();
|
|
66
|
+
if (cachedSecret) {
|
|
66
67
|
const shouldOverwrite = await confirmSecretsOverwrite(tenantUrl);
|
|
67
68
|
logger.debug(`user response for overwriting secrets for tenant ${tenantUrl}: ${shouldOverwrite}`);
|
|
68
69
|
if (!shouldOverwrite) {
|
|
69
70
|
const message = `Aborted: Secret for tenant ${tenantUrl} already exists and will not be overwritten.`;
|
|
70
71
|
logger.warn(message);
|
|
71
|
-
//
|
|
72
|
+
// Stop proceeding with the login process as a secret for the tenant already exists
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
75
|
+
logger.info(`Overwriting existing secret for tenant ${tenantUrl}. Proceeding with login.`);
|
|
76
|
+
// Remove the cached secret to allow the new one to be created
|
|
77
|
+
secretsStorage.deleteSecretById(cachedSecret.id);
|
|
78
|
+
logger.debug(`Existing secret for tenant ${tenantUrl} has been removed.`);
|
|
74
79
|
}
|
|
75
|
-
throw new Error(`
|
|
80
|
+
throw new Error(`Login secret for tenant ${tenantUrl} must be loaded.`);
|
|
76
81
|
};
|
|
77
82
|
};
|
|
78
83
|
const loginCommand = {
|
|
@@ -92,12 +97,13 @@ const loginCommand = {
|
|
|
92
97
|
{ ...constants_1.OPTION_CODE, hidden: false },
|
|
93
98
|
{ ...constants_1.OPTION_REFRESH_TOKEN, hidden: false },
|
|
94
99
|
{ ...constants_1.OPTION_SECRETS_FILE, hidden: false },
|
|
100
|
+
{ ...constants_1.OPTION_TLS_VERSION, hidden: false },
|
|
95
101
|
{
|
|
96
102
|
...constants_1.OPTION_BROWSER,
|
|
97
103
|
choices: fetchSupportedBrowsers,
|
|
98
104
|
default: openUtils_1.getDefaultBrowser,
|
|
99
105
|
},
|
|
100
106
|
{ ...constants_1.OPTION_AUTHORIZATION_FLOW, hidden: false },
|
|
101
|
-
]), (0, handler_1.createMandatoryOptionsHandler)(), exports.verifyHost, (0, handler_1.createOrHandler)("commands.login",
|
|
107
|
+
]), (0, handler_1.createMandatoryOptionsHandler)(), exports.verifyHost, (0, handler_1.createOrHandler)("commands.login", warnIfSecretExistsInCache, (0, handler_1.createNextHandler)("commands.login", (0, handler_1.createOauthHandler)(), initializeCache, saveSecrets))),
|
|
102
108
|
};
|
|
103
109
|
exports.default = loginCommand;
|
package/constants.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { SecureVersion } from "tls";
|
|
1
2
|
import { Option } from "./types";
|
|
2
3
|
export declare const VERSION: string;
|
|
4
|
+
export declare const DEFAULT_TLS_VERSION: SecureVersion;
|
|
3
5
|
export type CoreConfiguration = {
|
|
4
6
|
getName: () => string;
|
|
5
7
|
getPackageName: () => string;
|
|
@@ -60,3 +62,4 @@ export declare const OPTION_FILE_PATH: Option;
|
|
|
60
62
|
export declare const OPTION_INPUT: Option;
|
|
61
63
|
export declare const OPTION_BROWSER: Option;
|
|
62
64
|
export declare const OPTION_AUTHORIZATION_FLOW: Option;
|
|
65
|
+
export declare const OPTION_TLS_VERSION: Option;
|
package/constants.js
CHANGED
|
@@ -3,11 +3,12 @@ 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.OPTION_AUTHORIZATION_FLOW = exports.OPTION_BROWSER = exports.OPTION_INPUT = exports.OPTION_FILE_PATH = exports.OPTION_OPTIONS_FILE = exports.CONFIG_PASSCODE_FUNCTION = exports.OPTION_PASSCODE = exports.OPTION_CODE = exports.OPTION_SECRETS_FILE = exports.OPTION_EXPIRES_IN = exports.OPTION_REFRESH_TOKEN = exports.OPTION_ACCESS_TOKEN = exports.OPTION_TOKEN_URL = exports.OPTION_AUTHORIZATION_URL = exports.OPTION_CLIENT_SECRET = exports.OPTION_CLIENT_ID = exports.OPTION_FORCE = exports.OPTION_VERBOSE = exports.OPTION_NO_PRETTY = exports.OPTION_OUTPUT = exports.OPTION_LOGIN_ID = exports.OPTION_HOST = exports.OPTION_HELP = exports.OPTION_VERSION = exports.CACHE_SECRETS_FILE = exports.PATH_TO_ERROR_HTML = exports.PATH_TO_SUCCESS_HTML = exports.X_OUTPUT_FILE_NAME = exports.X_DSP_API_DEPRECATED_PROPERTIES = exports.X_CSRF_TOKEN = exports.DISCOVERY_METADATA_PATH = exports.SEGMENTS_TO_REMOVE_FOR_PASSCODE_AUTH = exports.CLI_GENERIC_OPTIONS_HELP = exports.CLI_SUPPORTED_AUTHENTICATION_METHODS = exports.CLI_DEPRECATION_MESSAGE = exports.CLI_DEPRECATED = exports.CLI_VERSION = exports.CLI_SAP_HELP = exports.CLI_DISCOVERY_PATHS = exports.CLI_DESCRIPTION = exports.CLI_PACKAGE_NAME = exports.CLI_NAME = exports.ROOT_COMMAND = exports.AuthenticationMethod = exports.DISCOVERY_DOCUMENT_PREFIX = exports.VERSION = void 0;
|
|
6
|
+
exports.OPTION_TLS_VERSION = exports.OPTION_AUTHORIZATION_FLOW = exports.OPTION_BROWSER = exports.OPTION_INPUT = exports.OPTION_FILE_PATH = exports.OPTION_OPTIONS_FILE = exports.CONFIG_PASSCODE_FUNCTION = exports.OPTION_PASSCODE = exports.OPTION_CODE = exports.OPTION_SECRETS_FILE = exports.OPTION_EXPIRES_IN = exports.OPTION_REFRESH_TOKEN = exports.OPTION_ACCESS_TOKEN = exports.OPTION_TOKEN_URL = exports.OPTION_AUTHORIZATION_URL = exports.OPTION_CLIENT_SECRET = exports.OPTION_CLIENT_ID = exports.OPTION_FORCE = exports.OPTION_VERBOSE = exports.OPTION_NO_PRETTY = exports.OPTION_OUTPUT = exports.OPTION_LOGIN_ID = exports.OPTION_HOST = exports.OPTION_HELP = exports.OPTION_VERSION = exports.CACHE_SECRETS_FILE = exports.PATH_TO_ERROR_HTML = exports.PATH_TO_SUCCESS_HTML = exports.X_OUTPUT_FILE_NAME = exports.X_DSP_API_DEPRECATED_PROPERTIES = exports.X_CSRF_TOKEN = exports.DISCOVERY_METADATA_PATH = exports.SEGMENTS_TO_REMOVE_FOR_PASSCODE_AUTH = exports.CLI_GENERIC_OPTIONS_HELP = exports.CLI_SUPPORTED_AUTHENTICATION_METHODS = exports.CLI_DEPRECATION_MESSAGE = exports.CLI_DEPRECATED = exports.CLI_VERSION = exports.CLI_SAP_HELP = exports.CLI_DISCOVERY_PATHS = exports.CLI_DESCRIPTION = exports.CLI_PACKAGE_NAME = exports.CLI_NAME = exports.ROOT_COMMAND = exports.AuthenticationMethod = exports.DISCOVERY_DOCUMENT_PREFIX = exports.DEFAULT_TLS_VERSION = exports.VERSION = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const types_1 = require("./types");
|
|
9
9
|
const utils_1 = require("./utils/utils");
|
|
10
10
|
exports.VERSION = (0, utils_1.getVersion)();
|
|
11
|
+
exports.DEFAULT_TLS_VERSION = "TLSv1.2";
|
|
11
12
|
exports.DISCOVERY_DOCUMENT_PREFIX = "discovery-";
|
|
12
13
|
var AuthenticationMethod;
|
|
13
14
|
(function (AuthenticationMethod) {
|
|
@@ -227,3 +228,11 @@ exports.OPTION_AUTHORIZATION_FLOW = {
|
|
|
227
228
|
required: true,
|
|
228
229
|
hidden: true,
|
|
229
230
|
};
|
|
231
|
+
exports.OPTION_TLS_VERSION = {
|
|
232
|
+
longName: "tls-version",
|
|
233
|
+
description: "specifies the TLS version to use for HTTPS connections",
|
|
234
|
+
args: [{ name: "version" }],
|
|
235
|
+
choices: [exports.DEFAULT_TLS_VERSION, "TLSv1.3"],
|
|
236
|
+
default: exports.DEFAULT_TLS_VERSION,
|
|
237
|
+
hidden: true,
|
|
238
|
+
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import https from "https";
|
|
2
|
+
import tls from "tls";
|
|
3
|
+
export declare const getTlsVersion: () => tls.SecureVersion;
|
|
4
|
+
export declare const isLegacyTlsDetectionEnabled: () => boolean;
|
|
5
|
+
export declare const createTlsAgentOptions: () => https.AgentOptions;
|
|
6
|
+
export declare const createHttpsAgent: (proxy?: string) => https.Agent;
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
exports.createHttpsAgent = exports.createTlsAgentOptions = exports.isLegacyTlsDetectionEnabled = exports.getTlsVersion = void 0;
|
|
7
|
+
const https_1 = __importDefault(require("https"));
|
|
8
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
10
|
+
const logger_1 = require("../../logger");
|
|
11
|
+
const options_1 = require("../options");
|
|
12
|
+
const getLogger = () => (0, logger_1.get)("http");
|
|
13
|
+
const getTlsVersion = () => {
|
|
14
|
+
return (0, options_1.getOptionValueFromConfig)(constants_1.OPTION_TLS_VERSION, constants_1.DEFAULT_TLS_VERSION);
|
|
15
|
+
};
|
|
16
|
+
exports.getTlsVersion = getTlsVersion;
|
|
17
|
+
const isLegacyTlsDetectionEnabled = () => {
|
|
18
|
+
return process.env.CLI_LEGACY_TLS_DETECTION === "true";
|
|
19
|
+
};
|
|
20
|
+
exports.isLegacyTlsDetectionEnabled = isLegacyTlsDetectionEnabled;
|
|
21
|
+
const createTlsAgentOptions = () => {
|
|
22
|
+
const { debug } = getLogger();
|
|
23
|
+
if ((0, exports.isLegacyTlsDetectionEnabled)()) {
|
|
24
|
+
debug("using legacy TLS detection - letting Node.js decide default TLS version");
|
|
25
|
+
return {
|
|
26
|
+
rejectUnauthorized: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const tlsVersion = (0, exports.getTlsVersion)();
|
|
30
|
+
debug(`configuring HTTPS agent with TLS version: ${tlsVersion}`);
|
|
31
|
+
const agentOptions = {
|
|
32
|
+
minVersion: tlsVersion,
|
|
33
|
+
maxVersion: tlsVersion,
|
|
34
|
+
rejectUnauthorized: true,
|
|
35
|
+
};
|
|
36
|
+
debug("HTTPS agent options:", JSON.stringify(agentOptions, null, 2));
|
|
37
|
+
return agentOptions;
|
|
38
|
+
};
|
|
39
|
+
exports.createTlsAgentOptions = createTlsAgentOptions;
|
|
40
|
+
const createHttpsAgent = (proxy) => {
|
|
41
|
+
const { debug } = getLogger();
|
|
42
|
+
const agentOptions = (0, exports.createTlsAgentOptions)();
|
|
43
|
+
let agent;
|
|
44
|
+
if (proxy) {
|
|
45
|
+
agent = new https_proxy_agent_1.HttpsProxyAgent(proxy, agentOptions);
|
|
46
|
+
debug(`created HttpsProxyAgent with proxy: ${proxy}`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
agent = new https_1.default.Agent(agentOptions);
|
|
50
|
+
debug("created https.Agent with TLS configuration");
|
|
51
|
+
}
|
|
52
|
+
return agent;
|
|
53
|
+
};
|
|
54
|
+
exports.createHttpsAgent = createHttpsAgent;
|
package/utils/http/index.js
CHANGED
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetch = exports.DEFAULTS = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
9
8
|
const config_1 = require("../../config");
|
|
10
|
-
const logger_1 = require("../../logger");
|
|
11
|
-
const constants_1 = require("../../constants");
|
|
12
|
-
const utils_1 = require("./utils");
|
|
13
9
|
const core_1 = require("../../config/core");
|
|
14
|
-
const
|
|
10
|
+
const constants_1 = require("../../constants");
|
|
11
|
+
const logger_1 = require("../../logger");
|
|
12
|
+
const utils_1 = require("../../logger/utils");
|
|
13
|
+
const httpsAgent_1 = require("./httpsAgent");
|
|
14
|
+
const utils_2 = require("./utils");
|
|
15
15
|
exports.DEFAULTS = {
|
|
16
16
|
maxBodyLength: -1,
|
|
17
17
|
maxContentLength: -1,
|
|
@@ -36,18 +36,21 @@ const getCsrfTokenFromConfig = () => {
|
|
|
36
36
|
const fetch = async (config) => {
|
|
37
37
|
const cnfg = (0, config_1.get)();
|
|
38
38
|
const logger = getLogger();
|
|
39
|
-
const { debug,
|
|
39
|
+
const { debug, trace, error } = logger;
|
|
40
40
|
try {
|
|
41
|
-
(0,
|
|
41
|
+
(0, utils_1.logVerbose)(logger, "%s %s", config.method.toUpperCase(), config.url);
|
|
42
42
|
debug("http config: %s", JSON.stringify(config));
|
|
43
|
-
const httpsAgent =
|
|
44
|
-
if (
|
|
45
|
-
|
|
43
|
+
const httpsAgent = (0, httpsAgent_1.createHttpsAgent)(HTTPS_PROXY);
|
|
44
|
+
if (HTTPS_PROXY) {
|
|
45
|
+
(0, utils_1.logVerbose)(logger, "using https proxy agent for https proxy");
|
|
46
46
|
debug(`using https proxy agent for https proxy ${HTTPS_PROXY}`);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
49
|
debug("no https proxy defined via environment variable https_proxy");
|
|
50
50
|
}
|
|
51
|
+
const tlsVersion = (0, httpsAgent_1.getTlsVersion)();
|
|
52
|
+
const useLegacyTls = (0, httpsAgent_1.isLegacyTlsDetectionEnabled)();
|
|
53
|
+
debug(`TLS configuration - version: ${tlsVersion}, legacy detection: ${useLegacyTls}`);
|
|
51
54
|
const res = await (0, axios_1.default)({
|
|
52
55
|
httpsAgent,
|
|
53
56
|
proxy: false,
|
|
@@ -60,8 +63,8 @@ const fetch = async (config) => {
|
|
|
60
63
|
},
|
|
61
64
|
});
|
|
62
65
|
if (cnfg.verbose) {
|
|
63
|
-
(0,
|
|
64
|
-
(0,
|
|
66
|
+
(0, utils_1.logVerbose)(logger, "%d %s", res.status, res.statusText);
|
|
67
|
+
(0, utils_2.printCorrelationId)(res);
|
|
65
68
|
}
|
|
66
69
|
trace("response", res);
|
|
67
70
|
setEtag(res.headers);
|
|
@@ -70,8 +73,8 @@ const fetch = async (config) => {
|
|
|
70
73
|
catch (err) {
|
|
71
74
|
error("error while executing http request", err.toString(), err.response);
|
|
72
75
|
if (cnfg.verbose) {
|
|
73
|
-
(0,
|
|
74
|
-
(0,
|
|
76
|
+
(0, utils_2.printError)(err);
|
|
77
|
+
(0, utils_2.printCorrelationId)(err.response);
|
|
75
78
|
}
|
|
76
79
|
setEtag(err.response?.headers);
|
|
77
80
|
throw err;
|