@backstage/backend-plugin-api 1.6.0 → 1.6.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/CHANGELOG.md +11 -0
- package/dist/paths.cjs.js +2 -14
- package/dist/paths.cjs.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage/backend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ae4dd5d: Move some of the symlink resolution to `isChildPath`
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/cli-common@0.1.17
|
|
10
|
+
- @backstage/plugin-auth-node@0.6.11
|
|
11
|
+
- @backstage/plugin-permission-common@0.9.4
|
|
12
|
+
- @backstage/plugin-permission-node@0.10.8
|
|
13
|
+
|
|
3
14
|
## 1.6.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/paths.cjs.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var cliCommon = require('@backstage/cli-common');
|
|
4
4
|
var errors = require('@backstage/errors');
|
|
5
5
|
var path = require('path');
|
|
6
|
-
var fs = require('fs');
|
|
7
6
|
|
|
8
7
|
const packagePathMocks = /* @__PURE__ */ new Map();
|
|
9
8
|
function resolvePackagePath(name, ...paths) {
|
|
@@ -18,25 +17,14 @@ function resolvePackagePath(name, ...paths) {
|
|
|
18
17
|
return path.resolve(req.resolve(`${name}/package.json`), "..", ...paths);
|
|
19
18
|
}
|
|
20
19
|
function resolveSafeChildPath(base, path$1) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
if (!cliCommon.isChildPath(resolvedBasePath, resolveRealPath(targetPath))) {
|
|
20
|
+
const targetPath = path.resolve(base, path$1);
|
|
21
|
+
if (!cliCommon.isChildPath(base, targetPath)) {
|
|
24
22
|
throw new errors.NotAllowedError(
|
|
25
23
|
"Relative path is not allowed to refer to a directory outside its parent"
|
|
26
24
|
);
|
|
27
25
|
}
|
|
28
26
|
return path.resolve(base, path$1);
|
|
29
27
|
}
|
|
30
|
-
function resolveRealPath(path) {
|
|
31
|
-
try {
|
|
32
|
-
return fs.realpathSync(path);
|
|
33
|
-
} catch (ex) {
|
|
34
|
-
if (ex.code !== "ENOENT") {
|
|
35
|
-
throw ex;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return path;
|
|
39
|
-
}
|
|
40
28
|
|
|
41
29
|
Object.defineProperty(exports, "isChildPath", {
|
|
42
30
|
enumerable: true,
|
package/dist/paths.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.cjs.js","sources":["../src/paths.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isChildPath } from '@backstage/cli-common';\nimport { NotAllowedError } from '@backstage/errors';\nimport { resolve as resolvePath } from 'path';\
|
|
1
|
+
{"version":3,"file":"paths.cjs.js","sources":["../src/paths.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isChildPath } from '@backstage/cli-common';\nimport { NotAllowedError } from '@backstage/errors';\nimport { resolve as resolvePath } from 'path';\n\n/** @internal */\nexport const packagePathMocks = new Map<\n string,\n (paths: string[]) => string | undefined\n>();\n\n/**\n * Resolve a path relative to the root of a package directory.\n * Additional path arguments are resolved relative to the package dir.\n *\n * This is particularly useful when you want to access assets shipped with\n * your backend plugin package. When doing so, do not forget to include the assets\n * in your published package by adding them to `files` in your `package.json`.\n *\n * @public\n */\nexport function resolvePackagePath(name: string, ...paths: string[]) {\n const mockedResolve = packagePathMocks.get(name);\n if (mockedResolve) {\n const resolved = mockedResolve(paths);\n if (resolved) {\n return resolved;\n }\n }\n\n const req =\n typeof __non_webpack_require__ === 'undefined'\n ? require\n : __non_webpack_require__;\n\n return resolvePath(req.resolve(`${name}/package.json`), '..', ...paths);\n}\n\n/**\n * Resolves a target path from a base path while guaranteeing that the result is\n * a path that point to or within the base path. This is useful for resolving\n * paths from user input, as it otherwise opens up for vulnerabilities.\n *\n * @public\n * @param base - The base directory to resolve the path from.\n * @param path - The target path, relative or absolute\n * @returns A path that is guaranteed to point to or within the base path.\n */\nexport function resolveSafeChildPath(base: string, path: string): string {\n const targetPath = resolvePath(base, path);\n\n if (!isChildPath(base, targetPath)) {\n throw new NotAllowedError(\n 'Relative path is not allowed to refer to a directory outside its parent',\n );\n }\n\n // Don't return the resolved path as the original could be a symlink\n return resolvePath(base, path);\n}\n\n// Re-export isChildPath so that backend packages don't need to depend on cli-common\nexport { isChildPath };\n"],"names":["resolvePath","path","isChildPath","NotAllowedError"],"mappings":";;;;;;AAqBO,MAAM,gBAAA,uBAAuB,GAAA;AAe7B,SAAS,kBAAA,CAAmB,SAAiB,KAAA,EAAiB;AACnE,EAAA,MAAM,aAAA,GAAgB,gBAAA,CAAiB,GAAA,CAAI,IAAI,CAAA;AAC/C,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,MAAM,QAAA,GAAW,cAAc,KAAK,CAAA;AACpC,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAO,QAAA;AAAA,IACT;AAAA,EACF;AAEA,EAAA,MAAM,GAAA,GACJ,OAAO,uBAAA,KAA4B,WAAA,GAC/B,OAAA,GACA,uBAAA;AAEN,EAAA,OAAOA,YAAA,CAAY,IAAI,OAAA,CAAQ,CAAA,EAAG,IAAI,CAAA,aAAA,CAAe,CAAA,EAAG,IAAA,EAAM,GAAG,KAAK,CAAA;AACxE;AAYO,SAAS,oBAAA,CAAqB,MAAcC,MAAA,EAAsB;AACvE,EAAA,MAAM,UAAA,GAAaD,YAAA,CAAY,IAAA,EAAMC,MAAI,CAAA;AAEzC,EAAA,IAAI,CAACC,qBAAA,CAAY,IAAA,EAAM,UAAU,CAAA,EAAG;AAClC,IAAA,MAAM,IAAIC,sBAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AAGA,EAAA,OAAOH,YAAA,CAAY,MAAMC,MAAI,CAAA;AAC/B;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-plugin-api",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Core API used by Backstage backend plugins",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"test": "backstage-cli package test"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@backstage/cli-common": "^0.1.
|
|
68
|
+
"@backstage/cli-common": "^0.1.17",
|
|
69
69
|
"@backstage/config": "^1.3.6",
|
|
70
70
|
"@backstage/errors": "^1.2.7",
|
|
71
|
-
"@backstage/plugin-auth-node": "^0.6.
|
|
72
|
-
"@backstage/plugin-permission-common": "^0.9.
|
|
73
|
-
"@backstage/plugin-permission-node": "^0.10.
|
|
71
|
+
"@backstage/plugin-auth-node": "^0.6.11",
|
|
72
|
+
"@backstage/plugin-permission-common": "^0.9.4",
|
|
73
|
+
"@backstage/plugin-permission-node": "^0.10.8",
|
|
74
74
|
"@backstage/types": "^1.2.2",
|
|
75
75
|
"@types/express": "^4.17.6",
|
|
76
76
|
"@types/json-schema": "^7.0.6",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"zod": "^3.22.4"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@backstage/backend-test-utils": "^1.10.
|
|
85
|
-
"@backstage/cli": "^0.35.
|
|
84
|
+
"@backstage/backend-test-utils": "^1.10.3",
|
|
85
|
+
"@backstage/cli": "^0.35.2"
|
|
86
86
|
},
|
|
87
87
|
"configSchema": "config.d.ts"
|
|
88
88
|
}
|