doc/user/project/integrations/git_guardian.md
{{< details >}}
{{< /details >}}
{{< history >}}
git_guardian_integration. Enabled by default. Disabled on GitLab.com.git_guardian_integration removed.api_url parameter introduced in GitLab 19.1.{{< /history >}}
GitGuardian is a secrets detection service that finds hardcoded credentials such as API keys, passwords, and tokens in source code repositories. When you enable this integration, GitLab sends each push to GitGuardian for scanning. If GitGuardian detects a secret, GitLab blocks the push.
You can configure GitLab to reject commits based on GitGuardian policies.
To set up the GitGuardian integration:
Prerequisites:
To create an API token:
GitLab integration token.Now you have successfully created a GitGuardian API token that you can use to for our integration.
Prerequisites:
After you have created and copied your API token, configure GitLab to reject commits:
To enable the integration for your project:
In the top bar, select Search or go to and find your project or group.
In the left sidebar, select Settings > Integrations.
Select GitGuardian.
In Enable integration, select the Active checkbox.
Optional. In the API endpoint text box, enter the base URL of your GitGuardian instance:
https://api.eu1.gitguardian.com.https://gitguardian.example.com).If you leave this blank, GitLab uses the default US SaaS endpoint ( https://api.gitguardian.com).
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.
{{< history >}}
{{< /history >}}
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:
[skip secret push protection] to one of the commit messages.secret_push_protection.skip_all push option.Troubleshooting steps below show how to mitigate some of these problems.
When working with the GitGuardian integration, you might encounter the following issues.
500 HTTP errorsYou 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:
Filename: ensure this value has at most 256 charactersYou 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.