@backstage/plugin-app-backend 0.5.14 → 0.5.15-next.0

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-app-backend
2
2
 
3
+ ## 0.5.15-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ca450be: Added a new `app.disablePublicEntryPoint` config option that allows you to opt out of the automatic public sign-in entry point. When set to `true`, the app backend will skip serving the public entry point to unauthenticated users, even if the app was bundled with an `index-public-experimental` entry point.
8
+ - Updated dependencies
9
+ - @backstage/plugin-auth-node@0.7.2-next.0
10
+ - @backstage/backend-plugin-api@1.9.2-next.0
11
+ - @backstage/plugin-app-node@0.1.46-next.0
12
+
3
13
  ## 0.5.14
4
14
 
5
15
  ### Patch Changes
package/config.d.ts CHANGED
@@ -42,5 +42,14 @@ export interface Config {
42
42
  * If you disable this, it is recommended to set a `staticFallbackHandler` instead.
43
43
  */
44
44
  disableStaticFallbackCache?: boolean;
45
+
46
+ /**
47
+ * Disables the public entry point used for unauthenticated sign-in pages.
48
+ * When the app is bundled with an `index-public-experimental` entry point,
49
+ * the app backend will automatically serve it to unauthenticated users.
50
+ * Set this to `true` to skip that behavior and always serve the main
51
+ * entry point instead.
52
+ */
53
+ disablePublicEntryPoint?: boolean;
45
54
  };
46
55
  }
