GitLab
GitLab Integration
Pensar Console supports integration with both GitLab.com and self-hosted GitLab instances. The integration uses a Personal Access Token to provide secure access to your repositories.
Prerequisites
Before connecting GitLab, you’ll need:
- A GitLab account with access to the repositories you want to scan
- A Personal Access Token with the required scopes
Creating a Personal Access Token
To create a Personal Access Token in GitLab:
- Log in to your GitLab instance (gitlab.com or your self-hosted instance)
- Click on your avatar in the top right corner and select Preferences
- Navigate to Access Tokens in the left sidebar
- Click Add new token
- Fill in the token details:
- Token name:
Pensar(or your preferred name) - Expiration date: Choose an appropriate date (or leave blank for no expiration)
- Token name:
- Select the following scopes:
- ✅
api- Full API access - ✅
read_api- Read-only API access - ✅
read_user- Read user information - ✅
read_repository- Read repository contents
- ✅
- Click Create personal access token
- Copy the token immediately - you won’t be able to see it again
Store your Personal Access Token securely. If you lose it, you’ll need to create a new one.
Connecting GitLab
From Workspace Settings
- Navigate to Settings → Integrations in your Pensar Console workspace
- Expand the GitLab section
- Click Connect GitLab
- If using a self-hosted GitLab instance, enter your GitLab host (e.g.,
gitlab.yourcompany.com)- Leave this blank if you’re using gitlab.com
- Enter your Personal Access Token
- Click Connect GitLab
From Onboarding
When creating a new workspace, you can connect GitLab during the onboarding process by clicking Connect your Gitlab account and following the same steps.
The GitLab host should not include https:// - just enter the hostname (e.g., gitlab.yourcompany.com).
Permissions
The Personal Access Token requires the following scopes:
Adding Repositories
After connecting GitLab:
- Go to Projects → New Project in Pensar Console
- Your GitLab projects will appear in the repository list
- Select a project and configure your settings
- Click Create Project to start scanning
Self-Hosted GitLab
Pensar supports self-hosted GitLab instances. When connecting:
- Enter your GitLab instance hostname (e.g.,
gitlab.yourcompany.com) - Ensure your GitLab instance is accessible from the internet
- Use an access token from your self-hosted instance
If your GitLab instance is behind a firewall or VPN, contact Pensar support to discuss connectivity options.
Managing the Integration
Viewing Connection Status
- Navigate to Settings → Integrations
- Expand the GitLab section
- If connected, you’ll see a confirmation and the option to disconnect
Updating the Token
To update your Personal Access Token (e.g., if it’s expiring):
- Create a new Personal Access Token in GitLab with the same scopes
- Navigate to Settings → Integrations in Pensar Console
- Disconnect the current GitLab connection
- Reconnect with the new token
Disconnecting GitLab
To remove the GitLab integration:
- Navigate to Settings → Integrations
- Expand the GitLab section
- Click Disconnect GitLab
Disconnecting GitLab will prevent Pensar from scanning GitLab repositories. Any projects using GitLab repositories will no longer be able to perform scans.
Troubleshooting
Invalid Token
If you see an error about an invalid token:
- Verify the token hasn’t expired
- Ensure the token has all required scopes
- Check that you copied the entire token without extra spaces
Repositories Not Appearing
If your repositories don’t appear in the project creation list:
- Verify you have at least Developer access to the repositories in GitLab
- Check that the token has the
read_repositoryscope - For self-hosted instances, ensure the hostname is correct
Connection Errors
For self-hosted GitLab instances:
- Verify the hostname is correct and accessible
- Ensure HTTPS is properly configured on your GitLab instance
- Check that there are no firewall rules blocking the connection
Need Help?
If you encounter issues setting up your GitLab integration, please contact our support team at team@pensarai.com.