@backstage/plugin-events-backend-module-github 0.1.0 → 0.1.1-next.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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # @backstage/plugin-events-backend-module-github
2
2
 
3
+ ## 0.1.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0f46ec304c: Add `createGithubSignatureValidator(config)` which can be used
8
+ to create a validator used at an ingress for topic `github`.
9
+
10
+ On top, there is a new `githubWebhookEventsModule` for the new backend plugin API
11
+ which auto-registers the `HttpPostIngress` for topic `github` incl. the validator.
12
+
13
+ Please find more information at
14
+ https://github.com/backstage/backstage/tree/master/plugins/events-backend-module-github/README.md.
15
+
16
+ - Updated dependencies
17
+ - @backstage/backend-plugin-api@0.1.5-next.1
18
+ - @backstage/config@1.0.5-next.1
19
+ - @backstage/plugin-events-node@0.2.0-next.1
20
+
21
+ ## 0.1.1-next.0
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+ - @backstage/plugin-events-node@0.2.0-next.0
27
+ - @backstage/backend-plugin-api@0.1.5-next.0
28
+
3
29
  ## 0.1.0
4
30
 
5
31
  ### Minor Changes
package/README.md CHANGED
@@ -41,3 +41,34 @@ Add the event router to the `EventsBackend`:
41
41
  + .addSubscribers(githubEventRouter);
42
42
  // [...]
