@backstage/plugin-events-backend-module-github 0.4.18-next.2 → 0.5.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,19 @@
1
1
  # @backstage/plugin-events-backend-module-github
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 70fd46d: **BREAKING** Webhook events modules now require a webhook secret by default. Requests to the `/api/events/http/github`, `/api/events/http/gitlab`, and `/api/events/http/azureDevOps` endpoints are rejected with HTTP 403 when no webhook secret is configured, instead of being accepted without validation. To continue accepting unauthenticated events, for example in development environments, set the module's new `dangerouslyAllowUnauthenticatedEvents` option to `true`. In addition, the `createGitlabTokenValidator` function from `@backstage/plugin-events-backend-module-gitlab` now requires a `logger` argument.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/integration@2.2.0
13
+ - @backstage/backend-plugin-api@1.12.0
14
+ - @backstage/plugin-events-node@0.5.0
15
+ - @backstage/config@1.3.11
16
+
3
17
  ## 0.4.18-next.2
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -64,6 +64,12 @@ Add the signature validator for the topic `github`:
64
64
 
65
65
  ## Configuration
66
66
 
67
+ Webhook authentication is secure by default. Requests to the module's endpoint `/api/events/http/github` without a configured webhook secret return an HTTP 403 Forbidden status. A secret is configured either as a single shared secret via `events.modules.github.webhookSecret`, or per GitHub App via the `webhookSecret` of an entry in `integrations.github[].apps`.
68
+
69
+ This only covers the module's own endpoint. Routes created solely through `events.http.topics` have no validator attached and still accept unauthenticated requests.
70
+
71
+ Add the following to your `app-config.yaml`:
72
+
67
73
  ```yaml
68
74
  events:
69
75
  modules:
@@ -71,5 +77,18 @@ events:
71
77
  webhookSecret: your-secret-token
72
78
  ```
73
79
 
74
- Configuration at GitHub:
75
- https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks
80
+ For more details on securing webhooks on GitHub, see the [GitHub documentation](https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks).
81
+
82
+ ### Development and testing
83
+
84
+ For development or testing environments where a webhook secret cannot be configured, you can set `dangerouslyAllowUnauthenticatedEvents: true` as an explicit escape hatch under the module configuration:
85
+
86
+ ```yaml
87
+ events:
88
+ modules:
89
+ github:
90
+ dangerouslyAllowUnauthenticatedEvents: true
91
+ ```
92
+
93
+ > [!WARNING]
94
+ > Only use `dangerouslyAllowUnauthenticatedEvents: true` for development or testing. Never enable this option in production environments.
@@ -13,8 +13,12 @@
13
13
  "properties": {
14
14
  "webhookSecret": {
15
15
  "type": "string",
16
- "description": "Secret token for webhook requests used to verify signatures.\n\nSee https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks for more details.\n\nWebhook listener will only be enabled if this is set.",
16
+ "description": "Secret token for webhook requests used to verify signatures.\n\nSee https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks for more details.",
17
17
  "visibility": "secret"
18
+ },
19
+ "dangerouslyAllowUnauthenticatedEvents": {
20
+ "type": "boolean",
21
+ "description": "Dangerously allow unauthenticated events. Only set to true for development or testing."
18
22
  }
19
23
  },
20
24
  "description": "events-backend-module-github plugin configuration."
@@ -4,7 +4,7 @@ var integration = require('@backstage/integration');
4
4
  var webhooksMethods = require('@octokit/webhooks-methods');
5
5
  var createAppIdResolver = require('../util/createAppIdResolver.cjs.js');
6
6
 
