Merge pull request #26286 from backstage/freben/common-refs
remove various little backend-common references
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
'@backstage/create-app': patch
|
||||
---
|
||||
|
||||
Update templates to not refer to backend-common
|
||||
+2
-2
@@ -59,14 +59,14 @@ function writeTemporaryFile(tmpDir: string, name: string, content: string) {
|
||||
|
||||
If the `name` of the file is controlled by the user, they can for example enter `../../../../etc/hosts` as the name of the file. This can lead to a file being written outside the intended directory, which in turn can be used to inject malicious code or other form of attacks.
|
||||
|
||||
The recommended solution to this is to use `resolveSafeChildPath` from `@backstage/backend-common` to resolve the file path instead. It makes sure that the resolved path does not fall outside the provided directory. If you simply want to validate whether a file path is safe, you can use `isChildPath` instead.
|
||||
The recommended solution to this is to use `resolveSafeChildPath` from `@backstage/backend-plugin-api` to resolve the file path instead. It makes sure that the resolved path does not fall outside the provided directory. If you simply want to validate whether a file path is safe, you can use `isChildPath` instead.
|
||||
|
||||
The insecure example above should instead be written like this:
|
||||
|
||||
```ts
|
||||
// THIS IS GOOD, DO THIS
|
||||
|
||||
import { resolveSafeChildPath } from '@backstage/backend-common';
|
||||
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
function writeTemporaryFile(tmpDir: string, name: string, content: string) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { resolvePackagePath } from '@backstage/backend-common';
|
||||
import { resolvePackagePath } from '@backstage/backend-plugin-api';
|
||||
|
||||
createBackendPlugin({
|
||||
pluginId: 'example',
|
||||
|
||||
@@ -82,9 +82,11 @@ are separated out into their own folder, see further down.
|
||||
package. The `backend` uses plugins to construct a working backend that the
|
||||
frontend (`app`) can use.
|
||||
|
||||
- [`backend-common/`](https://github.com/backstage/backstage/tree/master/packages/backend-common) -
|
||||
There are no "core" packages in the backend. Instead we have `backend-common`
|
||||
which contains helper middleware and other utils.
|
||||
- [`backend-app-api/`](https://github.com/backstage/backstage/tree/master/packages/backend-app-api) -
|
||||
This package contains the central wiring for how to make Backstage backends.
|
||||
|
||||
- [`backend-plugin-api/`](https://github.com/backstage/backstage/tree/master/packages/backend-plugin-api) -
|
||||
This package contains the core APIs that are used to make Backstage backend features such as plugins and modules.
|
||||
|
||||
- [`catalog-client`](https://github.com/backstage/backstage/tree/master/packages/catalog-client) -
|
||||
An isomorphic client to interact with the Software Catalog. Backend plugins
|
||||
|
||||
@@ -277,7 +277,7 @@ function createConfigForRole(dir, role, extraConfig = {}) {
|
||||
restrictedSrcSyntax: [
|
||||
{
|
||||
message:
|
||||
"`__dirname` doesn't refer to the same dir in production builds, try `resolvePackagePath()` from `@backstage/backend-common` instead.",
|
||||
"`__dirname` doesn't refer to the same dir in production builds, try `resolvePackagePath()` from `@backstage/backend-plugin-api` instead.",
|
||||
selector: 'Identifier[name="__dirname"]',
|
||||
},
|
||||
...(extraConfig.restrictedSrcSyntax ?? []),
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"postpack": "backstage-cli package postpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "{{versionQuery '@backstage/backend-common'}}",
|
||||
"@backstage/backend-plugin-api": "{{versionQuery '@backstage/backend-plugin-api'}}"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
"postpack": "backstage-cli package postpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "{{versionQuery '@backstage/backend-common'}}",
|
||||
"@backstage/backend-defaults": "{{versionQuery '@backstage/backend-defaults'}}",
|
||||
"@backstage/backend-plugin-api": "{{versionQuery '@backstage/backend-plugin-api'}}",
|
||||
"express": "{{versionQuery 'express' '4.17.1'}}",
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
"@backstage/plugin-scaffolder-node": "{{versionQuery '@backstage/plugin-scaffolder-node'}}"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-common": "{{versionQuery '@backstage/backend-common'}}",
|
||||
"@backstage/cli": "{{versionQuery '@backstage/cli'}}"
|
||||
},
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { PassThrough } from 'stream';
|
||||
import { createAcmeExampleAction } from './example';
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
|
||||
describe('acme:example', () => {
|
||||
afterEach(() => {
|
||||
@@ -10,15 +9,14 @@ describe('acme:example', () => {
|
||||
it('should call action', async () => {
|
||||
const action = createAcmeExampleAction();
|
||||
|
||||
const logger = getVoidLogger();
|
||||
jest.spyOn(logger, 'info');
|
||||
const logger = { info: jest.fn() };
|
||||
|
||||
await action.handler({
|
||||
input: {
|
||||
myParameter: 'test',
|
||||
},
|
||||
workspacePath: '/tmp',
|
||||
logger,
|
||||
logger: logger as any,
|
||||
logStream: new PassThrough(),
|
||||
output: jest.fn(),
|
||||
createTemporaryDirectory() {
|
||||
|
||||
@@ -50,7 +50,6 @@ jest.mock('./versions', () => ({
|
||||
packageVersions: {
|
||||
root: '1.2.3',
|
||||
'@backstage/cli': '1.0.0',
|
||||
'@backstage/backend-common': '1.0.0',
|
||||
'@backstage/backend-defaults': '1.0.0',
|
||||
'@backstage/backend-tasks': '1.0.0',
|
||||
'@backstage/catalog-model': '1.0.0',
|
||||
|
||||
@@ -32,7 +32,6 @@ leaving any imports in place.
|
||||
import { version as root } from '../../../../package.json';
|
||||
|
||||
import { version as appDefaults } from '../../../app-defaults/package.json';
|
||||
import { version as backendCommon } from '../../../backend-common/package.json';
|
||||
import { version as backendDefaults } from '../../../backend-defaults/package.json';
|
||||
import { version as catalogClient } from '../../../catalog-client/package.json';
|
||||
import { version as catalogModel } from '../../../catalog-model/package.json';
|
||||
@@ -88,7 +87,6 @@ import { version as pluginUserSettings } from '../../../../plugins/user-settings
|
||||
export const packageVersions = {
|
||||
root,
|
||||
'@backstage/app-defaults': appDefaults,
|
||||
'@backstage/backend-common': backendCommon,
|
||||
'@backstage/backend-defaults': backendDefaults,
|
||||
'@backstage/catalog-client': catalogClient,
|
||||
'@backstage/catalog-model': catalogModel,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^{{version '@backstage/backend-common'}}",
|
||||
"@backstage/backend-defaults": "^{{version '@backstage/backend-defaults'}}",
|
||||
"@backstage/config": "^{{version '@backstage/config'}}",
|
||||
"@backstage/plugin-app-backend": "^{{version '@backstage/plugin-app-backend'}}",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { resolvePackagePath } from '@backstage/backend-common';
|
||||
import { resolvePackagePath } from '@backstage/backend-plugin-api';
|
||||
import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
|
||||
import { Knex } from 'knex';
|
||||
import { UserInfoDatabaseHandler } from './UserInfoDatabaseHandler';
|
||||
|
||||
Reference in New Issue
Block a user