n8n-core 2.26.1 → 2.27.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/dist/binary-data/binary-data.service.js +2 -2
- package/dist/binary-data/binary-data.service.js.map +1 -1
- package/dist/binary-data/index.d.ts +1 -1
- package/dist/binary-data/index.js +1 -2
- package/dist/binary-data/index.js.map +1 -1
- package/dist/binary-data/object-store/object-store.service.ee.d.ts +2 -1
- package/dist/binary-data/object-store/object-store.service.ee.js +37 -16
- package/dist/binary-data/object-store/object-store.service.ee.js.map +1 -1
- package/dist/binary-data/object-store.manager.js +2 -2
- package/dist/binary-data/object-store.manager.js.map +1 -1
- package/dist/binary-data/utils.d.ts +1 -3
- package/dist/binary-data/utils.js +0 -20
- package/dist/binary-data/utils.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/credentials.js +1 -1
- package/dist/credentials.js.map +1 -1
- package/dist/execution-engine/active-workflow-triggers.d.ts +30 -0
- package/dist/execution-engine/active-workflow-triggers.js +272 -0
- package/dist/execution-engine/active-workflow-triggers.js.map +1 -0
- package/dist/execution-engine/index.d.ts +12 -11
- package/dist/execution-engine/index.js +14 -13
- package/dist/execution-engine/index.js.map +1 -1
- package/dist/execution-engine/node-execution-context/base-execute-context.d.ts +2 -2
- package/dist/execution-engine/node-execution-context/base-execute-context.js +3 -3
- package/dist/execution-engine/node-execution-context/base-execute-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/execute-context.js +2 -2
- package/dist/execution-engine/node-execution-context/execute-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/execute-single-context.js +1 -1
- package/dist/execution-engine/node-execution-context/execute-single-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/hook-context.js +2 -2
- package/dist/execution-engine/node-execution-context/hook-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/index.d.ts +1 -1
- package/dist/execution-engine/node-execution-context/index.js +2 -2
- package/dist/execution-engine/node-execution-context/index.js.map +1 -1
- package/dist/execution-engine/node-execution-context/node-execution-context.d.ts +3 -3
- package/dist/execution-engine/node-execution-context/node-execution-context.js +2 -2
- package/dist/execution-engine/node-execution-context/node-execution-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/poll-context.js +2 -2
- package/dist/execution-engine/node-execution-context/poll-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/trigger-context.js +3 -3
- package/dist/execution-engine/node-execution-context/trigger-context.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/binary-helper-functions.d.ts +0 -1
- package/dist/execution-engine/node-execution-context/utils/binary-helper-functions.js +4 -15
- package/dist/execution-engine/node-execution-context/utils/binary-helper-functions.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/extract-value.js +10 -8
- package/dist/execution-engine/node-execution-context/utils/extract-value.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.js +1 -1
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/normalize-items.js +3 -3
- package/dist/execution-engine/node-execution-context/utils/normalize-items.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/authentication.js +5 -5
- package/dist/execution-engine/node-execution-context/utils/request-helpers/authentication.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/factory.js +2 -2
- package/dist/execution-engine/node-execution-context/utils/request-helpers/factory.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/index.d.ts +0 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/index.js +2 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/index.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/legacy-request-adapter.d.ts +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/legacy-request-adapter.js +18 -22
- package/dist/execution-engine/node-execution-context/utils/request-helpers/legacy-request-adapter.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/oauth.js +19 -11
- package/dist/execution-engine/node-execution-context/utils/request-helpers/oauth.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/pagination.js +4 -5
- package/dist/execution-engine/node-execution-context/utils/request-helpers/pagination.js.map +1 -1
- package/dist/execution-engine/node-execution-context/utils/webhook-helper-functions.js +7 -4
- package/dist/execution-engine/node-execution-context/utils/webhook-helper-functions.js.map +1 -1
- package/dist/execution-engine/node-execution-context/webhook-context.d.ts +2 -1
- package/dist/execution-engine/node-execution-context/webhook-context.js +11 -4
- package/dist/execution-engine/node-execution-context/webhook-context.js.map +1 -1
- package/dist/execution-engine/scheduled-task-manager.d.ts +5 -1
- package/dist/execution-engine/scheduled-task-manager.js +42 -1
- package/dist/execution-engine/scheduled-task-manager.js.map +1 -1
- package/dist/execution-engine/ssh-clients-manager.js +1 -1
- package/dist/execution-engine/ssh-clients-manager.js.map +1 -1
- package/dist/execution-engine/triggers-and-pollers.js +3 -3
- package/dist/execution-engine/triggers-and-pollers.js.map +1 -1
- package/dist/execution-engine/workflow-active-triggers-state.d.ts +11 -0
- package/dist/execution-engine/workflow-active-triggers-state.js +31 -0
- package/dist/execution-engine/workflow-active-triggers-state.js.map +1 -0
- package/dist/execution-engine/workflow-execute.d.ts +2 -0
- package/dist/execution-engine/workflow-execute.js +48 -22
- package/dist/execution-engine/workflow-execute.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/instance-settings/instance-settings.js +1 -1
- package/dist/instance-settings/instance-settings.js.map +1 -1
- package/dist/interfaces.d.ts +1 -4
- package/dist/nodes-loader/directory-loader.js +4 -2
- package/dist/nodes-loader/directory-loader.js.map +1 -1
- package/dist/nodes-loader/package-directory-loader.js +1 -1
- package/dist/nodes-loader/package-directory-loader.js.map +1 -1
- package/dist/storage.config.d.ts +3 -3
- package/dist/storage.config.js +3 -2
- package/dist/storage.config.js.map +1 -1
- package/package.json +15 -21
- package/dist/execution-engine/active-workflows.d.ts +0 -26
- package/dist/execution-engine/active-workflows.js +0 -180
- package/dist/execution-engine/active-workflows.js.map +0 -1
- package/dist/execution-engine/node-execution-context/utils/parse-incoming-message.d.ts +0 -16
- package/dist/execution-engine/node-execution-context/utils/parse-incoming-message.js +0 -75
- package/dist/execution-engine/node-execution-context/utils/parse-incoming-message.js.map +0 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-config.d.ts +0 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-config.js +0 -35
- package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-config.js.map +0 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-utils.d.ts +0 -24
- package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-utils.js +0 -257
- package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-utils.js.map +0 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/http-request.d.ts +0 -7
- package/dist/execution-engine/node-execution-context/utils/request-helpers/http-request.js +0 -146
- package/dist/execution-engine/node-execution-context/utils/request-helpers/http-request.js.map +0 -1
- package/dist/execution-engine/node-execution-context/utils/request-helpers/outbound-user-agent.d.ts +0 -4
- package/dist/execution-engine/node-execution-context/utils/request-helpers/outbound-user-agent.js +0 -40
- package/dist/execution-engine/node-execution-context/utils/request-helpers/outbound-user-agent.js.map +0 -1
- package/dist/http-proxy.d.ts +0 -6
- package/dist/http-proxy.js +0 -109
- package/dist/http-proxy.js.map +0 -1
- package/dist/ssrf/dns-resolver.d.ts +0 -13
- package/dist/ssrf/dns-resolver.js +0 -93
- package/dist/ssrf/dns-resolver.js.map +0 -1
- package/dist/ssrf/hostname-matcher.d.ts +0 -6
- package/dist/ssrf/hostname-matcher.js +0 -38
- package/dist/ssrf/hostname-matcher.js.map +0 -1
- package/dist/ssrf/in-memory-dns-cache.service.d.ts +0 -11
- package/dist/ssrf/in-memory-dns-cache.service.js +0 -61
- package/dist/ssrf/in-memory-dns-cache.service.js.map +0 -1
- package/dist/ssrf/index.d.ts +0 -5
- package/dist/ssrf/index.js +0 -10
- package/dist/ssrf/index.js.map +0 -1
- package/dist/ssrf/ip-range-builder.d.ts +0 -10
- package/dist/ssrf/ip-range-builder.js +0 -52
- package/dist/ssrf/ip-range-builder.js.map +0 -1
- package/dist/ssrf/ssrf-blocked-ip.error.d.ts +0 -6
- package/dist/ssrf/ssrf-blocked-ip.error.js +0 -21
- package/dist/ssrf/ssrf-blocked-ip.error.js.map +0 -1
- package/dist/ssrf/ssrf-protection.service.d.ts +0 -30
- package/dist/ssrf/ssrf-protection.service.js +0 -159
- package/dist/ssrf/ssrf-protection.service.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseContentDisposition = exports.parseContentType = void 0;
|
|
4
|
-
exports.parseIncomingMessage = parseIncomingMessage;
|
|
5
|
-
function parseHeaderParameters(parameters) {
|
|
6
|
-
return parameters.reduce((acc, param) => {
|
|
7
|
-
const eqIdx = param.indexOf('=');
|
|
8
|
-
if (eqIdx === -1)
|
|
9
|
-
return acc;
|
|
10
|
-
const key = param.slice(0, eqIdx);
|
|
11
|
-
let processedValue = param.slice(eqIdx + 1).trim();
|
|
12
|
-
if (processedValue.startsWith('"') && processedValue.endsWith('"')) {
|
|
13
|
-
processedValue = processedValue.slice(1, -1);
|
|
14
|
-
try {
|
|
15
|
-
processedValue = decodeURIComponent(processedValue);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
try {
|
|
22
|
-
processedValue = decodeURIComponent(processedValue);
|
|
23
|
-
if (processedValue.startsWith('"') && processedValue.endsWith('"')) {
|
|
24
|
-
processedValue = processedValue.slice(1, -1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
acc[key.toLowerCase().trim()] = processedValue;
|
|
31
|
-
return acc;
|
|
32
|
-
}, {});
|
|
33
|
-
}
|
|
34
|
-
const parseContentType = (contentType) => {
|
|
35
|
-
if (!contentType) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const [type, ...parameters] = contentType.split(';');
|
|
39
|
-
return {
|
|
40
|
-
type: type.toLowerCase(),
|
|
41
|
-
parameters: { charset: 'utf-8', ...parseHeaderParameters(parameters) },
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
exports.parseContentType = parseContentType;
|
|
45
|
-
const parseContentDisposition = (contentDisposition) => {
|
|
46
|
-
if (!contentDisposition) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
if (!contentDisposition.startsWith('attachment') && !contentDisposition.startsWith('inline')) {
|
|
50
|
-
contentDisposition = `attachment; ${contentDisposition}`;
|
|
51
|
-
}
|
|
52
|
-
const [type, ...parameters] = contentDisposition.split(';');
|
|
53
|
-
const parsedParameters = parseHeaderParameters(parameters);
|
|
54
|
-
let { filename } = parsedParameters;
|
|
55
|
-
const wildcard = parsedParameters['filename*'];
|
|
56
|
-
if (wildcard) {
|
|
57
|
-
const [_encoding, _locale, content] = wildcard?.split("'") ?? [];
|
|
58
|
-
filename = content;
|
|
59
|
-
}
|
|
60
|
-
return { type, filename };
|
|
61
|
-
};
|
|
62
|
-
exports.parseContentDisposition = parseContentDisposition;
|
|
63
|
-
function parseIncomingMessage(message) {
|
|
64
|
-
const contentType = (0, exports.parseContentType)(message.headers['content-type']);
|
|
65
|
-
if (contentType) {
|
|
66
|
-
const { type, parameters } = contentType;
|
|
67
|
-
message.contentType = type;
|
|
68
|
-
message.encoding = parameters.charset.toLowerCase();
|
|
69
|
-
}
|
|
70
|
-
const contentDisposition = (0, exports.parseContentDisposition)(message.headers['content-disposition']);
|
|
71
|
-
if (contentDisposition) {
|
|
72
|
-
message.contentDisposition = contentDisposition;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=parse-incoming-message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-incoming-message.js","sourceRoot":"","sources":["../../../../src/execution-engine/node-execution-context/utils/parse-incoming-message.ts"],"names":[],"mappings":";;;AA2GA,oDAYC;AArHD,SAAS,qBAAqB,CAAC,UAAoB;IAClD,OAAO,UAAU,CAAC,MAAM,CACvB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEnD,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAMpE,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7C,IAAI,CAAC;gBACJ,cAAc,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACrD,CAAC;YAAC,MAAM,CAAC;YAET,CAAC;QACF,CAAC;aAAM,CAAC;YAGP,IAAI,CAAC;gBACJ,cAAc,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;gBACpD,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;oBACpE,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC9C,CAAC;YACF,CAAC;YAAC,MAAM,CAAC;YAET,CAAC;QACF,CAAC;QAED,GAAG,CA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Q,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACjE,QAAQ,GAAG,OAAO,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC3B,CAAC,CAAC;AA1BW,QAAA,uBAAuB,2BA0BlC;AAKF,SAAgB,oBAAoB,CAAC,OAAwB;IAC5D,MAAM,WAAW,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;IACtE,IAAI,WAAW,EAAE,CAAC;QACjB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QACzC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAoB,CAAC;IACvE,CAAC;IAED,MAAM,kBAAkB,GAAG,IAAA,+BAAuB,EAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC3F,IAAI,kBAAkB,EAAE,CAAC;QACxB,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;AACF,CAAC"}
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
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 config_1 = require("@n8n/config");
|
|
7
|
-
const di_1 = require("@n8n/di");
|
|
8
|
-
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
const qs_1 = require("qs");
|
|
10
|
-
const axios_utils_1 = require("./axios-utils");
|
|
11
|
-
axios_1.default.defaults.timeout = 300000;
|
|
12
|
-
axios_1.default.defaults.headers.post = {};
|
|
13
|
-
axios_1.default.defaults.headers.put = {};
|
|
14
|
-
axios_1.default.defaults.headers.patch = {};
|
|
15
|
-
axios_1.default.defaults.paramsSerializer = (params) => {
|
|
16
|
-
if (params instanceof URLSearchParams) {
|
|
17
|
-
return params.toString();
|
|
18
|
-
}
|
|
19
|
-
return (0, qs_1.stringify)(params, { arrayFormat: 'indices' });
|
|
20
|
-
};
|
|
21
|
-
axios_1.default.defaults.proxy = false;
|
|
22
|
-
axios_1.default.interceptors.request.use((config) => {
|
|
23
|
-
if (config.data === undefined) {
|
|
24
|
-
config.headers.setContentType(false, false);
|
|
25
|
-
}
|
|
26
|
-
(0, axios_utils_1.setAxiosAgents)(config);
|
|
27
|
-
applyVendorHeaders(config);
|
|
28
|
-
return config;
|
|
29
|
-
});
|
|
30
|
-
function applyVendorHeaders(config) {
|
|
31
|
-
if ([config.url, config.baseURL].some((url) => url?.startsWith('https://api.openai.com/'))) {
|
|
32
|
-
config.headers.set(di_1.Container.get(config_1.AiConfig).openAiDefaultHeaders, false);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=axios-config.js.map
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axios-config.js","sourceRoot":"","sources":["../../../../../src/execution-engine/node-execution-context/utils/request-helpers/axios-config.ts"],"names":[],"mappings":";;;;;AAAA,wCAAuC;AACvC,gCAAoC;AACpC,kDAA0B;AAE1B,2BAA+B;AAE/B,+CAA+C;AAI/C,eAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAEhC,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC;AACjC,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;AAChC,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;AAClC,eAAK,CAAC,QAAQ,CAAC,gBAAgB,GAAG,CAAC,MAAM,EAAE,EAAE;IAC5C,IAAI,MAAM,YAAY,eAAe,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,IAAA,cAAS,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AACtD,CAAC,CAAC;AAGF,eAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;AAG7B,eAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;IAEzC,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,IAAA,4BAAc,EAAC,MAAM,CAAC,CAAC;IACvB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,OAAO,MAAM,CAAC;AACf,CAAC,CAAC,CAAC;AAEH,SAAS,kBAAkB,CAAC,MAAkC;IAC7D,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC;QAC5F,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,cAAS,CAAC,GAAG,CAAC,iBAAQ,CAAC,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;AACF,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import FormData from 'form-data';
|
|
3
|
-
import type { AgentOptions } from 'https';
|
|
4
|
-
import { type IHttpRequestOptions, type IRequestOptions, type IgnoreStatusErrorConfig } from 'n8n-workflow';
|
|
5
|
-
import type { SsrfBridge } from '../../../../ssrf';
|
|
6
|
-
export declare function throwIfDomainNotAllowed(configOrUrl: AxiosRequestConfig | string, allowedDomains?: string): void;
|
|
7
|
-
export declare function tryParseUrl(url: string): URL | null;
|
|
8
|
-
export declare function isIgnoreStatusErrorConfig(ignoreHttpStatusErrors: unknown): ignoreHttpStatusErrors is IgnoreStatusErrorConfig;
|
|
9
|
-
export declare function searchForHeader(config: AxiosRequestConfig, headerName: string): string | undefined;
|
|
10
|
-
export declare const getHostFromRequestObject: (requestObject: Partial<{
|
|
11
|
-
url: string;
|
|
12
|
-
uri: string;
|
|
13
|
-
baseURL: string;
|
|
14
|
-
}>) => string | null;
|
|
15
|
-
export declare const getBeforeRedirectFn: (agentOptions: AgentOptions, axiosConfig: AxiosRequestConfig, proxyConfig: IHttpRequestOptions["proxy"] | string | undefined, sendCredentialsOnCrossOriginRedirect: boolean, allowedDomains?: string, ssrfBridge?: SsrfBridge) => (redirectedRequest: Record<string, any>) => void;
|
|
16
|
-
export declare function digestAuthAxiosConfig(axiosConfig: AxiosRequestConfig, response: AxiosResponse, auth: AxiosRequestConfig['auth']): AxiosRequestConfig;
|
|
17
|
-
export declare const createFormDataObject: (data: Record<string, unknown>) => FormData;
|
|
18
|
-
export declare function isFormDataInstance(data: unknown): data is FormData;
|
|
19
|
-
export declare function generateContentLengthHeader(config: AxiosRequestConfig): Promise<void>;
|
|
20
|
-
export declare function getUrlFromProxyConfig(proxyConfig: IHttpRequestOptions['proxy'] | string): string | null;
|
|
21
|
-
export declare function buildTargetUrl(url?: string, baseURL?: string): string | undefined;
|
|
22
|
-
export declare function setAxiosAgents(config: AxiosRequestConfig, agentOptions?: AgentOptions, proxyConfig?: IHttpRequestOptions['proxy'] | string, secureLookup?: ReturnType<SsrfBridge['createSecureLookup']>): void;
|
|
23
|
-
export declare function validateUrlSsrf(url: string | undefined, ssrfBridge?: SsrfBridge): Promise<void>;
|
|
24
|
-
export declare function resolveLegacyRequestUrl(requestObject: IRequestOptions): string | undefined;
|
|
@@ -1,257 +0,0 @@
|
|
|
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.createFormDataObject = exports.getBeforeRedirectFn = exports.getHostFromRequestObject = void 0;
|
|
7
|
-
exports.throwIfDomainNotAllowed = throwIfDomainNotAllowed;
|
|
8
|
-
exports.tryParseUrl = tryParseUrl;
|
|
9
|
-
exports.isIgnoreStatusErrorConfig = isIgnoreStatusErrorConfig;
|
|
10
|
-
exports.searchForHeader = searchForHeader;
|
|
11
|
-
exports.digestAuthAxiosConfig = digestAuthAxiosConfig;
|
|
12
|
-
exports.isFormDataInstance = isFormDataInstance;
|
|
13
|
-
exports.generateContentLengthHeader = generateContentLengthHeader;
|
|
14
|
-
exports.getUrlFromProxyConfig = getUrlFromProxyConfig;
|
|
15
|
-
exports.buildTargetUrl = buildTargetUrl;
|
|
16
|
-
exports.setAxiosAgents = setAxiosAgents;
|
|
17
|
-
exports.validateUrlSsrf = validateUrlSsrf;
|
|
18
|
-
exports.resolveLegacyRequestUrl = resolveLegacyRequestUrl;
|
|
19
|
-
const backend_common_1 = require("@n8n/backend-common");
|
|
20
|
-
const di_1 = require("@n8n/di");
|
|
21
|
-
const axios_1 = __importDefault(require("axios"));
|
|
22
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
23
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
24
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
25
|
-
const http_proxy_1 = require("../../../../http-proxy");
|
|
26
|
-
function throwIfDomainNotAllowed(configOrUrl, allowedDomains) {
|
|
27
|
-
const url = typeof configOrUrl === 'string' ? configOrUrl : axios_1.default.getUri(configOrUrl);
|
|
28
|
-
(0, n8n_workflow_1.assertUrlAllowed)({ url, allowedDomains });
|
|
29
|
-
}
|
|
30
|
-
function tryParseUrl(url) {
|
|
31
|
-
try {
|
|
32
|
-
return new URL(url);
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function isIgnoreStatusErrorConfig(ignoreHttpStatusErrors) {
|
|
39
|
-
return (typeof ignoreHttpStatusErrors === 'object' &&
|
|
40
|
-
ignoreHttpStatusErrors !== null &&
|
|
41
|
-
'ignore' in ignoreHttpStatusErrors &&
|
|
42
|
-
ignoreHttpStatusErrors.ignore === true);
|
|
43
|
-
}
|
|
44
|
-
function searchForHeader(config, headerName) {
|
|
45
|
-
if (config.headers === undefined) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
const headerNames = Object.keys(config.headers);
|
|
49
|
-
headerName = headerName.toLowerCase();
|
|
50
|
-
return headerNames.find((thisHeader) => thisHeader.toLowerCase() === headerName);
|
|
51
|
-
}
|
|
52
|
-
const getHostFromRequestObject = (requestObject) => {
|
|
53
|
-
try {
|
|
54
|
-
const url = (requestObject.url ?? requestObject.uri);
|
|
55
|
-
return new URL(url, requestObject.baseURL).hostname;
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
exports.getHostFromRequestObject = getHostFromRequestObject;
|
|
62
|
-
const getBeforeRedirectFn = (agentOptions, axiosConfig, proxyConfig, sendCredentialsOnCrossOriginRedirect, allowedDomains, ssrfBridge) => (redirectedRequest) => {
|
|
63
|
-
throwIfDomainNotAllowed(redirectedRequest.href, allowedDomains);
|
|
64
|
-
if (ssrfBridge) {
|
|
65
|
-
ssrfBridge.validateRedirectSync(redirectedRequest.href);
|
|
66
|
-
}
|
|
67
|
-
const redirectAgentOptions = {
|
|
68
|
-
...agentOptions,
|
|
69
|
-
servername: redirectedRequest.hostname,
|
|
70
|
-
};
|
|
71
|
-
const customProxyUrl = proxyConfig ? getUrlFromProxyConfig(proxyConfig) : null;
|
|
72
|
-
const effectiveRedirectOptions = ssrfBridge && !customProxyUrl
|
|
73
|
-
? { ...redirectAgentOptions, lookup: ssrfBridge.createSecureLookup() }
|
|
74
|
-
: redirectAgentOptions;
|
|
75
|
-
const targetUrl = redirectedRequest.href;
|
|
76
|
-
const httpAgent = (0, http_proxy_1.createHttpProxyAgent)(customProxyUrl, targetUrl, effectiveRedirectOptions);
|
|
77
|
-
const httpsAgent = (0, http_proxy_1.createHttpsProxyAgent)(customProxyUrl, targetUrl, effectiveRedirectOptions);
|
|
78
|
-
redirectedRequest.agent = redirectedRequest.href.startsWith('https://')
|
|
79
|
-
? httpsAgent
|
|
80
|
-
: httpAgent;
|
|
81
|
-
redirectedRequest.agents = { http: httpAgent, https: httpsAgent };
|
|
82
|
-
const originalUrl = axiosConfig.baseURL
|
|
83
|
-
? new URL(axiosConfig.url ?? '', axiosConfig.baseURL)
|
|
84
|
-
: new URL(axiosConfig.url ?? '');
|
|
85
|
-
const originalOrigin = originalUrl.origin;
|
|
86
|
-
const targetOrigin = new URL(targetUrl).origin;
|
|
87
|
-
if (originalOrigin === targetOrigin || sendCredentialsOnCrossOriginRedirect) {
|
|
88
|
-
if (axiosConfig.headers?.Authorization) {
|
|
89
|
-
redirectedRequest.headers.Authorization = axiosConfig.headers.Authorization;
|
|
90
|
-
}
|
|
91
|
-
if (axiosConfig.auth) {
|
|
92
|
-
redirectedRequest.auth = `${axiosConfig.auth.username}:${axiosConfig.auth.password}`;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
exports.getBeforeRedirectFn = getBeforeRedirectFn;
|
|
97
|
-
function digestAuthAxiosConfig(axiosConfig, response, auth) {
|
|
98
|
-
const authDetails = response.headers['www-authenticate']
|
|
99
|
-
.split(',')
|
|
100
|
-
.map((v) => v.split('='));
|
|
101
|
-
if (authDetails) {
|
|
102
|
-
const nonceCount = '000000001';
|
|
103
|
-
const cnonce = crypto_1.default.randomBytes(24).toString('hex');
|
|
104
|
-
const realm = authDetails
|
|
105
|
-
.find((el) => el[0].toLowerCase().indexOf('realm') > -1)[1]
|
|
106
|
-
.replace(/"/g, '');
|
|
107
|
-
const opaqueKV = authDetails.find((el) => el[0].toLowerCase().indexOf('opaque') > -1);
|
|
108
|
-
const opaque = opaqueKV ? opaqueKV[1].replace(/"/g, '') : undefined;
|
|
109
|
-
const nonce = authDetails
|
|
110
|
-
.find((el) => el[0].toLowerCase().indexOf('nonce') > -1)[1]
|
|
111
|
-
.replace(/"/g, '');
|
|
112
|
-
const ha1 = crypto_1.default
|
|
113
|
-
.createHash('md5')
|
|
114
|
-
.update(`${auth?.username}:${realm}:${auth?.password}`)
|
|
115
|
-
.digest('hex');
|
|
116
|
-
const url = new URL(axios_1.default.getUri(axiosConfig));
|
|
117
|
-
const path = url.pathname + url.search;
|
|
118
|
-
const ha2 = crypto_1.default
|
|
119
|
-
.createHash('md5')
|
|
120
|
-
.update(`${axiosConfig.method ?? 'GET'}:${path}`)
|
|
121
|
-
.digest('hex');
|
|
122
|
-
const response = crypto_1.default
|
|
123
|
-
.createHash('md5')
|
|
124
|
-
.update(`${ha1}:${nonce}:${nonceCount}:${cnonce}:auth:${ha2}`)
|
|
125
|
-
.digest('hex');
|
|
126
|
-
let authorization = `Digest username="${auth?.username}",realm="${realm}",` +
|
|
127
|
-
`nonce="${nonce}",uri="${path}",qop="auth",algorithm="MD5",` +
|
|
128
|
-
`response="${response}",nc="${nonceCount}",cnonce="${cnonce}"`;
|
|
129
|
-
if (opaque) {
|
|
130
|
-
authorization += `,opaque="${opaque}"`;
|
|
131
|
-
}
|
|
132
|
-
if (axiosConfig.headers) {
|
|
133
|
-
axiosConfig.headers.authorization = authorization;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
axiosConfig.headers = { authorization };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return axiosConfig;
|
|
140
|
-
}
|
|
141
|
-
const pushFormDataValue = (form, key, value) => {
|
|
142
|
-
if (value?.hasOwnProperty('value') && value.hasOwnProperty('options')) {
|
|
143
|
-
form.append(key, value.value, value.options);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
form.append(key, value);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const createFormDataObject = (data) => {
|
|
150
|
-
const formData = new form_data_1.default();
|
|
151
|
-
const keys = Object.keys(data);
|
|
152
|
-
keys.forEach((key) => {
|
|
153
|
-
const formField = data[key];
|
|
154
|
-
if (formField instanceof Array) {
|
|
155
|
-
formField.forEach((item) => {
|
|
156
|
-
pushFormDataValue(formData, key, item);
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
pushFormDataValue(formData, key, formField);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
return formData;
|
|
164
|
-
};
|
|
165
|
-
exports.createFormDataObject = createFormDataObject;
|
|
166
|
-
function isFormDataInstance(data) {
|
|
167
|
-
return (data instanceof form_data_1.default ||
|
|
168
|
-
(typeof data === 'object' &&
|
|
169
|
-
data !== null &&
|
|
170
|
-
'getHeaders' in data &&
|
|
171
|
-
typeof data.getHeaders === 'function' &&
|
|
172
|
-
'append' in data &&
|
|
173
|
-
typeof data.append === 'function'));
|
|
174
|
-
}
|
|
175
|
-
async function generateContentLengthHeader(config) {
|
|
176
|
-
if (!isFormDataInstance(config.data)) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
try {
|
|
180
|
-
const length = await new Promise((res, rej) => {
|
|
181
|
-
config.data.getLength((error, dataLength) => {
|
|
182
|
-
if (error)
|
|
183
|
-
rej(error);
|
|
184
|
-
else
|
|
185
|
-
res(dataLength);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
config.headers = {
|
|
189
|
-
...config.headers,
|
|
190
|
-
'content-length': length,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
di_1.Container.get(backend_common_1.Logger).error('Unable to calculate form data length', { error });
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function getUrlFromProxyConfig(proxyConfig) {
|
|
198
|
-
if (typeof proxyConfig === 'string') {
|
|
199
|
-
const isValidUrl = !!tryParseUrl(proxyConfig);
|
|
200
|
-
return isValidUrl ? proxyConfig : null;
|
|
201
|
-
}
|
|
202
|
-
if (!proxyConfig?.host)
|
|
203
|
-
return null;
|
|
204
|
-
const { protocol, host, port, auth } = proxyConfig;
|
|
205
|
-
const safeProtocol = protocol?.endsWith(':') ? protocol.slice(0, -1) : (protocol ?? 'http');
|
|
206
|
-
try {
|
|
207
|
-
const url = new URL(`${safeProtocol}://${host}`);
|
|
208
|
-
if (port !== undefined)
|
|
209
|
-
url.port = String(port);
|
|
210
|
-
if (auth?.username) {
|
|
211
|
-
url.username = auth.username;
|
|
212
|
-
url.password = auth.password ?? '';
|
|
213
|
-
}
|
|
214
|
-
return url.href;
|
|
215
|
-
}
|
|
216
|
-
catch {
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function buildTargetUrl(url, baseURL) {
|
|
221
|
-
if (!url)
|
|
222
|
-
return undefined;
|
|
223
|
-
try {
|
|
224
|
-
return baseURL ? new URL(url, baseURL).href : url;
|
|
225
|
-
}
|
|
226
|
-
catch {
|
|
227
|
-
return undefined;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
function setAxiosAgents(config, agentOptions, proxyConfig, secureLookup) {
|
|
231
|
-
if (config.httpAgent || config.httpsAgent)
|
|
232
|
-
return;
|
|
233
|
-
const customProxyUrl = getUrlFromProxyConfig(proxyConfig);
|
|
234
|
-
const targetUrl = buildTargetUrl(config.url, config.baseURL);
|
|
235
|
-
if (!targetUrl)
|
|
236
|
-
return;
|
|
237
|
-
const effectiveOptions = secureLookup && !customProxyUrl ? { ...agentOptions, lookup: secureLookup } : agentOptions;
|
|
238
|
-
config.httpAgent = (0, http_proxy_1.createHttpProxyAgent)(customProxyUrl, targetUrl, effectiveOptions);
|
|
239
|
-
config.httpsAgent = (0, http_proxy_1.createHttpsProxyAgent)(customProxyUrl, targetUrl, effectiveOptions);
|
|
240
|
-
}
|
|
241
|
-
async function validateUrlSsrf(url, ssrfBridge) {
|
|
242
|
-
if (!ssrfBridge || !url)
|
|
243
|
-
return;
|
|
244
|
-
const parsed = tryParseUrl(url);
|
|
245
|
-
if (!parsed)
|
|
246
|
-
return;
|
|
247
|
-
const result = await ssrfBridge.validateUrl(parsed);
|
|
248
|
-
if (!result.ok) {
|
|
249
|
-
throw result.error;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
function resolveLegacyRequestUrl(requestObject) {
|
|
253
|
-
const rawUrl = requestObject.uri?.toString() ?? requestObject.url?.toString();
|
|
254
|
-
const baseURL = requestObject.baseURL?.toString();
|
|
255
|
-
return buildTargetUrl(rawUrl, baseURL) ?? rawUrl;
|
|
256
|
-
}
|
|
257
|
-
//# sourceMappingURL=axios-utils.js.map
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/axios-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axios-utils.js","sourceRoot":"","sources":["../../../../../src/execution-engine/node-execution-context/utils/request-helpers/axios-utils.ts"],"names":[],"mappings":";;;;;;AAiBA,0DAMC;AAGD,kCAMC;AAGD,8DASC;AAGD,0CAQC;AA6ED,sDAiDC;AAmCD,gDAUC;AAGD,kEAoBC;AAGD,sDAwBC;AAGD,wCAQC;AAGD,wCAsBC;AAGD,0CAaC;AAED,0DAIC;AA9UD,wDAA6C;AAC7C,gCAAoC;AAEpC,kDAA0B;AAC1B,oDAA4B;AAC5B,0DAAiC;AAEjC,+CAKsB;AAEtB,6CAA2E;AAG3E,SAAgB,uBAAuB,CACtC,WAAwC,EACxC,cAAuB;IAEvB,MAAM,GAAG,GAAG,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,C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EhC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,MAAM,CAAC,KAAK,CAAC;IACpB,CAAC;AACF,CAAC;AAED,SAAgB,uBAAuB,CAAC,aAA8B;IACrE,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC;IAC9E,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;IAClD,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC;AAClD,CAAC"}
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/http-request.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import type { IHttpRequestOptions, IN8nHttpFullResponse, IN8nHttpResponse, IRequestOptions } from 'n8n-workflow';
|
|
3
|
-
import type { SsrfBridge } from '../../../../ssrf';
|
|
4
|
-
export declare function invokeAxios(axiosConfig: AxiosRequestConfig, authOptions?: IRequestOptions['auth']): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
|
-
export declare function convertN8nRequestToAxios(n8nRequest: IHttpRequestOptions, ssrfBridge?: SsrfBridge): AxiosRequestConfig;
|
|
6
|
-
export declare function removeEmptyBody(requestOptions: IHttpRequestOptions | IRequestOptions): void;
|
|
7
|
-
export declare function httpRequest(requestOptions: IHttpRequestOptions, ssrfBridge?: SsrfBridge): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
|
|
@@ -1,146 +0,0 @@
|
|
|
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.invokeAxios = invokeAxios;
|
|
7
|
-
exports.convertN8nRequestToAxios = convertN8nRequestToAxios;
|
|
8
|
-
exports.removeEmptyBody = removeEmptyBody;
|
|
9
|
-
exports.httpRequest = httpRequest;
|
|
10
|
-
const axios_1 = __importDefault(require("axios"));
|
|
11
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
12
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
13
|
-
const qs_1 = require("qs");
|
|
14
|
-
const axios_utils_1 = require("./axios-utils");
|
|
15
|
-
const outbound_user_agent_1 = require("./outbound-user-agent");
|
|
16
|
-
async function invokeAxios(axiosConfig, authOptions = {}) {
|
|
17
|
-
try {
|
|
18
|
-
return await (0, axios_1.default)(axiosConfig);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
if (authOptions.sendImmediately !== false || !(error instanceof axios_1.default.AxiosError))
|
|
22
|
-
throw error;
|
|
23
|
-
const { response } = error;
|
|
24
|
-
if (response?.status !== 401 || !response.headers['www-authenticate']?.includes('nonce')) {
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
const { auth } = axiosConfig;
|
|
28
|
-
delete axiosConfig.auth;
|
|
29
|
-
axiosConfig = (0, axios_utils_1.digestAuthAxiosConfig)(axiosConfig, response, auth);
|
|
30
|
-
return await (0, axios_1.default)(axiosConfig);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function convertN8nRequestToAxios(n8nRequest, ssrfBridge) {
|
|
34
|
-
const { headers, method, timeout, auth, proxy, url } = n8nRequest;
|
|
35
|
-
const axiosRequest = {
|
|
36
|
-
headers: headers ?? {},
|
|
37
|
-
method,
|
|
38
|
-
timeout,
|
|
39
|
-
auth,
|
|
40
|
-
url,
|
|
41
|
-
maxBodyLength: Infinity,
|
|
42
|
-
maxContentLength: Infinity,
|
|
43
|
-
};
|
|
44
|
-
axiosRequest.params = n8nRequest.qs;
|
|
45
|
-
if (n8nRequest.abortSignal) {
|
|
46
|
-
axiosRequest.signal = n8nRequest.abortSignal;
|
|
47
|
-
}
|
|
48
|
-
if (n8nRequest.baseURL !== undefined) {
|
|
49
|
-
axiosRequest.baseURL = n8nRequest.baseURL;
|
|
50
|
-
}
|
|
51
|
-
if (n8nRequest.disableFollowRedirect === true) {
|
|
52
|
-
axiosRequest.maxRedirects = 0;
|
|
53
|
-
}
|
|
54
|
-
if (n8nRequest.encoding !== undefined) {
|
|
55
|
-
axiosRequest.responseType = n8nRequest.encoding;
|
|
56
|
-
}
|
|
57
|
-
const host = (0, axios_utils_1.getHostFromRequestObject)(n8nRequest);
|
|
58
|
-
const agentOptions = { ...n8nRequest.agentOptions };
|
|
59
|
-
if (host) {
|
|
60
|
-
agentOptions.servername = host;
|
|
61
|
-
}
|
|
62
|
-
if (n8nRequest.skipSslCertificateValidation === true) {
|
|
63
|
-
agentOptions.rejectUnauthorized = false;
|
|
64
|
-
}
|
|
65
|
-
const secureLookup = ssrfBridge?.createSecureLookup();
|
|
66
|
-
(0, axios_utils_1.setAxiosAgents)(axiosRequest, agentOptions, proxy, secureLookup);
|
|
67
|
-
axiosRequest.beforeRedirect = (0, axios_utils_1.getBeforeRedirectFn)(agentOptions, axiosRequest, n8nRequest.proxy, n8nRequest.sendCredentialsOnCrossOriginRedirect ?? true, n8nRequest.allowedDomains, ssrfBridge);
|
|
68
|
-
if (n8nRequest.arrayFormat !== undefined) {
|
|
69
|
-
axiosRequest.paramsSerializer = (params) => {
|
|
70
|
-
return (0, qs_1.stringify)(params, { arrayFormat: n8nRequest.arrayFormat });
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const { body } = n8nRequest;
|
|
74
|
-
if (body) {
|
|
75
|
-
const existingContentTypeHeaderKey = (0, axios_utils_1.searchForHeader)(axiosRequest, 'content-type');
|
|
76
|
-
if (existingContentTypeHeaderKey === undefined) {
|
|
77
|
-
axiosRequest.headers = axiosRequest.headers || {};
|
|
78
|
-
if ((0, axios_utils_1.isFormDataInstance)(body)) {
|
|
79
|
-
axiosRequest.headers = {
|
|
80
|
-
...axiosRequest.headers,
|
|
81
|
-
...body.getHeaders(),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
else if (body instanceof URLSearchParams) {
|
|
85
|
-
axiosRequest.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else if (axiosRequest.headers?.[existingContentTypeHeaderKey] === 'application/x-www-form-urlencoded') {
|
|
89
|
-
axiosRequest.data = new URLSearchParams(n8nRequest.body);
|
|
90
|
-
}
|
|
91
|
-
if (typeof body === 'string' || (typeof body === 'object' && !(0, n8n_workflow_1.isObjectEmpty)(body))) {
|
|
92
|
-
axiosRequest.data = body;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (n8nRequest.json) {
|
|
96
|
-
const key = (0, axios_utils_1.searchForHeader)(axiosRequest, 'accept');
|
|
97
|
-
if (!key) {
|
|
98
|
-
axiosRequest.headers = {
|
|
99
|
-
...axiosRequest.headers,
|
|
100
|
-
Accept: 'application/json',
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
(0, outbound_user_agent_1.applyDefaultOutboundUserAgent)(axiosRequest);
|
|
105
|
-
if (n8nRequest.ignoreHttpStatusErrors) {
|
|
106
|
-
const ignoreHttpStatusErrors = n8nRequest.ignoreHttpStatusErrors;
|
|
107
|
-
if ((0, axios_utils_1.isIgnoreStatusErrorConfig)(ignoreHttpStatusErrors)) {
|
|
108
|
-
axiosRequest.validateStatus = (status) => {
|
|
109
|
-
return !ignoreHttpStatusErrors.except.includes(status);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
axiosRequest.validateStatus = () => true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return axiosRequest;
|
|
117
|
-
}
|
|
118
|
-
const NoBodyHttpMethods = ['GET', 'HEAD', 'OPTIONS'];
|
|
119
|
-
function removeEmptyBody(requestOptions) {
|
|
120
|
-
const method = requestOptions.method || 'GET';
|
|
121
|
-
if (NoBodyHttpMethods.includes(method) && (0, isEmpty_1.default)(requestOptions.body)) {
|
|
122
|
-
delete requestOptions.body;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async function httpRequest(requestOptions, ssrfBridge) {
|
|
126
|
-
removeEmptyBody(requestOptions);
|
|
127
|
-
const url = (0, axios_utils_1.buildTargetUrl)(requestOptions.url, requestOptions.baseURL) ?? requestOptions.url;
|
|
128
|
-
await (0, axios_utils_1.validateUrlSsrf)(url, ssrfBridge);
|
|
129
|
-
const axiosRequest = convertN8nRequestToAxios(requestOptions, ssrfBridge);
|
|
130
|
-
if (axiosRequest.data === undefined ||
|
|
131
|
-
(axiosRequest.method !== undefined && axiosRequest.method.toUpperCase() === 'GET')) {
|
|
132
|
-
delete axiosRequest.data;
|
|
133
|
-
}
|
|
134
|
-
(0, axios_utils_1.throwIfDomainNotAllowed)(axiosRequest, requestOptions.allowedDomains);
|
|
135
|
-
const result = await invokeAxios(axiosRequest, requestOptions.auth);
|
|
136
|
-
if (requestOptions.returnFullResponse) {
|
|
137
|
-
return {
|
|
138
|
-
body: result.data,
|
|
139
|
-
headers: result.headers,
|
|
140
|
-
statusCode: result.status,
|
|
141
|
-
statusMessage: result.statusText,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return result.data;
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=http-request.js.map
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/http-request.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../src/execution-engine/node-execution-context/utils/request-helpers/http-request.ts"],"names":[],"mappings":";;;;;AA+BA,kCAkBC;A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,EAAE,UAAU,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,wBAAwB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAC1E,IACC,YAAY,CAAC,IAAI,KAAK,SAAS;QAC/B,CAAC,YAAY,CAAC,MAAM,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,EACjF,CAAC;QACF,OAAO,YAAY,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,IAAA,qCAAuB,EAAC,YAAY,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IAEpE,IAAI,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACvC,OAAO;YAEN,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,MAAM;YACzB,aAAa,EAAE,MAAM,CAAC,UAAU;SAChC,CAAC;IACH,CAAC;IAGD,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC"}
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/outbound-user-agent.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
-
export declare function buildRfcStyleUserAgent(version: string): string;
|
|
3
|
-
export declare function getDefaultN8nOutboundUserAgent(): string;
|
|
4
|
-
export declare function applyDefaultOutboundUserAgent(axiosConfig: AxiosRequestConfig): void;
|
package/dist/execution-engine/node-execution-context/utils/request-helpers/outbound-user-agent.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildRfcStyleUserAgent = buildRfcStyleUserAgent;
|
|
4
|
-
exports.getDefaultN8nOutboundUserAgent = getDefaultN8nOutboundUserAgent;
|
|
5
|
-
exports.applyDefaultOutboundUserAgent = applyDefaultOutboundUserAgent;
|
|
6
|
-
const config_1 = require("@n8n/config");
|
|
7
|
-
const di_1 = require("@n8n/di");
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const axios_utils_1 = require("./axios-utils");
|
|
10
|
-
const N8N_PRODUCT_URL = 'https://n8n.io/';
|
|
11
|
-
const LEGACY_USER_AGENT = 'n8n';
|
|
12
|
-
function readN8nVersion() {
|
|
13
|
-
try {
|
|
14
|
-
const pkg = require((0, node_path_1.join)(__dirname, '../../../../package.json'));
|
|
15
|
-
return pkg.version;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return '0.0.0';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function buildRfcStyleUserAgent(version) {
|
|
22
|
-
return `Mozilla/5.0 (compatible; n8n/${version}; +${N8N_PRODUCT_URL})`;
|
|
23
|
-
}
|
|
24
|
-
function getDefaultN8nOutboundUserAgent() {
|
|
25
|
-
const { enforceGlobalUserAgent, globalUserAgentValue } = di_1.Container.get(config_1.HttpRequestConfig);
|
|
26
|
-
if (!enforceGlobalUserAgent)
|
|
27
|
-
return LEGACY_USER_AGENT;
|
|
28
|
-
if (globalUserAgentValue.length > 0)
|
|
29
|
-
return globalUserAgentValue;
|
|
30
|
-
return buildRfcStyleUserAgent(readN8nVersion());
|
|
31
|
-
}
|
|
32
|
-
function applyDefaultOutboundUserAgent(axiosConfig) {
|
|
33
|
-
if ((0, axios_utils_1.searchForHeader)(axiosConfig, 'user-agent'))
|
|
34
|
-
return;
|
|
35
|
-
axiosConfig.headers = {
|
|
36
|
-
...axiosConfig.headers,
|
|
37
|
-
'User-Agent': getDefaultN8nOutboundUserAgent(),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=outbound-user-agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outbound-user-agent.js","sourceRoot":"","sources":["../../../../../src/execution-engine/node-execution-context/utils/request-helpers/outbound-user-agent.ts"],"names":[],"mappings":";;AA2BA,wDAEC;AAUD,wEAQC;AAMD,sEAOC;AA5DD,wCAAgD;AAChD,gCAAoC;AAEpC,yCAAiC;AAEjC,+CAAgD;AAEhD,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,SAAS,cAAc;IACtB,IAAI,CAAC;QAGJ,MAAM,GAAG,GAAG,OAAO,CAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,0BAA0B,CAAC,CAAwB,CAAC;QACxF,OAAO,GAAG,CAAC,OAAO,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,OAAO,CAAC;IAChB,CAAC;AACF,CAAC;AAQD,SAAgB,sBAAsB,CAAC,OAAe;IACrD,OAAO,gCAAgC,OAAO,MAAM,eAAe,GAAG,CAAC;AACxE,CAAC;AAUD,SAAgB,8BAA8B;IAC7C,MAAM,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,GAAG,cAAS,CAAC,GAAG,CAAC,0BAAiB,CAAC,CAAC;IAE1F,IAAI,CAAC,sBAAsB;QAAE,OAAO,iBAAiB,CAAC;IAEtD,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,oBAAoB,CAAC;IAEjE,OAAO,sBAAsB,CAAC,cAAc,EAAE,CAAC,CAAC;AACjD,CAAC;AAMD,SAAgB,6BAA6B,CAAC,WAA+B;IAC5E,IAAI,IAAA,6BAAe,EAAC,WAAW,EAAE,YAAY,CAAC;QAAE,OAAO;IAEvD,WAAW,CAAC,OAAO,GAAG;QACrB,GAAG,WAAW,CAAC,OAAO;QACtB,YAAY,EAAE,8BAA8B,EAAE;KAC9C,CAAC;AACH,CAAC"}
|
package/dist/http-proxy.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import http from 'http';
|
|
2
|
-
import https from 'https';
|
|
3
|
-
export declare function createHttpProxyAgent(customProxyUrl: string | null | undefined, targetUrl: string, options?: http.AgentOptions): http.Agent;
|
|
4
|
-
export declare function createHttpsProxyAgent(customProxyUrl: string | null | undefined, targetUrl: string, options?: https.AgentOptions): https.Agent;
|
|
5
|
-
export declare function installGlobalProxyAgent(): void;
|
|
6
|
-
export declare function uninstallGlobalProxyAgent(): void;
|