43
43
  ```
44
+
45
+ ### Signature Validator
46
+
47
+ Add the signature validator for the topic `github`:
48
+
49
+ ```diff
50
+ // at packages/backend/src/plugins/events.ts
51
+ + import { createGithubSignatureValidator } from '@backstage/plugin-events-backend-module-github';
52
+ // [...]
53
+ const http = HttpPostIngressEventPublisher.fromConfig({
54
+ config: env.config,
55
+ ingresses: {
56
+ + github: {
57
+ + validator: createGithubSignatureValidator(env.config),
58
+ + },
59
+ },
60
+ logger: env.logger,
61
+ });
62
+ ```
63
+
64
+ Additionally, you need to add the configuration:
65
+
66
+ ```yaml
67
+ events:
68
+ modules:
69
+ github:
70
+ webhookSecret: your-secret-token
71
+ ```
72
+
73
+ Configuration at GitHub:
74
+ https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-events-backend-module-github",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-next.1",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
package/config.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright 2022 The Backstage Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export interface Config {
18
+ events?: {
19
+ modules?: {
20
+ /**
21
+ * events-backend-module-github plugin configuration.
22
+ */
23
+ github?: {
24
+ /**
25
+ * Secret token for webhook requests used to verify signatures.
26
+ *
27
+ * See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks
28
+ * for more details.
29
+ *
30
+ * @visibility secret
31
+ */
32
+ webhookSecret?: string;
33
+ };
34
+ };
35
+ };
36
+ }
@@ -1,14 +1,29 @@
1
1
  /**
2
2
  * The module `github` for the Backstage backend plugin "events-backend"
3
- * adding an event router for GitHub.
3
+ * adding an event router and signature validator for GitHub.
4
4
  *
5
5
  * @packageDocumentation
6
6
  */
7
7
 
8
8
  import { BackendFeature } from '@backstage/backend-plugin-api';
9
+ import { Config } from '@backstage/config';
9
10
  import { EventParams } from '@backstage/plugin-events-node';
11
+ import { RequestValidator } from '@backstage/plugin-events-node';
10
12
  import { SubTopicEventRouter } from '@backstage/plugin-events-node';
11
13
 
14
+ /**
15
+ * Validates that the request received is the expected GitHub request
16
+ * using the signature received with the `x-hub-signature-256` header
17
+ * which is based on a secret token configured at GitHub and here.
18
+ *
19
+ * See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks
20
+ * for more details.
21
+ *
22
+ * @param config - root config
23
+ * @public
24
+ */
25
+ export declare function createGithubSignatureValidator(config: Config): RequestValidator;
26
+
12
27
  /**
13
28
  * Subscribes to the generic `github` topic
14
29
  * and publishes the events under the more concrete sub-topic
@@ -30,4 +45,13 @@ export declare class GithubEventRouter extends SubTopicEventRouter {
30
45
  */
31
46
  export declare const githubEventRouterEventsModule: (options?: undefined) => BackendFeature;
32
47
 
48
+ /**
49
+ * Module for the events-backend plugin,
50
+ * registering an HTTP POST ingress with request validator
51
+ * which verifies the webhook signature based on a secret.
52
+ *
53
+ * @alpha
54
+ */
55
+ export declare const githubWebhookEventsModule: (options?: undefined) => BackendFeature;
56
+
33
57
  export { }
@@ -1,14 +1,29 @@
1
1
  /**
2
2
  * The module `github` for the Backstage backend plugin "events-backend"
3
- * adding an event router for GitHub.
3
+ * adding an event router and signature validator for GitHub.
4
4
  *
5
5
  * @packageDocumentation
6
6
  */
7
7
 
8
8
  import { BackendFeature } from '@backstage/backend-plugin-api';
9
+ import { Config } from '@backstage/config';
9
10
  import { EventParams } from '@backstage/plugin-events-node';
11
+ import { RequestValidator } from '@backstage/plugin-events-node';
10
12
  import { SubTopicEventRouter } from '@backstage/plugin-events-node';
11
13
 
14
+ /**
15
+ * Validates that the request received is the expected GitHub request
16
+ * using the signature received with the `x-hub-signature-256` header
17
+ * which is based on a secret token configured at GitHub and here.
18
+ *
19
+ * See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks
20
+ * for more details.
21
+ *
22
+ * @param config - root config
23
+ * @public
24
+ */
25
+ export declare function createGithubSignatureValidator(config: Config): RequestValidator;
26
+
12
27
  /**
13
28
  * Subscribes to the generic `github` topic
14
29
  * and publishes the events under the more concrete sub-topic
@@ -23,4 +38,6 @@ export declare class GithubEventRouter extends SubTopicEventRouter {
23
38
 
24
39
  /* Excluded from this release type: githubEventRouterEventsModule */
25
40
 
41
+ /* Excluded from this release type: githubWebhookEventsModule */
42
+
26
43
  export { }
package/dist/index.cjs.js CHANGED
@@ -2,9 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var webhooksMethods = require('@octokit/webhooks-methods');
5
6
  var pluginEventsNode = require('@backstage/plugin-events-node');
6
7
  var backendPluginApi = require('@backstage/backend-plugin-api');
7
8
 
9
+ function createGithubSignatureValidator(config) {
10
+ const secret = config.getString("events.modules.github.webhookSecret");
11
+ return async (request, context) => {
12
+ const signature = request.headers["x-hub-signature-256"];
13
+ if (!signature || !await webhooksMethods.verify(secret, JSON.stringify(request.body), signature)) {
14
+ context.reject({
15
+ status: 403,
16
+ payload: { message: "invalid signature" }
17
+ });
18
+ }
19
+ };
20
+ }
21
+
8
22
  class GithubEventRouter extends pluginEventsNode.SubTopicEventRouter {
9
23
  constructor() {
10
24
  super("github");
@@ -32,6 +46,27 @@ const githubEventRouterEventsModule = backendPluginApi.createBackendModule({
32
46
  }
33
47
  });
34
48
 
49
+ const githubWebhookEventsModule = backendPluginApi.createBackendModule({
50
+ pluginId: "events",
51
+ moduleId: "githubWebhook",
52
+ register(env) {
53
+ env.registerInit({
54
+ deps: {
55
+ config: backendPluginApi.configServiceRef,
56
+ events: pluginEventsNode.eventsExtensionPoint
57
+ },
58
+ async init({ config, events }) {
59
+ events.addHttpPostIngress({
60
+ topic: "github",
61
+ validator: createGithubSignatureValidator(config)
62
+ });
63
+ }
64
+ });
65
+ }
66
+ });
67
+
35
68
  exports.GithubEventRouter = GithubEventRouter;
69
+ exports.createGithubSignatureValidator = createGithubSignatureValidator;
36
70
  exports.githubEventRouterEventsModule = githubEventRouterEventsModule;
71
+ exports.githubWebhookEventsModule = githubWebhookEventsModule;
37
72
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/router/GithubEventRouter.ts","../src/service/GithubEventRouterEventsModule.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 EventParams,\n SubTopicEventRouter,\n} from '@backstage/plugin-events-node';\n\n/**\n * Subscribes to the generic `github` topic\n * and publishes the events under the more concrete sub-topic\n * depending on the `x-github-event` provided.\n *\n * @public\n */\nexport class GithubEventRouter extends SubTopicEventRouter {\n constructor() {\n super('github');\n }\n\n protected determineSubTopic(params: EventParams): string | undefined {\n return params.metadata?.['x-github-event'] as string | undefined;\n }\n}\n","/*\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 { createBackendModule } from '@backstage/backend-plugin-api';\nimport { eventsExtensionPoint } from '@backstage/plugin-events-node';\nimport { GithubEventRouter } from '../router/GithubEventRouter';\n\n/**\n * Module for the events-backend plugin, adding an event router for GitHub.\n *\n * Registers the {@link GithubEventRouter}.\n *\n * @alpha\n */\nexport const githubEventRouterEventsModule = createBackendModule({\n pluginId: 'events',\n moduleId: 'githubEventRouter',\n register(env) {\n env.registerInit({\n deps: {\n events: eventsExtensionPoint,\n },\n async init({ events }) {\n const eventRouter = new GithubEventRouter();\n\n events.addPublishers(eventRouter);\n events.addSubscribers(eventRouter);\n },\n });\n },\n});\n"],"names":["SubTopicEventRouter","createBackendModule","eventsExtensionPoint"],"mappings":";;;;;;;AA4BO,MAAM,0BAA0BA,oCAAoB,CAAA;AAAA,EACzD,WAAc,GAAA;AACZ,IAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAAA,GAChB;AAAA,EAEU,kBAAkB,MAAyC,EAAA;AAjCvE,IAAA,IAAA,EAAA,CAAA;AAkCI,IAAO,OAAA,CAAA,EAAA,GAAA,MAAA,CAAO,aAAP,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,gBAAA,CAAA,CAAA;AAAA,GAC3B;AACF;;ACTO,MAAM,gCAAgCC,oCAAoB,CAAA;AAAA,EAC/D,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,mBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAQ,EAAAC,qCAAA;AAAA,OACV;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAU,EAAA;AACrB,QAAM,MAAA,WAAA,GAAc,IAAI,iBAAkB,EAAA,CAAA;AAE1C,QAAA,MAAA,CAAO,cAAc,WAAW,CAAA,CAAA;AAChC,QAAA,MAAA,CAAO,eAAe,WAAW,CAAA,CAAA;AAAA,OACnC;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/http/createGithubSignatureValidator.ts","../src/router/GithubEventRouter.ts","../src/service/GithubEventRouterEventsModule.ts","../src/service/GithubWebhookEventsModule.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 {\n RequestDetails,\n RequestValidationContext,\n RequestValidator,\n} from '@backstage/plugin-events-node';\nimport { verify } from '@octokit/webhooks-methods';\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): RequestValidator {\n const secret = config.getString('events.modules.github.webhookSecret');\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 (\n !signature ||\n !(await verify(secret, JSON.stringify(request.body), signature))\n ) {\n context.reject({\n status: 403,\n payload: { message: 'invalid signature' },\n });\n }\n };\n}\n","/*\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 EventParams,\n SubTopicEventRouter,\n} from '@backstage/plugin-events-node';\n\n/**\n * Subscribes to the generic `github` topic\n * and publishes the events under the more concrete sub-topic\n * depending on the `x-github-event` provided.\n *\n * @public\n */\nexport class GithubEventRouter extends SubTopicEventRouter {\n constructor() {\n super('github');\n }\n\n protected determineSubTopic(params: EventParams): string | undefined {\n return params.metadata?.['x-github-event'] as string | undefined;\n }\n}\n","/*\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 { createBackendModule } from '@backstage/backend-plugin-api';\nimport { eventsExtensionPoint } from '@backstage/plugin-events-node';\nimport { GithubEventRouter } from '../router/GithubEventRouter';\n\n/**\n * Module for the events-backend plugin, adding an event router for GitHub.\n *\n * Registers the {@link GithubEventRouter}.\n *\n * @alpha\n */\nexport const githubEventRouterEventsModule = createBackendModule({\n pluginId: 'events',\n moduleId: 'githubEventRouter',\n register(env) {\n env.registerInit({\n deps: {\n events: eventsExtensionPoint,\n },\n async init({ events }) {\n const eventRouter = new GithubEventRouter();\n\n events.addPublishers(eventRouter);\n events.addSubscribers(eventRouter);\n },\n });\n },\n});\n","/*\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 configServiceRef,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { eventsExtensionPoint } from '@backstage/plugin-events-node';\nimport { createGithubSignatureValidator } from '../http/createGithubSignatureValidator';\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 * @alpha\n */\nexport const githubWebhookEventsModule = createBackendModule({\n pluginId: 'events',\n moduleId: 'githubWebhook',\n register(env) {\n env.registerInit({\n deps: {\n config: configServiceRef,\n events: eventsExtensionPoint,\n },\n async init({ config, events }) {\n events.addHttpPostIngress({\n topic: 'github',\n validator: createGithubSignatureValidator(config),\n });\n },\n });\n },\n});\n"],"names":["verify","SubTopicEventRouter","createBackendModule","eventsExtensionPoint","configServiceRef"],"mappings":";;;;;;;;AAmCO,SAAS,+BACd,MACkB,EAAA;AAClB,EAAM,MAAA,MAAA,GAAS,MAAO,CAAA,SAAA,CAAU,qCAAqC,CAAA,CAAA;AAErE,EAAO,OAAA,OACL,SACA,OACkB,KAAA;AAClB,IAAM,MAAA,SAAA,GAAY,QAAQ,OAAQ,CAAA,qBAAA,CAAA,CAAA;AAIlC,IAAA,IACE,CAAC,SAAA,IACD,CAAE,MAAMA,sBAAO,CAAA,MAAA,EAAQ,IAAK,CAAA,SAAA,CAAU,OAAQ,CAAA,IAAI,CAAG,EAAA,SAAS,CAC9D,EAAA;AACA,MAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,QACb,MAAQ,EAAA,GAAA;AAAA,QACR,OAAA,EAAS,EAAE,OAAA,EAAS,mBAAoB,EAAA;AAAA,OACzC,CAAA,CAAA;AAAA,KACH;AAAA,GACF,CAAA;AACF;;AC9BO,MAAM,0BAA0BC,oCAAoB,CAAA;AAAA,EACzD,WAAc,GAAA;AACZ,IAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAAA,GAChB;AAAA,EAEU,kBAAkB,MAAyC,EAAA;AAjCvE,IAAA,IAAA,EAAA,CAAA;AAkCI,IAAO,OAAA,CAAA,EAAA,GAAA,MAAA,CAAO,aAAP,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,gBAAA,CAAA,CAAA;AAAA,GAC3B;AACF;;ACTO,MAAM,gCAAgCC,oCAAoB,CAAA;AAAA,EAC/D,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,mBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAQ,EAAAC,qCAAA;AAAA,OACV;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAU,EAAA;AACrB,QAAM,MAAA,WAAA,GAAc,IAAI,iBAAkB,EAAA,CAAA;AAE1C,QAAA,MAAA,CAAO,cAAc,WAAW,CAAA,CAAA;AAChC,QAAA,MAAA,CAAO,eAAe,WAAW,CAAA,CAAA;AAAA,OACnC;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;ACbM,MAAM,4BAA4BD,oCAAoB,CAAA;AAAA,EAC3D,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,eAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAQ,EAAAE,iCAAA;AAAA,QACR,MAAQ,EAAAD,qCAAA;AAAA,OACV;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAQ,QAAU,EAAA;AAC7B,QAAA,MAAA,CAAO,kBAAmB,CAAA;AAAA,UACxB,KAAO,EAAA,QAAA;AAAA,UACP,SAAA,EAAW,+BAA+B,MAAM,CAAA;AAAA,SACjD,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,29 @@
1
1
  /**
2
2
  * The module `github` for the Backstage backend plugin "events-backend"
3
- * adding an event router for GitHub.
3
+ * adding an event router and signature validator for GitHub.
4
4
  *
5
5
  * @packageDocumentation
6
6
  */
7
7
 
8
8
  import { BackendFeature } from '@backstage/backend-plugin-api';
9
+ import { Config } from '@backstage/config';
9
10
  import { EventParams } from '@backstage/plugin-events-node';
11
+ import { RequestValidator } from '@backstage/plugin-events-node';
10
12
  import { SubTopicEventRouter } from '@backstage/plugin-events-node';
11
13
 
14
+ /**
15
+ * Validates that the request received is the expected GitHub request
16
+ * using the signature received with the `x-hub-signature-256` header
17
+ * which is based on a secret token configured at GitHub and here.
18
+ *
19
+ * See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks
20
+ * for more details.
21
+ *
22
+ * @param config - root config
23
+ * @public
24
+ */
25
+ export declare function createGithubSignatureValidator(config: Config): RequestValidator;
26
+
12
27
  /**
13
28
  * Subscribes to the generic `github` topic
14
29
  * and publishes the events under the more concrete sub-topic
@@ -23,4 +38,6 @@ export declare class GithubEventRouter extends SubTopicEventRouter {
23
38
 
24
39
  /* Excluded from this release type: githubEventRouterEventsModule */
25
40
 
41
+ /* Excluded from this release type: githubWebhookEventsModule */
42
+
26
43
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-events-backend-module-github",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-next.1",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -23,18 +23,22 @@
23
23
  "postpack": "backstage-cli package postpack"
24
24
  },
25
25
  "dependencies": {
26
- "@backstage/backend-plugin-api": "^0.1.4",
27
- "@backstage/plugin-events-node": "^0.1.0",
26
+ "@backstage/backend-plugin-api": "^0.1.5-next.1",
27
+ "@backstage/config": "^1.0.5-next.1",
28
+ "@backstage/plugin-events-node": "^0.2.0-next.1",
29
+ "@octokit/webhooks-methods": "^3.0.0",
28
30
  "winston": "^3.2.1"
29
31
  },
30
32
  "devDependencies": {
31
- "@backstage/backend-test-utils": "^0.1.30",
32
- "@backstage/cli": "^0.21.0",
33
- "@backstage/plugin-events-backend-test-utils": "^0.1.0",
33
+ "@backstage/backend-test-utils": "^0.1.31-next.1",
34
+ "@backstage/cli": "^0.21.2-next.1",
35
+ "@backstage/plugin-events-backend-test-utils": "^0.1.1-next.1",
34
36
  "supertest": "^6.1.3"
35
37
  },
36
38
  "files": [
37
39
  "alpha",
40
+ "config.d.ts",
38
41
  "dist"
39
- ]
42
+ ],
43
+ "configSchema": "config.d.ts"
40
44
  }