@mablhq/mabl-cli 1.61.7 → 1.62.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/Globals.js +11 -7
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +8 -0
- package/commands/constants.js +3 -3
- package/commands/tests/testsUtil.js +36 -14
- package/commands/tests/tests_cmds/run.js +15 -11
- package/execution/index.js +1 -1
- package/http/MablHttpAgent.js +4 -1
- package/http/RequestFilteringHttpAgent.js +3 -3
- package/http/axiosProxyConfig.js +27 -22
- package/http/httpUtil.js +6 -10
- package/package.json +6 -4
- package/resources/pdf-viewer/embeddedPdfDetection.js +1 -14
package/http/MablHttpAgent.js
CHANGED
|
@@ -55,11 +55,14 @@ class MablHttpAgent extends agent_base_1.Agent {
|
|
|
55
55
|
httpsAgent: (_b = httpsAgent !== null && httpsAgent !== void 0 ? httpsAgent : proxyConfig.httpsAgent) !== null && _b !== void 0 ? _b : https.globalAgent,
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
createSocket(req, options, cb) {
|
|
59
59
|
var _a;
|
|
60
60
|
if ((_a = this.maybeGetFirstStringHeader(req, httpUtil_1.USER_AGENT_HEADER)) === null || _a === void 0 ? void 0 : _a.startsWith('PostmanRuntime/')) {
|
|
61
61
|
req.setHeader(httpUtil_1.USER_AGENT_HEADER, httpUtil_1.USER_AGENT);
|
|
62
62
|
}
|
|
63
|
+
super.createSocket(req, options, cb);
|
|
64
|
+
}
|
|
65
|
+
connect(_req, opts) {
|
|
63
66
|
return Promise.resolve(opts.secureEndpoint ? this.httpsAgent : this.httpAgent);
|
|
64
67
|
}
|
|
65
68
|
maybeGetFirstStringHeader(req, name) {
|
|
@@ -45,17 +45,17 @@ class RequestFilteringHttpAgent extends MablHttpAgent_1.MablHttpAgent {
|
|
|
45
45
|
const constructorParameters = await MablHttpAgent_1.MablHttpAgent.getConstructorParameters();
|
|
46
46
|
return new RequestFilteringHttpAgent(constructorParameters.httpAgent, constructorParameters.httpsAgent);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
connect(req, opts) {
|
|
49
49
|
if (isForbiddenHost(opts.host)) {
|
|
50
50
|
return Promise.reject(new RequestSecurityError_1.RequestSecurityError('Request contains forbidden host'));
|
|
51
51
|
}
|
|
52
|
-
else if (containsForbiddenHeader(
|
|
52
|
+
else if (containsForbiddenHeader(req.getHeaders())) {
|
|
53
53
|
return Promise.reject(new RequestSecurityError_1.RequestSecurityError('Request contains forbidden header'));
|
|
54
54
|
}
|
|
55
55
|
else if (isPrivateAddress(opts.host)) {
|
|
56
56
|
return Promise.reject(new RequestSecurityError_1.RequestSecurityError('Request contains private address'));
|
|
57
57
|
}
|
|
58
|
-
return super.
|
|
58
|
+
return super.connect(req, opts);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.RequestFilteringHttpAgent = RequestFilteringHttpAgent;
|
package/http/axiosProxyConfig.js
CHANGED
|
@@ -23,12 +23,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.proxyUrlToPortConfig = exports.axiosProxyConfig = exports.currentProxyConfig = exports.setTestExecutionProxyUrl = void 0;
|
|
27
27
|
const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
28
28
|
const https = __importStar(require("https"));
|
|
29
29
|
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
30
30
|
const hpagent_1 = require("hpagent");
|
|
31
31
|
const httpUtil_1 = require("./httpUtil");
|
|
32
|
+
let testExecutionProxyUrl;
|
|
33
|
+
function setTestExecutionProxyUrl(url) {
|
|
34
|
+
testExecutionProxyUrl = url;
|
|
35
|
+
}
|
|
36
|
+
exports.setTestExecutionProxyUrl = setTestExecutionProxyUrl;
|
|
32
37
|
async function currentProxyConfig(mode = 'mabl') {
|
|
33
38
|
const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
|
|
34
39
|
return axiosProxyConfig(mode === 'test' ? httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.test : httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.mabl);
|
|
@@ -41,15 +46,21 @@ function axiosProxyConfig(httpConfig) {
|
|
|
41
46
|
[httpUtil_1.USER_AGENT_HEADER]: httpUtil_1.USER_AGENT,
|
|
42
47
|
},
|
|
43
48
|
};
|
|
44
|
-
|
|
49
|
+
let { proxyType, sslVerify } = httpConfig;
|
|
50
|
+
if (testExecutionProxyUrl) {
|
|
51
|
+
sslVerify = false;
|
|
52
|
+
proxyType = 'current';
|
|
53
|
+
}
|
|
54
|
+
if (!sslVerify) {
|
|
45
55
|
config.httpsAgent = new https.Agent({
|
|
46
56
|
rejectUnauthorized: false,
|
|
47
57
|
});
|
|
48
58
|
}
|
|
49
|
-
if ((_a = httpConfig.proxyHost) === null || _a === void 0 ? void 0 : _a.href) {
|
|
50
|
-
config.proxy = proxyUrlToPortConfig(httpConfig.proxyHost);
|
|
59
|
+
if (testExecutionProxyUrl || ((_a = httpConfig.proxyHost) === null || _a === void 0 ? void 0 : _a.href)) {
|
|
60
|
+
config.proxy = proxyUrlToPortConfig((testExecutionProxyUrl !== null && testExecutionProxyUrl !== void 0 ? testExecutionProxyUrl : httpConfig.proxyHost));
|
|
51
61
|
}
|
|
52
|
-
|
|
62
|
+
const result = maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType);
|
|
63
|
+
return result;
|
|
53
64
|
}
|
|
54
65
|
exports.axiosProxyConfig = axiosProxyConfig;
|
|
55
66
|
function escapeRegexDots(input) {
|
|
@@ -87,12 +98,16 @@ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType) {
|
|
|
87
98
|
};
|
|
88
99
|
newConfig.proxy = false;
|
|
89
100
|
const authConfig = config.proxy.auth;
|
|
101
|
+
let proxyString = 'http://';
|
|
102
|
+
if (authConfig) {
|
|
103
|
+
proxyString += `${authConfig.username}:${authConfig.password}@`;
|
|
104
|
+
}
|
|
105
|
+
proxyString += `${config.proxy.host}:${config.proxy.port}`;
|
|
106
|
+
const proxyUrl = new URL(proxyString);
|
|
107
|
+
const configOptions = {
|
|
108
|
+
rejectUnauthorized: sslVerify !== false,
|
|
109
|
+
};
|
|
90
110
|
if (proxyType === 'current') {
|
|
91
|
-
let proxyString = 'http://';
|
|
92
|
-
if (authConfig !== undefined) {
|
|
93
|
-
proxyString += `${authConfig.username}:${authConfig.password}@`;
|
|
94
|
-
}
|
|
95
|
-
proxyString += `${config.proxy.host}:${config.proxy.port}`;
|
|
96
111
|
const agentConfig = {
|
|
97
112
|
keepAlive: true,
|
|
98
113
|
keepAliveMsecs: 1000,
|
|
@@ -102,22 +117,12 @@ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType) {
|
|
|
102
117
|
rejectUnauthorized: sslVerify !== false,
|
|
103
118
|
};
|
|
104
119
|
newConfig.httpsAgent = new hpagent_1.HttpsProxyAgent(agentConfig);
|
|
105
|
-
newConfig.httpAgent = new hpagent_1.HttpsProxyAgent(agentConfig);
|
|
106
120
|
}
|
|
107
121
|
else {
|
|
108
|
-
|
|
109
|
-
host: config.proxy.host,
|
|
110
|
-
port: config.proxy.port,
|
|
111
|
-
auth: authConfig
|
|
112
|
-
? `${authConfig.username}:${authConfig.password}`
|
|
113
|
-
: undefined,
|
|
114
|
-
rejectUnauthorized: sslVerify !== false,
|
|
115
|
-
};
|
|
116
|
-
newConfig.httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(configOptions);
|
|
117
|
-
newConfig.httpAgent = new https_proxy_agent_1.HttpsProxyAgent(configOptions);
|
|
122
|
+
newConfig.httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, configOptions);
|
|
118
123
|
}
|
|
124
|
+
newConfig.httpAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, configOptions);
|
|
119
125
|
return newConfig;
|
|
120
126
|
}
|
|
121
127
|
return config;
|
|
122
128
|
}
|
|
123
|
-
exports.maybeGetModifiedAxiosConfigForHttpProxy = maybeGetModifiedAxiosConfigForHttpProxy;
|
package/http/httpUtil.js
CHANGED
|
@@ -27,16 +27,12 @@ function maybeGetSocksAgent(linkServer) {
|
|
|
27
27
|
if (!linkServer) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
rejectUnauthorized: false,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
return new socks_proxy_agent_1.SocksProxyAgent(agentOptions);
|
|
30
|
+
const user = linkServer.workspace_id;
|
|
31
|
+
const password = linkServer.label;
|
|
32
|
+
const host = linkServer.forwarding_host;
|
|
33
|
+
const port = linkServer.forwarding_port;
|
|
34
|
+
const url = new URL(`socks5h://${user}:${password}@${host}:${port}`);
|
|
35
|
+
return new socks_proxy_agent_1.SocksProxyAgent(url);
|
|
40
36
|
}
|
|
41
37
|
function postProcessHeaders(response) {
|
|
42
38
|
var _a, _b, _c;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@types/serve-handler": "6.1.0",
|
|
28
28
|
"@types/tmp": "0.2.0",
|
|
29
29
|
"@types/tough-cookie": "4.0.2",
|
|
30
|
-
"agent-base": "
|
|
30
|
+
"agent-base": "7.1.0",
|
|
31
31
|
"analytics-node": "3.5.0",
|
|
32
32
|
"async-mutex": "0.3.1",
|
|
33
33
|
"async-retry": "1.3.3",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"git-repo-info": "2.1.1",
|
|
55
55
|
"glob": "7.1.6",
|
|
56
56
|
"hpagent": "1.0.0",
|
|
57
|
-
"
|
|
57
|
+
"http-mitm-proxy": "1.0.0",
|
|
58
|
+
"https-proxy-agent": "7.0.1",
|
|
58
59
|
"humanize-duration": "3.23.0",
|
|
59
60
|
"inquirer": "7.1.0",
|
|
60
61
|
"js-yaml": "4.1.0",
|
|
@@ -83,9 +84,10 @@
|
|
|
83
84
|
"serve-handler": "6.1.5",
|
|
84
85
|
"set-cookie-parser": "2.5.1",
|
|
85
86
|
"simple-update-notifier": "1.1.0",
|
|
86
|
-
"socks-proxy-agent": "
|
|
87
|
+
"socks-proxy-agent": "8.0.1",
|
|
87
88
|
"stoppable": "1.1.0",
|
|
88
89
|
"strip-ansi": "6.0.0",
|
|
90
|
+
"tldts": "6.0.12",
|
|
89
91
|
"tmp-promise": "3.0.2",
|
|
90
92
|
"tough-cookie": "4.0.0",
|
|
91
93
|
"triple-beam": "1.3.0",
|
|
@@ -125,7 +125,7 @@ mablEmbeddedPdfDetector = () => {
|
|
|
125
125
|
);
|
|
126
126
|
|
|
127
127
|
// Signal embedded PDF detection and pending download
|
|
128
|
-
// Wait for
|
|
128
|
+
// Wait for PDF to be downloaded by PageFrameContextTracker before continuing
|
|
129
129
|
await window.dispatchMablEvent({
|
|
130
130
|
type: MESSAGE_TYPE_EMBEDDED_PDF_DETECTED,
|
|
131
131
|
baseUri,
|
|
@@ -133,9 +133,6 @@ mablEmbeddedPdfDetector = () => {
|
|
|
133
133
|
pdfFileName,
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
// Trigger a download for the PDF
|
|
137
|
-
mablDownloadEmbeddedPdf(pdfFileName, pdfUrl);
|
|
138
|
-
|
|
139
136
|
// Trigger replacement of the embedded PDF with an interactable version served by PDF server
|
|
140
137
|
window.dispatchMablEvent({
|
|
141
138
|
type: MESSAGE_TYPE_EMBEDDED_PDF_MARKED,
|
|
@@ -203,16 +200,6 @@ function mablGetPdfFilenameFromUrl(pdfUrl) {
|
|
|
203
200
|
return pdfUrl.startsWith('blob:') ? 'blob_pdf' : pdfFileName;
|
|
204
201
|
}
|
|
205
202
|
|
|
206
|
-
function mablDownloadEmbeddedPdf(fileName, pdfUrl) {
|
|
207
|
-
const aTag = document.createElement('a');
|
|
208
|
-
aTag.style.display = 'none';
|
|
209
|
-
document.body.appendChild(aTag);
|
|
210
|
-
aTag.href = pdfUrl;
|
|
211
|
-
aTag.setAttribute('download', fileName);
|
|
212
|
-
aTag.click();
|
|
213
|
-
document.body.removeChild(aTag);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
203
|
if (!documentHasDocType()) {
|
|
217
204
|
// If this is executed too quickly, the DOCTYPE has not been loaded yet
|
|
218
205
|
// so wait a bit before checking again.
|