diff --git a/.changeset/chatty-pens-try.md b/.changeset/chatty-pens-try.md index e8b50bf8f2..1c92bb82cb 100644 --- a/.changeset/chatty-pens-try.md +++ b/.changeset/chatty-pens-try.md @@ -2,5 +2,5 @@ '@backstage/integration': patch --- -Return an empty token rather than fail where the owner is not in the allowed installation owners +Do not return a token rather than fail where the owner is not in the allowed installation owners for a GitHub app. This allows anonymous access to public files in the organisation. diff --git a/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts index b3fd26cddf..bfc360cbe2 100644 --- a/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts +++ b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts @@ -92,11 +92,11 @@ class GithubAppManager { async getInstallationCredentials( owner: string, repo?: string, - ): Promise<{ accessToken: string }> { + ): Promise<{ accessToken: string | undefined }> { const { installationId, suspended } = await this.getInstallationData(owner); if (this.allowedInstallationOwners) { if (!this.allowedInstallationOwners?.includes(owner)) { - return { accessToken: '' }; // An empty token allows anonymous access to public repos + return { accessToken: undefined }; // An empty token allows anonymous access to public repos } } if (suspended) {