@@ -61,7 +61,10 @@ async function createRouter(options) {
61
61
  const router = Router__default.default();
62
62
  router.use(helmet__default.default.frameguard({ action: "deny" }));
63
63
  const publicDistDir = node_path.resolve(appDistDir, "public");
64
- const enablePublicEntryPoint = await fs__default.default.pathExists(publicDistDir);
64
+ const disablePublicEntryPoint = config.getOptionalBoolean(
65
+ "app.disablePublicEntryPoint"
66
+ );
67
+ const enablePublicEntryPoint = !disablePublicEntryPoint && await fs__default.default.pathExists(publicDistDir);
65
68
  if (enablePublicEntryPoint) {
66
69
  logger.info(
67
70
  `App is running in protected mode, serving public content from ${publicDistDir}`
@@ -1 +1 @@
1
- {"version":3,"file":"router.cjs.js","sources":["../../src/service/router.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 {\n DatabaseService,\n resolvePackagePath,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport type { AppConfig } from '@backstage/config';\nimport helmet from 'helmet';\nimport express, { Request, Response } from 'express';\nimport Router from 'express-promise-router';\nimport fs from 'fs-extra';\nimport { resolve as resolvePath } from 'node:path';\nimport {\n createStaticAssetMiddleware,\n findStaticAssets,\n StaticAssetsStore,\n} from '../lib/assets';\nimport {\n CACHE_CONTROL_MAX_CACHE,\n CACHE_CONTROL_NO_CACHE,\n CACHE_CONTROL_REVALIDATE_CACHE,\n} from '../lib/headers';\nimport type { ConfigSchema } from '@backstage/config-loader';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { AuthenticationError, InputError } from '@backstage/errors';\nimport { injectConfig, readFrontendConfig } from '../lib/config';\n\n// express uses mime v1 while we only have types for mime v2\ntype Mime = { lookup(arg0: string): string };\n\n/**\n * @internal\n */\nexport interface RouterOptions {\n config: RootConfigService;\n logger: LoggerService;\n auth: AuthService;\n httpAuth: HttpAuthService;\n\n /**\n * If a database is provided it will be used to cache previously deployed static assets.\n *\n * This is a built-in alternative to using a `staticFallbackHandler`.\n */\n database: DatabaseService;\n\n /**\n * The name of the app package that content should be served from. The same app package should be\n * added as a dependency to the backend package in order for it to be accessible at runtime.\n *\n * In a typical setup with a single app package this would be set to 'app'.\n */\n appPackageName: string;\n\n /**\n * A request handler to handle requests for static content that are not present in the app bundle.\n *\n * This can be used to avoid issues with clients on older deployment versions trying to access lazy\n * loaded content that is no longer present. Typically the requests would fall back to a long-term\n * object store where all recently deployed versions of the app are present.\n *\n * Another option is to provide a `database` that will take care of storing the static assets instead.\n *\n * If both `database` and `staticFallbackHandler` are provided, the `database` will attempt to serve\n * static assets first, and if they are not found, the `staticFallbackHandler` will be called.\n */\n staticFallbackHandler?: express.Handler;\n\n /**\n *\n * Provides a ConfigSchema.\n *\n */\n schema?: ConfigSchema;\n}\n\n/**\n * @internal\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n appPackageName,\n staticFallbackHandler,\n auth,\n httpAuth,\n schema,\n } = options;\n\n const disableConfigInjection = config.getOptionalBoolean(\n 'app.disableConfigInjection',\n );\n const disableStaticFallbackCache = config.getOptionalBoolean(\n 'app.disableStaticFallbackCache',\n );\n\n const appDistDir = resolvePackagePath(appPackageName, 'dist');\n const staticDir = resolvePath(appDistDir, 'static');\n\n if (!(await fs.pathExists(staticDir))) {\n if (process.env.NODE_ENV === 'production') {\n logger.error(\n `Can't serve static app content from ${staticDir}, directory doesn't exist`,\n );\n }\n\n return Router();\n }\n\n logger.info(`Serving static app content from ${appDistDir}`);\n\n const appConfigs = disableConfigInjection\n ? undefined\n : await readFrontendConfig({\n config,\n appDistDir,\n env: process.env,\n schema,\n });\n\n const assetStore = !disableStaticFallbackCache\n ? await StaticAssetsStore.create({\n logger,\n database: options.database,\n })\n : undefined;\n\n const router = Router();\n\n router.use(helmet.frameguard({ action: 'deny' }));\n\n const publicDistDir = resolvePath(appDistDir, 'public');\n\n const enablePublicEntryPoint = await fs.pathExists(publicDistDir);\n\n if (enablePublicEntryPoint) {\n logger.info(\n `App is running in protected mode, serving public content from ${publicDistDir}`,\n );\n\n const publicRouter = Router();\n\n publicRouter.use(async (req, res, next) => {\n try {\n const credentials = await httpAuth.credentials(req, {\n allow: ['user', 'service', 'none'],\n allowLimitedAccess: true,\n });\n\n if (credentials.principal.type === 'none') {\n next();\n } else {\n next('router');\n }\n } catch {\n // If we fail to authenticate, make sure the session cookie is cleared\n // and continue as unauthenticated. If the user is logged in they will\n // immediately be redirected back to the protected app via the POST.\n await httpAuth.issueUserCookie(res, {\n credentials: await auth.getNoneCredentials(),\n });\n next();\n }\n });\n\n publicRouter.post(\n '*',\n express.urlencoded({ extended: true }),\n async (req, res, next) => {\n if (req.body.type === 'sign-in') {\n const credentials = await auth.authenticate(req.body.token);\n\n if (!auth.isPrincipal(credentials, 'user')) {\n throw new AuthenticationError('Invalid token, not a user');\n }\n\n await httpAuth.issueUserCookie(res, {\n credentials,\n });\n\n // Resume as if it was a GET request towards the outer protected router, serving index.html\n req.method = 'GET';\n next('router');\n } else {\n throw new InputError(\n 'Invalid POST request to app-backend wildcard endpoint',\n );\n }\n },\n );\n\n publicRouter.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'public' }),\n rootDir: publicDistDir,\n assetStore: assetStore?.withNamespace('public'),\n appConfigs, // TODO(Rugvip): We should not be including the full config here\n }),\n );\n\n router.use(publicRouter);\n }\n\n router.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'main' }),\n rootDir: appDistDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n }),\n );\n\n return router;\n}\n\nasync function createEntryPointRouter({\n logger,\n rootDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n}: {\n logger: LoggerService;\n rootDir: string;\n assetStore?: StaticAssetsStore;\n staticFallbackHandler?: express.Handler;\n appConfigs?: AppConfig[];\n}) {\n const staticDir = resolvePath(rootDir, 'static');\n\n const injectResult =\n appConfigs &&\n (await injectConfig({ appConfigs, logger, rootDir, staticDir }));\n\n const router = Router();\n\n // Use a separate router for static content so that a fallback can be provided by backend\n const staticRouter = Router();\n staticRouter.use(\n express.static(staticDir, {\n setHeaders: (res, path) => {\n if (injectResult?.injectedPath === path) {\n res.setHeader('Cache-Control', CACHE_CONTROL_REVALIDATE_CACHE);\n } else {\n res.setHeader('Cache-Control', CACHE_CONTROL_MAX_CACHE);\n }\n },\n }),\n );\n\n if (assetStore) {\n const assets = await findStaticAssets(staticDir);\n await assetStore.storeAssets(assets);\n // Remove any assets that are older than 7 days\n await assetStore.trimAssets({ maxAgeSeconds: 60 * 60 * 24 * 7 });\n\n staticRouter.use(createStaticAssetMiddleware(assetStore));\n }\n\n if (staticFallbackHandler) {\n staticRouter.use(staticFallbackHandler);\n }\n staticRouter.use((_req: Request, res: Response) => {\n res.status(404).end();\n });\n\n router.use('/static', staticRouter);\n\n const rootRouter = Router();\n rootRouter.use((req, _res, next) => {\n // Make sure / and /index.html are handled by the HTML5 route below\n if (req.path === '/' || req.path === '/index.html') {\n next('router');\n } else {\n next();\n }\n });\n rootRouter.use(\n express.static(rootDir, {\n setHeaders: (res, path) => {\n // The Cache-Control header instructs the browser to not cache html files since it might\n // link to static assets from recently deployed versions.\n if (\n (express.static.mime as unknown as Mime).lookup(path) === 'text/html'\n ) {\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n }\n },\n }),\n );\n router.use(rootRouter);\n\n // HTML5 routing\n router.get('/*', (_req, res) => {\n if (injectResult?.indexHtmlContent) {\n res.setHeader('Content-Type', 'text/html; charset=utf-8');\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n res.send(injectResult.indexHtmlContent);\n } else {\n res.sendFile(resolvePath(rootDir, 'index.html'), {\n headers: {\n // The Cache-Control header instructs the browser to not cache the index.html since it might\n // link to static assets from recently deployed versions.\n 'cache-control': CACHE_CONTROL_NO_CACHE,\n },\n });\n }\n });\n\n return router;\n}\n"],"names":["resolvePackagePath","resolvePath","fs","Router","readFrontendConfig","StaticAssetsStore","helmet","express","AuthenticationError","InputError","injectConfig","CACHE_CONTROL_REVALIDATE_CACHE","CACHE_CONTROL_MAX_CACHE","findStaticAssets","createStaticAssetMiddleware","CACHE_CONTROL_NO_CACHE"],"mappings":";;;;;;;;;;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OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"router.cjs.js","sources":["../../src/service/router.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 {\n DatabaseService,\n resolvePackagePath,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport type { AppConfig } from '@backstage/config';\nimport helmet from 'helmet';\nimport express, { Request, Response } from 'express';\nimport Router from 'express-promise-router';\nimport fs from 'fs-extra';\nimport { resolve as resolvePath } from 'node:path';\nimport {\n createStaticAssetMiddleware,\n findStaticAssets,\n StaticAssetsStore,\n} from '../lib/assets';\nimport {\n CACHE_CONTROL_MAX_CACHE,\n CACHE_CONTROL_NO_CACHE,\n CACHE_CONTROL_REVALIDATE_CACHE,\n} from '../lib/headers';\nimport type { ConfigSchema } from '@backstage/config-loader';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { AuthenticationError, InputError } from '@backstage/errors';\nimport { injectConfig, readFrontendConfig } from '../lib/config';\n\n// express uses mime v1 while we only have types for mime v2\ntype Mime = { lookup(arg0: string): string };\n\n/**\n * @internal\n */\nexport interface RouterOptions {\n config: RootConfigService;\n logger: LoggerService;\n auth: AuthService;\n httpAuth: HttpAuthService;\n\n /**\n * If a database is provided it will be used to cache previously deployed static assets.\n *\n * This is a built-in alternative to using a `staticFallbackHandler`.\n */\n database: DatabaseService;\n\n /**\n * The name of the app package that content should be served from. The same app package should be\n * added as a dependency to the backend package in order for it to be accessible at runtime.\n *\n * In a typical setup with a single app package this would be set to 'app'.\n */\n appPackageName: string;\n\n /**\n * A request handler to handle requests for static content that are not present in the app bundle.\n *\n * This can be used to avoid issues with clients on older deployment versions trying to access lazy\n * loaded content that is no longer present. Typically the requests would fall back to a long-term\n * object store where all recently deployed versions of the app are present.\n *\n * Another option is to provide a `database` that will take care of storing the static assets instead.\n *\n * If both `database` and `staticFallbackHandler` are provided, the `database` will attempt to serve\n * static assets first, and if they are not found, the `staticFallbackHandler` will be called.\n */\n staticFallbackHandler?: express.Handler;\n\n /**\n *\n * Provides a ConfigSchema.\n *\n */\n schema?: ConfigSchema;\n}\n\n/**\n * @internal\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n appPackageName,\n staticFallbackHandler,\n auth,\n httpAuth,\n schema,\n } = options;\n\n const disableConfigInjection = config.getOptionalBoolean(\n 'app.disableConfigInjection',\n );\n const disableStaticFallbackCache = config.getOptionalBoolean(\n 'app.disableStaticFallbackCache',\n );\n\n const appDistDir = resolvePackagePath(appPackageName, 'dist');\n const staticDir = resolvePath(appDistDir, 'static');\n\n if (!(await fs.pathExists(staticDir))) {\n if (process.env.NODE_ENV === 'production') {\n logger.error(\n `Can't serve static app content from ${staticDir}, directory doesn't exist`,\n );\n }\n\n return Router();\n }\n\n logger.info(`Serving static app content from ${appDistDir}`);\n\n const appConfigs = disableConfigInjection\n ? undefined\n : await readFrontendConfig({\n config,\n appDistDir,\n env: process.env,\n schema,\n });\n\n const assetStore = !disableStaticFallbackCache\n ? await StaticAssetsStore.create({\n logger,\n database: options.database,\n })\n : undefined;\n\n const router = Router();\n\n router.use(helmet.frameguard({ action: 'deny' }));\n\n const publicDistDir = resolvePath(appDistDir, 'public');\n\n const disablePublicEntryPoint = config.getOptionalBoolean(\n 'app.disablePublicEntryPoint',\n );\n const enablePublicEntryPoint =\n !disablePublicEntryPoint && (await fs.pathExists(publicDistDir));\n\n if (enablePublicEntryPoint) {\n logger.info(\n `App is running in protected mode, serving public content from ${publicDistDir}`,\n );\n\n const publicRouter = Router();\n\n publicRouter.use(async (req, res, next) => {\n try {\n const credentials = await httpAuth.credentials(req, {\n allow: ['user', 'service', 'none'],\n allowLimitedAccess: true,\n });\n\n if (credentials.principal.type === 'none') {\n next();\n } else {\n next('router');\n }\n } catch {\n // If we fail to authenticate, make sure the session cookie is cleared\n // and continue as unauthenticated. If the user is logged in they will\n // immediately be redirected back to the protected app via the POST.\n await httpAuth.issueUserCookie(res, {\n credentials: await auth.getNoneCredentials(),\n });\n next();\n }\n });\n\n publicRouter.post(\n '*',\n express.urlencoded({ extended: true }),\n async (req, res, next) => {\n if (req.body.type === 'sign-in') {\n const credentials = await auth.authenticate(req.body.token);\n\n if (!auth.isPrincipal(credentials, 'user')) {\n throw new AuthenticationError('Invalid token, not a user');\n }\n\n await httpAuth.issueUserCookie(res, {\n credentials,\n });\n\n // Resume as if it was a GET request towards the outer protected router, serving index.html\n req.method = 'GET';\n next('router');\n } else {\n throw new InputError(\n 'Invalid POST request to app-backend wildcard endpoint',\n );\n }\n },\n );\n\n publicRouter.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'public' }),\n rootDir: publicDistDir,\n assetStore: assetStore?.withNamespace('public'),\n appConfigs, // TODO(Rugvip): We should not be including the full config here\n }),\n );\n\n router.use(publicRouter);\n }\n\n router.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'main' }),\n rootDir: appDistDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n }),\n );\n\n return router;\n}\n\nasync function createEntryPointRouter({\n logger,\n rootDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n}: {\n logger: LoggerService;\n rootDir: string;\n assetStore?: StaticAssetsStore;\n staticFallbackHandler?: express.Handler;\n appConfigs?: AppConfig[];\n}) {\n const staticDir = resolvePath(rootDir, 'static');\n\n const injectResult =\n appConfigs &&\n (await injectConfig({ appConfigs, logger, rootDir, staticDir }));\n\n const router = Router();\n\n // Use a separate router for static content so that a fallback can be provided by backend\n const staticRouter = Router();\n staticRouter.use(\n express.static(staticDir, {\n setHeaders: (res, path) => {\n if (injectResult?.injectedPath === path) {\n res.setHeader('Cache-Control', CACHE_CONTROL_REVALIDATE_CACHE);\n } else {\n res.setHeader('Cache-Control', CACHE_CONTROL_MAX_CACHE);\n }\n },\n }),\n );\n\n if (assetStore) {\n const assets = await findStaticAssets(staticDir);\n await assetStore.storeAssets(assets);\n // Remove any assets that are older than 7 days\n await assetStore.trimAssets({ maxAgeSeconds: 60 * 60 * 24 * 7 });\n\n staticRouter.use(createStaticAssetMiddleware(assetStore));\n }\n\n if (staticFallbackHandler) {\n staticRouter.use(staticFallbackHandler);\n }\n staticRouter.use((_req: Request, res: Response) => {\n res.status(404).end();\n });\n\n router.use('/static', staticRouter);\n\n const rootRouter = Router();\n rootRouter.use((req, _res, next) => {\n // Make sure / and /index.html are handled by the HTML5 route below\n if (req.path === '/' || req.path === '/index.html') {\n next('router');\n } else {\n next();\n }\n });\n rootRouter.use(\n express.static(rootDir, {\n setHeaders: (res, path) => {\n // The Cache-Control header instructs the browser to not cache html files since it might\n // link to static assets from recently deployed versions.\n if (\n (express.static.mime as unknown as Mime).lookup(path) === 'text/html'\n ) {\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n }\n },\n }),\n );\n router.use(rootRouter);\n\n // HTML5 routing\n router.get('/*', (_req, res) => {\n if (injectResult?.indexHtmlContent) {\n res.setHeader('Content-Type', 'text/html; charset=utf-8');\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n res.send(injectResult.indexHtmlContent);\n } else {\n res.sendFile(resolvePath(rootDir, 'index.html'), {\n headers: {\n // The Cache-Control header instructs the browser to not cache the index.html since it might\n // link to static assets from recently deployed versions.\n 'cache-control': CACHE_CONTROL_NO_CACHE,\n },\n });\n }\n });\n\n return router;\n}\n"],"names":["resolvePackagePath","resolvePath","fs","Router","readFrontendConfig","StaticAssetsStore","helmet","express","AuthenticationError","InputError","injectConfig","CACHE_CONTROL_REVALIDATE_CACHE","CACHE_CONTROL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AAS,YAAY,CAAA,EAAG;AAAA,QAC/C,OAAA,EAAS;AAAA;AAAA;AAAA,UAGP,eAAA,EAAiBc;AAAA;AACnB,OACD,CAAA;AAAA,IACH;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO,MAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-app-backend",
3
- "version": "0.5.14",
3
+ "version": "0.5.15-next.0",
4
4
  "description": "A Backstage backend plugin that serves the Backstage frontend app",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",
@@ -62,13 +62,13 @@
62
62
  "test": "backstage-cli package test"
63
63
  },
64
64
  "dependencies": {
65
- "@backstage/backend-plugin-api": "^1.9.1",
66
- "@backstage/config": "^1.3.8",
67
- "@backstage/config-loader": "^1.10.11",
68
- "@backstage/errors": "^1.3.1",
69
- "@backstage/plugin-app-node": "^0.1.45",
70
- "@backstage/plugin-auth-node": "^0.7.1",
71
- "@backstage/types": "^1.2.2",
65
+ "@backstage/backend-plugin-api": "1.9.2-next.0",
66
+ "@backstage/config": "1.3.8",
67
+ "@backstage/config-loader": "1.10.11",
68
+ "@backstage/errors": "1.3.1",
69
+ "@backstage/plugin-app-node": "0.1.46-next.0",
70
+ "@backstage/plugin-auth-node": "0.7.2-next.0",
71
+ "@backstage/types": "1.2.2",
72
72
  "express": "^4.22.0",
73
73
  "express-promise-router": "^4.1.0",
74
74
  "fs-extra": "^11.2.0",
@@ -79,10 +79,10 @@
79
79
  "luxon": "^3.0.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@backstage/backend-app-api": "^1.7.0",
83
- "@backstage/backend-defaults": "^0.17.1",
84
- "@backstage/backend-test-utils": "^1.11.3",
85
- "@backstage/cli": "^0.36.2",
82
+ "@backstage/backend-app-api": "1.7.1-next.0",
83
+ "@backstage/backend-defaults": "0.17.2-next.0",
84
+ "@backstage/backend-test-utils": "1.11.4-next.0",
85
+ "@backstage/cli": "0.36.3-next.0",
86
86
  "@types/express": "^4.17.6",
87
87
  "@types/supertest": "^2.0.8",
88
88
  "supertest": "^7.0.0"