- Semgrep Cloud Platform
- Team & Enterprise Tier
Integrating Semgrep Cloud Platform with self-hosted enterprise repositories
This guide provides steps and prerequisites to fully enable all features of Semgrep Cloud Platform for GitHub Enterprise Server and GitLab Self Managed plans.
This document covers the enablement of features for GitHub Enterprise Server plans. For users of GitHub Enterprise Cloud plans, see Getting started with Semgrep Cloud Platform.
You need the following permissions to integrate Semgrep into GHE Server or GLSM servers:
- Permission to create a personal access token (PAT) for the repository to scan with Semgrep. This PAT is used to enable Semgrep Cloud Platform to create pull request (PR) or merge request (MR) comments for findings. These comments provide a description of the issue detected by Semgrep and may offer possible solutions.
- Permission to add CI/CD secrets into your GitHub or GitLab environments.
Table of required scopes for PATs
Semgrep Cloud Platform requires PATs with assigned scopes. These scopes grant necessary permissions to the PAT and vary depending on the user's plan.
GitHub Enterprise Server | GitLab Self-Managed |
---|---|
| api |
Integrating Semgrep Cloud Platform with GitHub Enterprise or GitLab Self Managed
Integrate Semgrep into these custom source code management (SCM) tools by following the steps below:
- Sign in to Semgrep Cloud Platform.
- Click Settings > SCM.
Select your source code manager.
For GitHub Enterprise Server, follow these steps:
- Create a PAT by following the steps outlined in this guide to creating a PAT. Ensure that the PAT is created with the required scopes.
- Enter the personal access token generated into the Access token field.
- Enter your GHE Server base URL into the URL field.
- Ensure that your SCM integration successfully detects repositories by setting up a CI job for any repository you want to scan:
- Commit a
semgrep.yml
configuration file into the.github/workflows
folder. Refer to Sample CI configurations for a template you can copy and customize. - The CI job starts automatically to establish a connection with Semgrep Cloud Platform. Upon establishing a connection, your repository appears in Semgrep Cloud Platform > Projects page.
- Repeat all steps under step (iv) to add more repositories into Semgrep Cloud Platform.
- Commit a
For GitLab Self Managed, follow these steps:
- Create a PAT by following the steps outlined in this guide to creating a PAT. Ensure that the PAT is created with the required scopes.
- Enter the personal access token generated into the Access token field.
- Enter your GLSM base URL into the URL field.
- Ensure that your SCM integration successfully detects repositories by setting up a CI job for any repository you want to scan:
- Create or edit your
.gitlab-ci.yml
configuration file to add Semgrep as part of your GitLab CI/CD pipeline. Refer to Sample CI configurations for a template you can copy and customize. - Commit the updated
.gitlab-ci.yml
file. - The CI job starts automatically to establish a connection with Semgrep Cloud Platform. Alternatively, if it does not start automatically, start the job from the GitLab CI/CD interface. Upon establishing a connection, your repository appears in Semgrep Cloud Platform > Projects page.
- Repeat all steps under step (iv) to add more repositories into Semgrep Cloud Platform.
- Create or edit your
Receiving PR or MR comments in your VPN or on-premise SCM
PR or MR comments are comments or suggestions made by Semgrep Cloud Platform in your GitHub or GitLab repository. These comments provide a description of the issue detected by Semgrep and may offer possible solutions. These comments are a means for security teams (or any team responsible for creating standards) to help their fellow developers write safe and standards-compliant code.
To enable this feature within self-hosted SCMs behind firewalls or VPNs (Virtual Private Networks), follow these steps:
- Add the IP address
52.34.175.113
to your VPN's allowlist. This IP address is static and outbound. - Test that you are able to receive findings by manually triggering a scan through your CI provider.
Receiving PR or MR comments may require additional steps depending on the custom configuration of your VPN or SCM (for example, if you use a static IP without a hostname). Reach out to Semgrep support through the Semgrep Community Slack or send an email to support@semgrep.com for any concerns.
Additional references
Find what you needed in this doc? Join the Semgrep Community Slack group to ask the maintainers and the community if you need help.