GitGuardian
- Tier: Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
GitGuardian is a cybersecurity service that detects sensitive data such as API keys and passwords in source code repositories. It scans Git repositories, alerts on policy violations, and helps organizations fix security issues before hackers can exploit them.
You can configure GitLab to reject commits based on GitGuardian policies.
To set up the GitGuardian integration:
Create a GitGuardian API token
Prerequisites:
- You must have a GitGuardian account.
To create an API token:
- Sign in to your GitGuardian account.
- Go to the API section in the sidebar.
- In the API section sidebar go to Personal access tokens page.
- Select Create token. The token creation dialog opens.
- Provide your token information:
- Give your API token a meaningful name to identify its purpose.
For example,
GitLab integration token
. - Select an appropriate expiration.
- Select the scan scope checkbox. It is the only one needed for the integration.
- Give your API token a meaningful name to identify its purpose.
For example,
- Select Create token.
- After you’ve generated a token, copy it to your clipboard. This token is sensitive information, so keep it secure.
Now you have successfully created a GitGuardian API token that you can use to for our integration.
Set up the GitGuardian integration for your project
Prerequisites:
- You must have at least the Maintainer role for the project.
After you have created and copied your API token, configure GitLab to reject commits:
To enable the integration for your project:
- On the left sidebar, select Search or go to and find your project or group.
- Select Settings > Integrations.
- Select GitGuardian.
- In Enable integration, select the Active checkbox.
- In API token, paste the token value from GitGuardian.
- Optional. Select Test settings.
- Select Save changes.
GitLab is now ready to reject commits based on GitGuardian policies.
Skip secret detection
You can skip GitGuardian secret detection, if needed. The options to skip secret detection for all commits in a push are identical to the options for Native Secret Detection. Either:
- Add
[skip secret push protection]
to one of the commit messages. - Use the
secret_push_protection.skip_all
push option.
Known issues
- Pushes can be delayed or can time out. With the GitGuardian integration:
- Pushes are sent to a third-party.
- GitLab has no control over the connection with GitGuardian or the GitGuardian process.
- Due to a GitGuardian API limitation, the integration ignores files over the size of 1 MB. They are not scanned.
- If a pushed file has a name over 256 characters, the push fails.
- For more information, see GitGuardian API documentation.
Troubleshooting steps below show how to mitigate some of these problems.
Troubleshooting
When working with the GitGuardian integration, you might encounter the following issues.
500
HTTP errors
You might get an HTTP 500
error.
This issue occurs for when requests time out for commits with a lot of changed files.
If this issue happens when you change more than 50 files in a commit:
- Split your changes into smaller commits.
- Push the smaller commits one by one.
Error: Filename: ensure this value has at most 256 characters
You might get an HTTP 400
error that states Filename: ensure this value has at most 256 characters
.
This issue occurs when some of the changed files you are pushing in that commit have the filename (not the path) longer then 256 characters.
The workaround is to shorten the filename if possible. For example, if the filename cannot be shortened because it was automatically generated by a framework, disable the integration and try to push again. Don’t forget to re-enable the integration afterwards if needed.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support