GitLab Integration
Connect Harness Run-time Protection Agent with GitLab repositories using OAuth 2.0 to scan code for API security testing
The GitLab integration connects Harness Run-time Protection Agent (RPA) with your GitLab repositories, enabling Harness RPA to scan and analyze your repository code for API security testing. It uses OAuth 2.0 to establish a secure connection between Harness RPA and GitLab.
What you will learn from this topic
By the end of this topic, you will be able to understand:
The purpose of GitLab integration and what it enables in your API security workflow.
The steps to create an OAuth application in your GitLab instance.
The steps to configure the GitLab integration in Harness RPA.
How to authorize and verify the integration connection.
How to use the GitLab integration to scan your repositories.
Before you begin
Before you proceed to configure GitLab, make a note of the following:
Make sure you have the Settings RBAC permissions under Administration → Integrations to configure the integration. For more information, go to Team and roles - RBAC.
Make sure you can create a new OAuth application in GitLab. For more information, go to GitLab Documentation.
Configure the GitLab integration
You configure the GitLab integration by completing the following steps in GitLab and then in Harness RPA:
Step 1: Create an OAuth application in GitLab
To create an OAuth application in GitLab to generate the credentials for Harness RPA. To access your repositories, complete the following steps in your GitLab Service account:
Log in to your GitLab account and navigate to Admin Area → Applications.
Click New application.
Specify the application details:
Redirect URL: Specify the redirect URL fetched from the Harness platform
https://api-dev.traceable.ai/integration/gitlab/callback.Scopes: Select the
read_api,read_repository, andopenidscopes from the list.
Click Save application.
When you click save, GitLab displays your Application ID and Secret.
Step 2: Add the GitLab integration in Harness
To add the GitLab integration in Harness RPA, specify your OAuth credentials and complete the following steps on the Harness platform:

Log in to your Harness RPA account and navigate to Settings → Integrations → CI/CD Integrations.
Click Configure and complete the following fields in the opened slide-out panel Add New GitLab Integration:
GitLab URL: Specify
https://gitlab.comfor SaaS, or your self-managed GitLab instance URL.Application ID: Paste the Application ID from your GitLab OAuth application.
Secret: Paste the Secret retrieved from your GitLab OAuth application
Step 3: Authorize the integration in GitLab
You authorize Harness to access your GitLab repositories by completing the OAuth flow.
In the New GitLab slide-out panel, click Connect to GitLab.
Review the permissions requested. Harness RPA requests read access to repositories and the API.
Click Authorize to grant Harness RPA access to your repositories.
GitLab redirects you back to the Harness RPA platform and displays the integration confirmation.
Click Configure to complete the integration setup.
Demo
The following demo walks you through the steps in Harness RPA as well as the GitLab account to integrate GitLab:
Verify your GitLab integration
After you complete the integration setup, verify that Harness RPA successfully connects to your GitLab instance. To verify, complete the following steps:
In your Harness RPA account, navigate to Settings → Integrations → Repositories.
Locate your GitLab integration in the list.
Confirm that the integration status displays Connected or Active.
If the integration status shows an error, verify the following:
Your Application ID and Secret are correct and match the values displayed in GitLab.
The redirect URI in GitLab matches
https://api-dev.traceable.ai/integration/gitlab/callbackexactly.Your GitLab OAuth application scopes include
read_api,read_repository, andopenid.
Use your GitLab integration
After your GitLab integration is active, you reference it when creating API security scans or configuring repository-based workflows. For more information, go to API Discovery from Code.
When you create a scan or configure a workflow that requires repository access:
Select the repository source option or integration configuration field.
Choose your GitLab integration from the list of available integrations.
Select the repository and branch you want to scan.
Last updated
Was this helpful?