From 17a4968d408b44f857a1eedb0fe2c9b444e3b91b Mon Sep 17 00:00:00 2001 From: Alex Crome Date: Mon, 5 Sep 2022 21:56:28 +0100 Subject: [PATCH] Avoid loading github installation if owner is not in allowedInstallationOwners Signed-off-by: Alex Crome --- .../src/github/SingleInstanceGithubCredentialsProvider.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts index 2fd2e7f7dc..8b87d985a5 100644 --- a/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts +++ b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts @@ -93,12 +93,13 @@ class GithubAppManager { owner: string, repo?: string, ): Promise<{ accessToken: string | undefined }> { - const { installationId, suspended } = await this.getInstallationData(owner); if (this.allowedInstallationOwners) { if (!this.allowedInstallationOwners?.includes(owner)) { return { accessToken: undefined }; // An empty token allows anonymous access to public repos } } + + const { installationId, suspended } = await this.getInstallationData(owner); if (suspended) { throw new Error(`The GitHub application for ${owner} is suspended`); }