@n8n/backend-common 0.12.1 → 0.12.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.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/path-util.d.ts +2 -0
- package/dist/utils/path-util.js +55 -0
- package/dist/utils/path-util.js.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { isObjectLiteral } from './utils/is-object-literal';
|
|
|
5
5
|
export { Logger } from './logging/logger';
|
|
6
6
|
export { ModuleRegistry } from './modules/module-registry';
|
|
7
7
|
export { ModulesConfig, ModuleName } from './modules/modules.config';
|
|
8
|
+
export { isContainedWithin, safeJoinPath } from './utils/path-util';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ModulesConfig = exports.ModuleRegistry = exports.Logger = exports.isObjectLiteral = exports.inTest = exports.inProduction = exports.inDevelopment = void 0;
|
|
17
|
+
exports.safeJoinPath = exports.isContainedWithin = exports.ModulesConfig = exports.ModuleRegistry = exports.Logger = exports.isObjectLiteral = exports.inTest = exports.inProduction = exports.inDevelopment = void 0;
|
|
18
18
|
__exportStar(require("./license-state"), exports);
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
var environment_1 = require("./environment");
|
|
@@ -29,4 +29,7 @@ var module_registry_1 = require("./modules/module-registry");
|
|
|
29
29
|
Object.defineProperty(exports, "ModuleRegistry", { enumerable: true, get: function () { return module_registry_1.ModuleRegistry; } });
|
|
30
30
|
var modules_config_1 = require("./modules/modules.config");
|
|
31
31
|
Object.defineProperty(exports, "ModulesConfig", { enumerable: true, get: function () { return modules_config_1.ModulesConfig; } });
|
|
32
|
+
var path_util_1 = require("./utils/path-util");
|
|
33
|
+
Object.defineProperty(exports, "isContainedWithin", { enumerable: true, get: function () { return path_util_1.isContainedWithin; } });
|
|
34
|
+
Object.defineProperty(exports, "safeJoinPath", { enumerable: true, get: function () { return path_util_1.safeJoinPath; } });
|
|
32
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0CAAwB;AAExB,6CAAoE;AAA3D,4GAAA,aAAa,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,qGAAA,MAAM,OAAA;AAC5C,+DAA4D;AAAnD,oHAAA,eAAe,OAAA;AACxB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6DAA2D;AAAlD,iHAAA,cAAc,OAAA;AACvB,2DAAqE;AAA5D,+GAAA,aAAa,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0CAAwB;AAExB,6CAAoE;AAA3D,4GAAA,aAAa,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,qGAAA,MAAM,OAAA;AAC5C,+DAA4D;AAAnD,oHAAA,eAAe,OAAA;AACxB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6DAA2D;AAAlD,iHAAA,cAAc,OAAA;AACvB,2DAAqE;AAA5D,+GAAA,aAAa,OAAA;AACtB,+CAAoE;AAA3D,8GAAA,iBAAiB,OAAA;AAAE,yGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isContainedWithin = isContainedWithin;
|
|
37
|
+
exports.safeJoinPath = safeJoinPath;
|
|
38
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
function isContainedWithin(parentPath, childPath) {
|
|
41
|
+
parentPath = path.resolve(parentPath);
|
|
42
|
+
childPath = path.resolve(childPath);
|
|
43
|
+
if (parentPath === childPath) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return childPath.startsWith(parentPath + path.sep);
|
|
47
|
+
}
|
|
48
|
+
function safeJoinPath(parentPath, ...paths) {
|
|
49
|
+
const candidate = path.join(parentPath, ...paths);
|
|
50
|
+
if (!isContainedWithin(parentPath, candidate)) {
|
|
51
|
+
throw new n8n_workflow_1.UnexpectedError(`Path traversal detected, refusing to join paths: ${parentPath} and ${JSON.stringify(paths)}`);
|
|
52
|
+
}
|
|
53
|
+
return candidate;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=path-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-util.js","sourceRoot":"","sources":["../../src/utils/path-util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,8CASC;AASD,oCAUC;AAnCD,+CAA+C;AAC/C,gDAAkC;AAMlC,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,SAAiB;IACtE,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEpC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,SAAS,CAAC,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AASD,SAAgB,YAAY,CAAC,UAAkB,EAAE,GAAG,KAAe;IAClE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,CAAC;IAElD,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,8BAAe,CACxB,oDAAoD,UAAU,QAAQ,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAC7F,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/backend-common",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"reflect-metadata": "0.2.2",
|
|
16
16
|
"winston": "3.14.2",
|
|
17
17
|
"@n8n/config": "^1.45.0",
|
|
18
|
-
"@n8n/constants": "^0.9.0",
|
|
19
18
|
"@n8n/decorators": "^0.12.1",
|
|
20
19
|
"@n8n/di": "^0.8.0",
|
|
21
|
-
"n8n-workflow": "^1.99.1"
|
|
20
|
+
"n8n-workflow": "^1.99.1",
|
|
21
|
+
"@n8n/constants": "^0.9.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@n8n/typescript-config": "1.3.0"
|