Skip to content

[bbs] check webhooks permission in scm itself #18575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2023
Merged

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented Aug 22, 2023

Description

Summary generated by Copilot

🤖 Generated by Copilot at 79351cf

Remove webhook permission check for Bitbucket Server prebuilds. This fixes a bug that blocks users from enabling prebuilds on some repositories they have access to. The change affects the file bitbucket-server-service.ts.

Related Issue(s)

Fixes https://linear.app/gitpod/issue/EXP-487

How to test

Admin Not-Admin
image image

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@mustard-mh
Copy link
Contributor Author

Admin Not-Admin
image image


protected hasPermissionToCreateWebhooks(permission: string | undefined) {
return permission && ["REPO_ADMIN", "PROJECT_ADMIN"].indexOf(permission) !== -1;
// return true once it can get webhooks, fallback to let SCM itself to check permission
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where fallback happens?

It seems the code before that we have create permissions, not only read. Is it because it is not so fine grained in bbs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosyakov We will add webhooks when creating the project. So BBS will go check it as test result shows #18575 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallback because our permission checking for webhook add is not align to what BBS does

  • Admin of BBS has all permission
  • Admin can create webhook for all repo/project
  • Admin don't have project_admin and repo_admin permission in its open APIs if they don't configure it manually in BBS projects/repos

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved to unblock, but I did not test.

@roboquat roboquat merged commit f2cb656 into main Aug 22, 2023
@roboquat roboquat deleted the hw/bbs-ratelimit branch August 22, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants