CloudBoosterDocs

Connect a repository

Connect GitHub or GitLab to CloudBooster Guard, the permissions each connection asks for, and how to choose the repositories it reviews.

Connect a repository

CloudBooster Guard reviews every pull request (GitHub) or merge request (GitLab) on the repositories you watch. This page covers connecting your forge and choosing the repositories. The checks it posts, making them required, the repo config and the known limits are in Set up pull-request review.

Connect a cloud account first, under Cloud accounts in the Console (see Connect an AWS account). Without one, every review fails with no cloud account.

Who can connect

Any member can connect GitHub or GitLab. Only an org admin or owner can change what is watched or gated: watch or unwatch a repository, arm or disarm its gate, change which GitLab namespace a connection covers, or disconnect the forge. Members and viewers see these controls disabled, with a note that an admin must change them.

Connect GitHub

  1. In the Console, open Repositories and choose Connect GitHub.
  2. Install the CloudBooster Guard GitHub App on your organisation, and give it All repositories or select the ones to review. The App receives pull-request webhooks itself, so there is nothing to configure per repository.
  3. Back in the Console, watch the repositories you want reviewed, and arm the gate on the ones you want enforced.

The GitHub App asks for these repository permissions, and no others:

PermissionAccessWhat Guard uses it for
ChecksRead and writePosts the cbxguard/review check-run (and cbxguard/ci-plan for a plan your CI uploads) and updates it as the review runs.
ContentsRead-onlyReads the changed Terraform and the repo config at the pull request's head.
MetadataRead-onlyLists the repositories the install covers. GitHub grants it to every App.
Pull requestsRead and writeReads the pull request, and posts its one comment and the inline review comments.

It subscribes to the Pull request and Repository events. It requests no organisation or account permissions, and it never pushes code or changes your branches. It can write only checks and pull-request comments. What Guard can access on GitHub, and how to remove it is the page to show your security team. Because the App asks to authorise you as a user when you install it, Guard can confirm you have access to the installation you link.

Connect GitLab

GitLab has no app install, so Guard registers a project webhook on each project you watch. Each hook carries its own secret token, and Guard stores only a hash of it. Unwatching a project, or disconnecting GitLab, removes the hook again.

GitLab lets only Maintainers (and Owners) create webhooks. The account Guard connects with must therefore be a Maintainer on every project you watch, or on the group that holds them. When it is not, the repository shows Webhook: permission denied and reviews do not start on push.

Choose how to connect. Each choice shows who Guard will act as before you grant anything:

OptionActs asNotes
OAuth (Quick: acts as you)You: the GitLab user who clicked ContinueOne consent. Grants Guard the api scope as that user, and everything it posts shows your name. Guard can do only what you can, so you must be a Maintainer on the projects you watch. The connection refreshes its own token, but it ends if you leave the group or revoke the grant, and you then connect again. Guard does not create a service account with this choice.
Service account in this subgroupGuard's own account, cbx-guard-bot-<id>You sign in once, as an Owner of the top-level group, then pick a group or subgroup. Guard creates its service account in the top-level group (GitLab creates service accounts there only), makes it a Maintainer of the group you picked only, uses its token instead of yours and revokes your OAuth grant. If the account is still a member of a group from an earlier upgrade, Guard removes it from that group first; if GitLab refuses either change, nothing is upgraded and your connection keeps working. Needs GitLab Premium or Ultimate.
Bring a group or project access token (narrowest)The bot user GitLab creates for the tokenWorks on every GitLab tier. Create a group or project access token with the api scope and the Maintainer role, then paste it with the full path of its group or project. Guard checks that the token can read that path before it stores anything. A group path covers that group and its subgroups; a project path covers that one project. A personal access token also works; it then acts as its user. Disconnect removes the webhooks and revokes the token using the token itself; if that fails, revoke it in GitLab (Settings → Access tokens on the group or project).

After an OAuth connect, an org admin picks the namespace the connection covers. What Guard can access on GitLab, and how to remove it is the page to show your security team.

Make the connection independent of one person

A connection made with OAuth acts as you, so it stops working when you leave. To avoid that, a group Owner can choose Upgrade to a durable bot on the connected OAuth connection. Guard then creates a CloudBooster Guard service account in the top-level group, makes it a Maintainer of the group you pick only, and uses its token instead of yours. If you watch repositories outside the group you pick, Guard lists them before it creates anything: confirm to stop watching them, or pick a group that covers them. Service accounts are a GitLab Premium / Ultimate feature on gitlab.com. On GitLab Free, bring a group or project access token for the same result.

Everything else Guard needs works on GitLab Free: project webhooks, commit statuses, MR notes, Pipelines must succeed and All threads must be resolved. Guard uses project hooks rather than group hooks, because group webhooks need Premium.

Merge requests from forks

Guard never posts on a contributor's fork, and the fork's owner doesn't have to add Guard to it. A merge request from a fork is gated through your CI's plan upload instead: the cbx-guard job runs in a merge request pipeline in your project, from your own CI configuration, and its check shows on the merge request. Set it up as Contributions from forks says. Until that pipeline runs, Guard's note on the merge request says so, and the widget shows no Guard check.

Self-managed GitLab

Guard connects to your own GitLab instance with a bot token. The OAuth option is for gitlab.com only.

  1. In Integrations, on the GitHub & GitLab card, select Connect self-managed GitLab.
  2. Enter the instance's https:// URL (for example https://gitlab.example.com), a personal access token of your bot user with the api scope, and the full path of the group to review.
  3. Guard checks the token against the instance before it saves anything, and says why when it refuses.

The instance must be reachable from the public internet over HTTPS, and it must be able to reach the webhook URL the card shows, or reviews do not start on push. The full requirements are in Set up pull-request review.

Check it works

Open a small test change on a watched repository. Within a minute or two you should see cbxguard/review go running / in progress, then finish with Passed: no dangerous public exposure. Read the title (GitHub) or the description (GitLab), not only the colour: on GitLab a review that could not run is also success, described Not reviewed: …. Merge is not blocked., with a note on the merge request that says why. Set up pull-request review, section 6 lists every result. If nothing appears:

  • GitHub: check that the App installation includes the repository.
  • GitLab: the repository's webhook badge should read Active or Manual webhook, with a recent last delivery. Permission denied means Guard's account is not a Maintainer.
  • Both: the repository must be watched. The pull request's page in the Console shows the review's outcome, including why it failed.

On this page