# Adding GitLab Projects

## Step 1: Designating a Posting User

GitLab requires a user account to post inline feedback to merge requests. We have a global user ([@PullRequestBot](https://gitlab.com/PullRequestBot)) which can be used for this.&#x20;

You can also create your own HackerOne Code service user for interacting with GitLab merge requests.

{% hint style="info" %}
**NOTE**: If your organization uses SAML, you WILL NOT be able to use the [@PullRequestBot](https://gitlab.com/PullRequestBot) global user. A new user in your GitLab Group will need to be created.
{% endhint %}

### Create a Service User for HackerOne Code

First, create a new user that will have access to all Projects or Projects in scope of service.

HackerOne Code will use this user to post scan results and validated issues.

<mark style="background-color:yellow;">**\*\*\*We strongly recommend adding the following image as the posting user's avatar and**</mark> `Hackerone Code` <mark style="background-color:yellow;">**as part of the Username**</mark>. This provides a much better end-user experience; it allows the service to be easily identified in the GitLab interface:

{% file src="<https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FsqMDCBMJSelXq8SofwrB%2Fhackerone-posting-user-avatar.jpg?alt=media&token=4a6d33fe-47a1-4609-87d7-09476d6fbad3>" %}

<figure><img src="https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FpWyDDjXGQnimRJHFQvVW%2Fimage.png?alt=media&#x26;token=f4bc66b7-3614-4e03-a92c-075989f1f5a6" alt=""><figcaption><p>Creating a new GitLab user</p></figcaption></figure>

### Log in to GitLab as a user with permission to invite members

{% hint style="info" %}
**NOTE:** If your organization's GitLab instances contains Rpositories in Projects spanning multiple Groups, these steps will be required for each group.
{% endhint %}

Navigate to **Group Information** -> **Members** in the side bar.

Click **Invite Members**.

{% hint style="danger" %}
The user taking this action will need to have at least the [Maintainer role](https://docs.gitlab.com/user/permissions/#user-management) of a Group. If the "Invite members" option isn't visible, you may need to work with a team member with an Owner or Maintainer role within the Group to take this action
{% endhint %}

<figure><img src="https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FH6Y5acbNmb17hp4P7tuu%2Fimage.png?alt=media&#x26;token=cf4f8238-7de2-4c93-bbb4-366428a4bbc5" alt=""><figcaption></figcaption></figure>

In the **Username or email address** field, search for the newly created user and select the **Reporter** role.&#x20;

<figure><img src="https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FLSonFMQj0XQdN8hAaBR6%2Fimage.png?alt=media&#x26;token=b6aedbe3-602f-4f2e-86d2-25c2d225d7b7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The service user requires **Reporter** access and will need to be added to all of the Projects in scope of service. We recommend inviting the user to the root-level Group so there's no disruption in service if you add or move repositories in the future.
{% endhint %}

### Log into HackerOne Code with the new service user

Connect the newly created GitLab user account to HackerOne Code via our OAuth sign-up flow by clicking on [Sign Up with GitLab](https://app.pullrequest.com/signup).

<figure><img src="https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FIuOXCGRx3FOvxpMXceuU%2Fimage.png?alt=media&#x26;token=adf76229-c356-4f2a-b8af-78a4598f07d3" alt=""><figcaption></figcaption></figure>

Once the account is connected, please let your HackerOne team know and we can configure that account to be the one that your code review feedback is posted from.

## Step 2: Authorize GitLab Group Integration

{% hint style="info" %}
**The following steps must be completed by a GitLab user with an Owner role for the Groups and Projects that need to be integrated.**\
\
If you're still logged in as the new GitLab service user for HackerOne Code, be sure to log out and log back in to GitLab as your standard user for your organization.
{% endhint %}

After authenticating with GitLab, you'll be prompted to authorize and connect with a version control hosting provider. Click the **GitLab** option.

![](https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LOO4Gvsc67XA3eYkTBF%2F-MA87EhBjhWpgQsb6irb%2F-MA87RtcXtT1yl_nKEVg%2Fimage.png?alt=media\&token=61f305cc-030b-4d2c-9910-914740bda6be)

You'll then be asked to authorize your GitLab user account with HackerOne Code's GitLab application: **PullRequest**.

{% hint style="info" %}
**NOTE:** The application and entity name 'PullRequest' is expected. This is separate from [HackerOne's GitLab integration](https://docs.hackerone.com/en/articles/10394699-gitlab-setup) for disclosure and bounty programs. [Read more](https://techcrunch.com/2022/04/28/hackerone-buys-yc-backed-pullrequest-to-add-code-review-to-bug-squashing-platform/)
{% endhint %}

<figure><img src="https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2F2KxhemD3ln83GedxrPkA%2Fimage.png?alt=media&#x26;token=28733846-3d1e-4663-81ce-137e31344a9c" alt=""><figcaption></figcaption></figure>

## Step 3: Select GitLab Group <a href="#step-2" id="step-2"></a>

You'll be prompted with a list of GitLab Groups associated with your GitLab account.

Select the Group you'd like to connect with and click **Next**.

{% hint style="info" %}
**NOTE:** Multiple GitLab Groups can be connected. You can add more later if necessary.
{% endhint %}

![](https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FwkqEucbv8po8fzB6pwQF%2Fconnecting-gitlab-group-to-pullrequest-for-code-review.jpg?alt=media\&token=38442723-3260-4a47-83c0-b38967c6af65)

{% hint style="warning" %}
**Don't see the Group you need?**

\
GitLab account used to connect repositories with HackerOne Code must be an Owner.&#x20;

Reach out to a team member with these credentials and ask them to sign up for PullRequest and [connect](#step-1-authorize-and-connect). At that point, Project and Group details should be available to non-Owner members in the HackerOne Code dashboard.
{% endhint %}

## Step 4: Select GitLab Projects (Repositories)

Next, you'll be prompted to select which GitLab Projects (repositories) you'd like to connect to PullRequest.

You can select multiple Projects within the Group, or All Projects (recommended).

![](https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LOO4Gvsc67XA3eYkTBF%2Fuploads%2FE1JT7DA4QoCFH58FzCS8%2Fconnect-gitlab-repositories-to-pullrequest-for-code-review.jpg?alt=media\&token=3509689a-07b0-4bfb-9592-1598f1a0d136)

{% hint style="info" %}
**NOTE:** If practical, we recommend selecting **All Projects** as this will also automatically connect future repositories and include a more comprehensive overview of your development activity across all repositories in your GitLab Group in our metrics dashboards.

Connecting repositories to *will not* initiating HackerOne Code scans or incur any additional fees/overages. These will be configured later.
{% endhint %}

## Step 5: View Repositories

Repositories should now appear on the PullRequest [**dashboard**](https://app.pullrequest.com/dash/) page when the GitLab Group is selected from the Organizations drop-down menu at the top-left portion of the screen.

![](https://1035261813-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LOO4Gvsc67XA3eYkTBF%2F-MA89WDfZInJBt9O7Ua7%2F-MA89gao4KTXk5JkbAnL%2Fimage.png?alt=media\&token=a01e994c-2899-472b-953e-853ae6f84a46)

{% hint style="info" %}
**NOTE:** This guide contains screenshots from third-party partner interfaces that may be modified without notice. If you have any issues or questions about integration, please reach out to your HackerOne team.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pullrequest.com/customer-documentation/cloud-integrations/adding-gitlab-projects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