7
- function createGithubSignatureValidator(config, octokitProvider) {
7
+ function createGithubSignatureValidator(config, octokitProvider, logger) {
8
8
  const integrations = integration.ScmIntegrations.fromConfig(config);
9
9
  const githubAppSecrets = /* @__PURE__ */ new Map();
10
10
  for (const integration of integrations.github.list()) {
@@ -17,8 +17,26 @@ function createGithubSignatureValidator(config, octokitProvider) {
17
17
  const genericSecret = config.getOptionalString(
18
18
  "events.modules.github.webhookSecret"
19
19
  );
20
+ const dangerouslyAllowUnauthenticatedEvents = config.getOptionalBoolean(
21
+ "events.modules.github.dangerouslyAllowUnauthenticatedEvents"
22
+ ) ?? false;
20
23
  if (!genericSecret && githubAppSecrets.size === 0) {
21
- return void 0;
24
+ if (dangerouslyAllowUnauthenticatedEvents) {
25
+ logger.warn(
26
+ "dangerouslyAllowUnauthenticatedEvents is enabled for the GitHub events module; incoming webhook events will be accepted without authentication"
27
+ );
28
+ return async () => {
29
+ };
30
+ }
31
+ logger.warn(
32
+ "No webhook secret is configured for the GitHub events module; incoming webhook events will be rejected with 403. Set 'events.modules.github.webhookSecret' to enable authentication, or set 'events.modules.github.dangerouslyAllowUnauthenticatedEvents' to true to accept unauthenticated events"
33
+ );
34
+ return async (_request, context) => {
35
+ context.reject({
36
+ status: 403,
37
+ payload: { message: "webhook secret not configured" }
38
+ });
39
+ };
22
40
  }
23
41
  const appIdResolver = createAppIdResolver.createAppIdResolver(octokitProvider);
24
42
  return async (request, context) => {
@@ -1 +1 @@
1
- {"version":3,"file":"createGithubSignatureValidator.cjs.js","sources":["../../src/http/createGithubSignatureValidator.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { Config } from '@backstage/config';\nimport { ScmIntegrations } from '@backstage/integration';\nimport {\n RequestDetails,\n RequestValidationContext,\n RequestValidator,\n} from '@backstage/plugin-events-node';\nimport { verify } from '@octokit/webhooks-methods';\nimport { createAppIdResolver } from '../util/createAppIdResolver';\nimport { OctokitProviderService } from '../util/octokitProviderService';\n\n/**\n * Validates that the request received is the expected GitHub request\n * using the signature received with the `x-hub-signature-256` header\n * which is based on a secret token configured at GitHub and here.\n *\n * See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks\n * for more details.\n *\n * @param config - root config\n * @public\n */\nexport function createGithubSignatureValidator(\n config: Config,\n octokitProvider: OctokitProviderService,\n): RequestValidator | undefined {\n const integrations = ScmIntegrations.fromConfig(config);\n\n // GitHub App installation ID to secret\n const githubAppSecrets = new Map<number, string>();\n for (const integration of integrations.github.list()) {\n for (const { appId, webhookSecret } of integration.config.apps ?? []) {\n if (appId && webhookSecret) {\n githubAppSecrets.set(appId, webhookSecret);\n }\n }\n }\n\n // A single optional secret for all GitHub events\n const genericSecret = config.getOptionalString(\n 'events.modules.github.webhookSecret',\n );\n\n if (!genericSecret && githubAppSecrets.size === 0) {\n return undefined;\n }\n\n const appIdResolver = createAppIdResolver(octokitProvider);\n\n return async (\n request: RequestDetails,\n context: RequestValidationContext,\n ): Promise<void> => {\n const signature = request.headers['x-hub-signature-256'] as\n | string\n | undefined;\n\n if (signature) {\n const body = request.raw.body.toString(request.raw.encoding);\n\n if (githubAppSecrets.size) {\n const appId = await appIdResolver(request);\n if (appId && githubAppSecrets.has(appId)) {\n if (await verify(githubAppSecrets.get(appId)!, body, signature)) {\n return;\n }\n }\n }\n\n if (genericSecret) {\n if (await verify(genericSecret, body, signature)) {\n return;\n }\n }\n }\n\n context.reject({\n status: 403,\n payload: { message: 'invalid signature' },\n });\n };\n}\n"],"names":["ScmIntegrations","createAppIdResolver","verify"],"mappings":";;;;;;AAsCO,SAAS,8BAAA,CACd,QACA,eAAA,EAC8B;AAC9B,EAAA,MAAM,YAAA,GAAeA,2BAAA,CAAgB,UAAA,CAAW,MAAM,CAAA;AAGtD,EAAA,MAAM,gBAAA,uBAAuB,GAAA,EAAoB;AACjD,EAAA,KAAA,MAAW,WAAA,IAAe,YAAA,CAAa,MAAA,CAAO,IAAA,EAAK,EAAG;AACpD,IAAA,KAAA,MAAW,EAAE,OAAO,aAAA,EAAc,IAAK,YAAY,MAAA,CAAO,IAAA,IAAQ,EAAC,EAAG;AACpE,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;AACF;;"}
1
+ {"version":3,"file":"createGithubSignatureValidator.cjs.js","sources":["../../src/http/createGithubSignatureValidator.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { LoggerService } from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { ScmIntegrations } from '@backstage/integration';\nimport {\n RequestDetails,\n RequestValidationContext,\n RequestValidator,\n} from '@backstage/plugin-events-node';\nimport { verify } from '@octokit/webhooks-methods';\nimport { createAppIdResolver } from '../util/createAppIdResolver';\nimport { OctokitProviderService } from '../util/octokitProviderService';\n\n/**\n * Validates that the request received is the expected GitHub request\n * using the signature received with the `x-hub-signature-256` header\n * which is based on a secret token configured at GitHub and here.\n *\n * See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks\n * for more details.\n *\n * @param config - root config\n * @param logger - logger used to report the module's authentication setup at startup\n * @public\n */\nexport function createGithubSignatureValidator(\n config: Config,\n octokitProvider: OctokitProviderService,\n logger: LoggerService,\n): RequestValidator {\n const integrations = ScmIntegrations.fromConfig(config);\n\n // GitHub App installation ID to secret\n const githubAppSecrets = new Map<number, string>();\n for (const integration of integrations.github.list()) {\n for (const { appId, webhookSecret } of integration.config.apps ?? []) {\n if (appId && webhookSecret) {\n githubAppSecrets.set(appId, webhookSecret);\n }\n }\n }\n\n // A single optional secret for all GitHub events\n const genericSecret = config.getOptionalString(\n 'events.modules.github.webhookSecret',\n );\n\n const dangerouslyAllowUnauthenticatedEvents =\n config.getOptionalBoolean(\n 'events.modules.github.dangerouslyAllowUnauthenticatedEvents',\n ) ?? false;\n\n if (!genericSecret && githubAppSecrets.size === 0) {\n if (dangerouslyAllowUnauthenticatedEvents) {\n logger.warn(\n 'dangerouslyAllowUnauthenticatedEvents is enabled for the GitHub events module; incoming webhook events will be accepted without authentication',\n );\n return async () => {};\n }\n\n logger.warn(\n \"No webhook secret is configured for the GitHub events module; incoming webhook events will be rejected with 403. Set 'events.modules.github.webhookSecret' to enable authentication, or set 'events.modules.github.dangerouslyAllowUnauthenticatedEvents' to true to accept unauthenticated events\",\n );\n return async (\n _request: RequestDetails,\n context: RequestValidationContext,\n ): Promise<void> => {\n context.reject({\n status: 403,\n payload: { message: 'webhook secret not configured' },\n });\n };\n }\n\n const appIdResolver = createAppIdResolver(octokitProvider);\n\n return async (\n request: RequestDetails,\n context: RequestValidationContext,\n ): Promise<void> => {\n const signature = request.headers['x-hub-signature-256'] as\n | string\n | undefined;\n\n if (signature) {\n const body = request.raw.body.toString(request.raw.encoding);\n\n if (githubAppSecrets.size) {\n const appId = await appIdResolver(request);\n if (appId && githubAppSecrets.has(appId)) {\n if (await verify(githubAppSecrets.get(appId)!, body, signature)) {\n return;\n }\n }\n }\n\n if (genericSecret) {\n if (await verify(genericSecret, body, signature)) {\n return;\n }\n }\n }\n\n context.reject({\n status: 403,\n payload: { message: 'invalid signature' },\n });\n };\n}\n"],"names":["ScmIntegrations","createAppIdResolver","verify"],"mappings":";;;;;;AAwCO,SAAS,8BAAA,CACd,MAAA,EACA,eAAA,EACA,MAAA,EACkB;AAClB,EAAA,MAAM,YAAA,GAAeA,2BAAA,CAAgB,UAAA,CAAW,MAAM,CAAA;AAGtD,EAAA,MAAM,gBAAA,uBAAuB,GAAA,EAAoB;AACjD,EAAA,KAAA,MAAW,WAAA,IAAe,YAAA,CAAa,MAAA,CAAO,IAAA,EAAK,EAAG;AACpD,IAAA,KAAA,MAAW,EAAE,OAAO,aAAA,EAAc,IAAK,YAAY,MAAA,CAAO,IAAA,IAAQ,EAAC,EAAG;AACpE,MAAA,IAAI,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A,CAAiB,GAAA,CAAI,KAAK,CAAA,EAAI,IAAA,EAAM,SAAS,CAAA,EAAG;AAC/D,YAAA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,MAAA,IAAI,aAAA,EAAe;AACjB,QAAA,IAAI,MAAMA,sBAAA,CAAO,aAAA,EAAe,IAAA,EAAM,SAAS,CAAA,EAAG;AAChD,UAAA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,IAAA,OAAA,CAAQ,MAAA,CAAO;AAAA,MACb,MAAA,EAAQ,GAAA;AAAA,MACR,OAAA,EAAS,EAAE,OAAA,EAAS,mBAAA;AAAoB,KACzC,CAAA;AAAA,EACH,CAAA;AACF;;"}
@@ -15,19 +15,19 @@ var eventsModuleGithubWebhook = backendPluginApi.createBackendModule({
15
15
  deps: {
16
16
  config: backendPluginApi.coreServices.rootConfig,
17
17
  events: alpha.eventsExtensionPoint,
18
- octokitProvider: octokitProviderService.octokitProviderServiceRef
18
+ octokitProvider: octokitProviderService.octokitProviderServiceRef,
19
+ logger: backendPluginApi.coreServices.logger
19
20
  },
20
- async init({ config, events, octokitProvider }) {
21
+ async init({ config, events, octokitProvider, logger }) {
21
22
  const validator = createGithubSignatureValidator.createGithubSignatureValidator(
22
23
  config,
23
- octokitProvider
24
+ octokitProvider,
25
+ logger
24
26
  );
25
- if (validator) {
26
- events.addHttpPostIngress({
27
- topic: "github",
28
- validator
29
- });
30
- }
27
+ events.addHttpPostIngress({
28
+ topic: "github",
29
+ validator
30
+ });
31
31
  }
32
32
  });
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"eventsModuleGithubWebhook.cjs.js","sources":["../../src/service/eventsModuleGithubWebhook.ts"],"sourcesContent":["/*\n * Copyright 2022 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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha';\nimport { createGithubSignatureValidator } from '../http/createGithubSignatureValidator';\nimport { octokitProviderServiceRef } from '../util/octokitProviderService';\n\n/**\n * Module for the events-backend plugin,\n * registering an HTTP POST ingress with request validator\n * which verifies the webhook signature based on a secret.\n *\n * @public\n */\nexport default createBackendModule({\n pluginId: 'events',\n moduleId: 'github-webhook',\n register(env) {\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n events: eventsExtensionPoint,\n octokitProvider: octokitProviderServiceRef,\n },\n async init({ config, events, octokitProvider }) {\n const validator = createGithubSignatureValidator(\n config,\n octokitProvider,\n );\n if (validator) {\n events.addHttpPostIngress({\n topic: 'github',\n validator,\n });\n }\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","eventsExtensionPoint","octokitProviderServiceRef","createGithubSignatureValidator"],"mappings":";;;;;;;;;AA+BA,gCAAeA,oCAAA,CAAoB;AAAA,EACjC,QAAA,EAAU,QAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;AAAA,QACJ,QAAQC,6BAAA,CAAa,UAAA;AAAA,QACrB,MAAA,EAAQC,0BAAA;AAAA,QACR,eAAA,EAAiBC;AAAA,OACnB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAQ,MAAA,EAAQ,iBAAgB,EAAG;AAC9C,QAAA,MAAM,SAAA,GAAYC,6DAAA;AAAA,UAChB,MAAA;AAAA,UACA;AAAA,SACF;AACA,QAAA,IAAI,SAAA,EAAW;AACb,UAAA,MAAA,CAAO,kBAAA,CAAmB;AAAA,YACxB,KAAA,EAAO,QAAA;AAAA,YACP;AAAA,WACD,CAAA;AAAA,QACH;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC,CAAA;;"}
1
+ {"version":3,"file":"eventsModuleGithubWebhook.cjs.js","sources":["../../src/service/eventsModuleGithubWebhook.ts"],"sourcesContent":["/*\n * Copyright 2022 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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha';\nimport { createGithubSignatureValidator } from '../http/createGithubSignatureValidator';\nimport { octokitProviderServiceRef } from '../util/octokitProviderService';\n\n/**\n * Module for the events-backend plugin,\n * registering an HTTP POST ingress with request validator\n * which verifies the webhook signature based on a secret.\n *\n * @public\n */\nexport default createBackendModule({\n pluginId: 'events',\n moduleId: 'github-webhook',\n register(env) {\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n events: eventsExtensionPoint,\n octokitProvider: octokitProviderServiceRef,\n logger: coreServices.logger,\n },\n async init({ config, events, octokitProvider, logger }) {\n const validator = createGithubSignatureValidator(\n config,\n octokitProvider,\n logger,\n );\n events.addHttpPostIngress({\n topic: 'github',\n validator,\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","eventsExtensionPoint","octokitProviderServiceRef","createGithubSignatureValidator"],"mappings":";;;;;;;;;AA+BA,gCAAeA,oCAAA,CAAoB;AAAA,EACjC,QAAA,EAAU,QAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;AAAA,QACJ,QAAQC,6BAAA,CAAa,UAAA;AAAA,QACrB,MAAA,EAAQC,0BAAA;AAAA,QACR,eAAA,EAAiBC,gDAAA;AAAA,QACjB,QAAQF,6BAAA,CAAa;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,QAAQ,MAAA,EAAQ,eAAA,EAAiB,QAAO,EAAG;AACtD,QAAA,MAAM,SAAA,GAAYG,6DAAA;AAAA,UAChB,MAAA;AAAA,UACA,eAAA;AAAA,UACA;AAAA,SACF;AACA,QAAA,MAAA,CAAO,kBAAA,CAAmB;AAAA,UACxB,KAAA,EAAO,QAAA;AAAA,UACP;AAAA,SACD,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC,CAAA;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-events-backend-module-github",
3
- "version": "0.4.18-next.2",
3
+ "version": "0.5.0",
4
4
  "backstage": {
5
5
  "role": "backend-plugin-module",
6
6
  "pluginId": "events",
@@ -51,20 +51,20 @@
51
51
  "test": "backstage-cli package test"
52
52
  },
53
53
  "dependencies": {
54
- "@backstage/backend-plugin-api": "1.12.0-next.1",
55
- "@backstage/config": "1.3.11-next.0",
56
- "@backstage/integration": "2.1.4-next.0",
57
- "@backstage/plugin-events-node": "0.5.0-next.2",
58
- "@backstage/types": "1.2.2",
54
+ "@backstage/backend-plugin-api": "^1.12.0",
55
+ "@backstage/config": "^1.3.11",
56
+ "@backstage/integration": "^2.2.0",
57
+ "@backstage/plugin-events-node": "^0.5.0",
58
+ "@backstage/types": "^1.2.2",
59
59
  "@octokit/auth-callback": "^5.0.0",
60
60
  "@octokit/webhooks-methods": "^3.0.0",
61
61
  "lodash": "^4.17.21",
62
62
  "octokit": "^3.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@backstage/backend-test-utils": "1.12.0-next.2",
66
- "@backstage/cli": "0.36.8-next.2",
67
- "@backstage/plugin-events-backend-test-utils": "0.1.61-next.1"
65
+ "@backstage/backend-test-utils": "^1.12.0",
66
+ "@backstage/cli": "^0.36.8",
67
+ "@backstage/plugin-events-backend-test-utils": "^0.1.61"
68
68
  },
69
69
  "configSchema": "config.schema.json"
70
70
  }