How to configure Gitlab with DigitSec
Please follow these steps to set up S4 to scan your Gitlab repository based on Gitlab events.
- Start by retrieving a Gitlab Web Secret specific to your Workspace. Please use a browser to go to https://s4.digitsec.com and sign in.
- After logging in, find the Salesforce Workspace you wish to connect. Click on the title and then click on the Integration Tab; followed by the GitLab Sub-tab.
- The GitLab Secret will be obscured in the first input box. Please use the clipboard icon to copy the field contents. Please leave this browser window open on this page as you will return to it in Step 12.
- Open a new browser window and log into https://gitlab.com. Find the repository to integrate with S4 and click on it.
- On the left-hand navigation bar, hover over the Settings tab to expand the sub-menu, and click on Webhooks.
- You will create a new webook for this branch that is pointed at https://s4.digitsec.com/gitlab/webhooks/<gitlab Secret>. Remember this URL (including the GitLab secret) has been copied to your clipboard from step 3, so you can paste it in the URL field below. Your webhook URL should be similar to the diagram below.
- Below the URL field, you will see a list of Triggers. The currently supported trigger is the Merge request trigger as displayed in the picture below.
- Once the trigger is selected, please checkmark Enable SSL verification and click the "Add webhook" button at the bottom of the page.
- You must now create a Personal Access Token (PAT). Please click on your profile picture in the top right of Gitlab and select Preferences
- Next, please find the Access Tokens selection on the left bar
- Please generate an access token. Enter a Name and Expiration Date that meets your needs. To work with S4, the required Scopes are api, read_repository and write_repository. Please make sure to mark the checkboxes next to each of these. Click on the Create Personal Access Token button. The page should refresh and display the PAT near the top of the page. Please select and copy it to your clipboard. You will need it in the next step.
- Return to the browser window from Step 4. You want to add your Gitlab PAT to the GitLab Integrations Screen on the DigitSec Workspace. If you have closed the window, you can find it again by finding the Workspace, clicking on the title and then Integration-->GitLab tabs.
- Please enter your Username, Repo Name, GitLab PAT Name and your GitLab PAT. You should use the same Name that you entered in Step 11 and you can paste the PAT value from your clipboard. You can select the check box if you want S4 to create a pull request.
- To verify this is working, please take an action that will activate the trigger you selected (try changing the title of your PR for testing purpose). Once you have finished this, the scan will have already begun and DigitSec will post a scan started comment on your PR.
- Scans typically take between 5 and 15 minutes. Once the scan is completed, DigitSec will send a notification email once the scan has completed which will include a link to your DigitSec Findings Detail Report.
- The results from DigitSec will show up in the pull request comments as follows: