@n8n/task-runner 2.42.0 → 2.42.2
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.
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.freezeGlobals = void 0;
|
|
4
4
|
const node_events_1 = require("node:events");
|
|
5
|
-
const isFreezable = (value) => typeof value === 'object' || typeof value === 'function';
|
|
6
|
-
const freezeFunctionAndPrototype = (fn) => {
|
|
7
|
-
if (isFreezable(fn.prototype)) {
|
|
8
|
-
Object.freeze(fn.prototype);
|
|
9
|
-
}
|
|
10
|
-
Object.freeze(fn);
|
|
11
|
-
};
|
|
5
|
+
const isFreezable = (value) => value !== null && (typeof value === 'object' || typeof value === 'function');
|
|
12
6
|
const PROTECTED_EVENT_EMITTER_METHODS = [
|
|
13
7
|
'emit',
|
|
14
8
|
'on',
|
|
@@ -27,11 +21,56 @@ const lockEventEmitterMethods = () => {
|
|
|
27
21
|
});
|
|
28
22
|
}
|
|
29
23
|
};
|
|
24
|
+
const METHOD_LOCKED_PROTOTYPES = [node_events_1.EventEmitter.prototype];
|
|
25
|
+
const hasIteratorHelpers = (value) => isFreezable(value) && typeof Reflect.get(value, 'map') === 'function';
|
|
26
|
+
const unreachablePrototypes = () => {
|
|
27
|
+
const timeout = setTimeout(() => { }, 0);
|
|
28
|
+
clearTimeout(timeout);
|
|
29
|
+
const immediate = setImmediate(() => { });
|
|
30
|
+
clearImmediate(immediate);
|
|
31
|
+
function* generatorFunction() { }
|
|
32
|
+
async function* asyncGeneratorFunction() { }
|
|
33
|
+
async function asyncFunction() { }
|
|
34
|
+
const arrayIterator = [].values();
|
|
35
|
+
const iteratorHelper = hasIteratorHelpers(arrayIterator)
|
|
36
|
+
? [arrayIterator.map((value) => value)]
|
|
37
|
+
: [];
|
|
38
|
+
return [
|
|
39
|
+
timeout,
|
|
40
|
+
immediate,
|
|
41
|
+
generatorFunction,
|
|
42
|
+
asyncGeneratorFunction,
|
|
43
|
+
asyncFunction,
|
|
44
|
+
[][Symbol.iterator](),
|
|
45
|
+
''[Symbol.iterator](),
|
|
46
|
+
new Map()[Symbol.iterator](),
|
|
47
|
+
new Set()[Symbol.iterator](),
|
|
48
|
+
new FormData().entries(),
|
|
49
|
+
...iteratorHelper,
|
|
50
|
+
].map((value) => Object.getPrototypeOf(value));
|
|
51
|
+
};
|
|
52
|
+
const collectPrototypeChain = (value, collected) => {
|
|
53
|
+
let current = value;
|
|
54
|
+
while (isFreezable(current) && !collected.has(current)) {
|
|
55
|
+
collected.add(current);
|
|
56
|
+
current = Object.getPrototypeOf(current);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
30
59
|
const freezeGlobals = () => {
|
|
31
|
-
Object.getOwnPropertyNames(globalThis)
|
|
60
|
+
const globalFunctions = Object.getOwnPropertyNames(globalThis)
|
|
32
61
|
.map((name) => Reflect.get(globalThis, name))
|
|
33
|
-
.filter((value) => typeof value === 'function')
|
|
34
|
-
|
|
62
|
+
.filter((value) => typeof value === 'function');
|
|
63
|
+
const roots = [...globalFunctions, ...unreachablePrototypes()];
|
|
64
|
+
const collected = new Set();
|
|
65
|
+
for (const root of roots) {
|
|
66
|
+
collectPrototypeChain(root, collected);
|
|
67
|
+
if (isFreezable(root))
|
|
68
|
+
collectPrototypeChain(Reflect.get(root, 'prototype'), collected);
|
|
69
|
+
}
|
|
70
|
+
for (const prototype of METHOD_LOCKED_PROTOTYPES) {
|
|
71
|
+
collected.delete(prototype);
|
|
72
|
+
}
|
|
73
|
+
collected.forEach(Object.freeze);
|
|
35
74
|
[Reflect, JSON, Math].forEach(Object.freeze);
|
|
36
75
|
lockEventEmitterMethods();
|
|
37
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-hardening.js","sourceRoot":"","sources":["../../src/js-task-runner/prototype-hardening.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;
|
|
1
|
+
{"version":3,"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SACvE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAY,CAAC;SACvD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,qBAAqB,EAAE,CAAC,CAAC;IAE/D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IAEpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,WAAW,CAAC,IAAI,CAAC;YAAE,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;IACzF,CAAC;IAED,KAAK,MAAM,SAAS,IAAI,wBAAwB,EAAE,CAAC;QAClD,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEjC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE7C,uBAAuB,EAAE,CAAC;AAC3B,CAAC,CAAC;AAvBW,QAAA,aAAa,GAAb,aAAa,CAuBxB"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/task-runner",
|
|
3
|
-
"version": "2.42.
|
|
3
|
+
"version": "2.42.2",
|
|
4
4
|
"main": "dist/start.js",
|
|
5
5
|
"module": "src/start.ts",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/**/*",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"LICENSE_EE.md",
|
|
10
|
+
"LICENSE.md"
|
|
11
11
|
],
|
|
12
12
|
"exports": {
|
|
13
13
|
"./start": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"acorn-walk": "8.3.4",
|
|
31
31
|
"lodash": "4.18.1",
|
|
32
32
|
"luxon": "3.7.2",
|
|
33
|
-
"n8n-core": "2.42.
|
|
34
|
-
"n8n-workflow": "2.42.
|
|
33
|
+
"n8n-core": "2.42.2",
|
|
34
|
+
"n8n-workflow": "2.42.2",
|
|
35
35
|
"nanoid": "3.3.18",
|
|
36
36
|
"ws": "^8.18.0"
|
|
37
37
|
},
|