Removed broad Gitlab permission from ScmAuth

To write repositories the `api` permission is not needed anymore.

Signed-off-by: Severin Wischmann <severinwischmann@nianticlabs.com>
This commit is contained in:
Severin Wischmann
2024-09-03 11:27:19 +02:00
parent d202a258d1
commit 8a9d7972ee
3 changed files with 10 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/integration-react': patch
---
Remove unnecessary broad permissions from Gitlab SCMAuth
Newer versions of Gitlab (after 2019) do not require the broad api permissions to write to repos.
@@ -105,7 +105,7 @@ describe('ScmAuth', () => {
additionalScope: { repoWrite: true },
}),
).resolves.toMatchObject({
token: 'read_user read_api read_repository write_repository api',
token: 'read_user read_api read_repository write_repository',
});
const azureAuth = ScmAuth.forAzure(mockAuthApi);
@@ -162,7 +162,7 @@ export class ScmAuth implements ScmAuthApi {
*
* If the additional `repoWrite` permission is requested, these scopes are added:
*
* `write_repository api`
* `write_repository`
*/
static forGitlab(
gitlabAuthApi: OAuthApi,
@@ -173,7 +173,7 @@ export class ScmAuth implements ScmAuthApi {
const host = options?.host ?? 'gitlab.com';
return new ScmAuth('gitlab', gitlabAuthApi, host, {
default: ['read_user', 'read_api', 'read_repository'],
repoWrite: ['write_repository', 'api'],
repoWrite: ['write_repository'],
});
}