nx 22.7.9 → 22.7.10
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.
|
Binary file
|
|
Binary file
|
|
@@ -22,6 +22,7 @@ const target_merging_1 = require("../project-graph/utils/project-configuration/t
|
|
|
22
22
|
const catalog_1 = require("./catalog");
|
|
23
23
|
const fileutils_1 = require("./fileutils");
|
|
24
24
|
const has_nx_js_plugin_1 = require("./has-nx-js-plugin");
|
|
25
|
+
const path_2 = require("./path");
|
|
25
26
|
const installation_directory_1 = require("./installation-directory");
|
|
26
27
|
const package_manager_1 = require("./package-manager");
|
|
27
28
|
const workspace_root_1 = require("./workspace-root");
|
|
@@ -34,15 +35,25 @@ function normalizePackageGroup(packageGroup) {
|
|
|
34
35
|
}));
|
|
35
36
|
}
|
|
36
37
|
function readNxMigrateConfig(json) {
|
|
38
|
+
// Registry fetching uses this value to build a temporary extraction path.
|
|
39
|
+
// Reject unsupported absolute paths and escaping parent traversal before extraction.
|
|
40
|
+
const assertContained = (migrations) => {
|
|
41
|
+
if (!(0, path_2.isContainedRelativePath)(migrations)) {
|
|
42
|
+
throw new Error(`Invalid migrations path "${migrations}" in package "${json.name ?? 'unknown'}@${json.version ?? 'unknown'}": migration paths must not be absolute or escape their base directory through parent traversal.`);
|
|
43
|
+
}
|
|
44
|
+
return migrations;
|
|
45
|
+
};
|
|
37
46
|
const parseNxMigrationsConfig = (fromJson) => {
|
|
38
47
|
if (!fromJson) {
|
|
39
48
|
return {};
|
|
40
49
|
}
|
|
41
50
|
if (typeof fromJson === 'string') {
|
|
42
|
-
return { migrations: fromJson, packageGroup: [] };
|
|
51
|
+
return { migrations: assertContained(fromJson), packageGroup: [] };
|
|
43
52
|
}
|
|
44
53
|
return {
|
|
45
|
-
...(fromJson.migrations
|
|
54
|
+
...(fromJson.migrations
|
|
55
|
+
? { migrations: assertContained(fromJson.migrations) }
|
|
56
|
+
: {}),
|
|
46
57
|
...(fromJson.packageGroup
|
|
47
58
|
? { packageGroup: normalizePackageGroup(fromJson.packageGroup) }
|
|
48
59
|
: {}),
|
package/dist/src/utils/path.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export declare function normalizePath(osSpecificPath: string): string;
|
|
|
8
8
|
* This should not be used to read files on disk because of the removal of Windows drive letters.
|
|
9
9
|
*/
|
|
10
10
|
export declare function joinPathFragments(...fragments: string[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* True when `relativePath` stays inside the directory it is resolved against.
|
|
13
|
+
* Absolute paths are rejected because `path.join` silently treats them as
|
|
14
|
+
* relative, so they would otherwise slip past a `..` check.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isContainedRelativePath(relativePath: string): boolean;
|
|
11
17
|
/**
|
|
12
18
|
* When running a script with the package manager (e.g. `npm run`), the package manager will
|
|
13
19
|
* traverse the directory tree upwards until it finds a `package.json` and will set `process.cwd()`
|
package/dist/src/utils/path.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizePath = normalizePath;
|
|
4
4
|
exports.joinPathFragments = joinPathFragments;
|
|
5
|
+
exports.isContainedRelativePath = isContainedRelativePath;
|
|
5
6
|
exports.getCwd = getCwd;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const path = tslib_1.__importStar(require("path"));
|
|
@@ -23,6 +24,20 @@ function normalizePath(osSpecificPath) {
|
|
|
23
24
|
function joinPathFragments(...fragments) {
|
|
24
25
|
return normalizePath(path.join(...fragments));
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* True when `relativePath` stays inside the directory it is resolved against.
|
|
29
|
+
* Absolute paths are rejected because `path.join` silently treats them as
|
|
30
|
+
* relative, so they would otherwise slip past a `..` check.
|
|
31
|
+
*/
|
|
32
|
+
function isContainedRelativePath(relativePath) {
|
|
33
|
+
if (path.isAbsolute(relativePath)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const normalized = path.normalize(relativePath);
|
|
37
|
+
return !(normalized === '..' ||
|
|
38
|
+
normalized.startsWith(`..${path.sep}`) ||
|
|
39
|
+
normalized.startsWith(`..${path.posix.sep}`));
|
|
40
|
+
}
|
|
26
41
|
/**
|
|
27
42
|
* When running a script with the package manager (e.g. `npm run`), the package manager will
|
|
28
43
|
* traverse the directory tree upwards until it finds a `package.json` and will set `process.cwd()`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.7.
|
|
3
|
+
"version": "22.7.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
@@ -175,16 +175,16 @@
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
"optionalDependencies": {
|
|
178
|
-
"@nx/nx-darwin-arm64": "22.7.
|
|
179
|
-
"@nx/nx-darwin-x64": "22.7.
|
|
180
|
-
"@nx/nx-freebsd-x64": "22.7.
|
|
181
|
-
"@nx/nx-linux-arm-gnueabihf": "22.7.
|
|
182
|
-
"@nx/nx-linux-arm64-gnu": "22.7.
|
|
183
|
-
"@nx/nx-linux-arm64-musl": "22.7.
|
|
184
|
-
"@nx/nx-linux-x64-gnu": "22.7.
|
|
185
|
-
"@nx/nx-linux-x64-musl": "22.7.
|
|
186
|
-
"@nx/nx-win32-arm64-msvc": "22.7.
|
|
187
|
-
"@nx/nx-win32-x64-msvc": "22.7.
|
|
178
|
+
"@nx/nx-darwin-arm64": "22.7.10",
|
|
179
|
+
"@nx/nx-darwin-x64": "22.7.10",
|
|
180
|
+
"@nx/nx-freebsd-x64": "22.7.10",
|
|
181
|
+
"@nx/nx-linux-arm-gnueabihf": "22.7.10",
|
|
182
|
+
"@nx/nx-linux-arm64-gnu": "22.7.10",
|
|
183
|
+
"@nx/nx-linux-arm64-musl": "22.7.10",
|
|
184
|
+
"@nx/nx-linux-x64-gnu": "22.7.10",
|
|
185
|
+
"@nx/nx-linux-x64-musl": "22.7.10",
|
|
186
|
+
"@nx/nx-win32-arm64-msvc": "22.7.10",
|
|
187
|
+
"@nx/nx-win32-x64-msvc": "22.7.10"
|
|
188
188
|
},
|
|
189
189
|
"nx-migrations": {
|
|
190
190
|
"migrations": "./migrations.json",
|