ggshield: protect your code with GitGuardian
ggshield is a CLI application that runs in your local environment or in a CI environment to help you detect more than 400+ types of secrets, as well as other potential security vulnerabilities or policy breaks affecting your codebase.
ggshield uses our public API through py-gitguardian to scan and detect potential vulnerabilities in files and other text content.
Only metadata such as call time, request size and scan mode is stored from scans using ggshield, therefore secrets and policy breaks incidents will not be displayed on your dashboard and your files and secrets won't be stored.
Table of Contents
- Installation
- Initial setup
- Getting started
- Integrations
- Learn more
- Output
- Related open source projects
- License
Installation
Requirements
ggshield works on macOS, Linux and Windows.
It requires Python 3.8 and newer (except for standalone packages) and git.
Some commands require additional programs:
- docker: to scan docker images.
- pip: to scan pypi packages.
macOS
Homebrew
You can install ggshield using Homebrew:
$ brew install gitguardian/tap/ggshield
Upgrading is handled by Homebrew.
Standalone .pkg package
Alternatively, you can download and install a standalone .pkg package from ggshield release page.
This package does not require installing Python, but you have to manually download new versions.
Linux
Deb and RPM packages
Deb and RPM packages are available on Cloudsmith.
Setup instructions:
Upgrading is handled by the package manager.
Windows
Standalone .zip archive
We provide a standalone .zip archive on ggshield release page.
Unpack the archive on your disk, then add the directory containing the ggshield.exe file to %PATH%.
This archive does not require installing Python, but you have to manually download new versions.
All operating systems
ggshield can be installed on all supported operating systems via its PyPI package.
Using pipx
The recommended way to install ggshield from PyPI is to use pipx, which will install it in an isolated environment:
$ pipx install ggshield
To upgrade your installation, run:
$ pipx upgrade ggshield
Using pip
You can also install ggshield from PyPI using pip, but this is not recommended because the installation is not isolated, so other applications or packages installed this way may affect your ggshield installation. This method will also not work if your Python installation is declared as externally managed (for example when using the system Python on operating systems like Debian 12):
$ pip install --user ggshield
To upgrade your installation, run:
$ pip install --user --upgrade ggshield
Initial setup
Using ggshield auth login
To use ggshield you need to authenticate against GitGuardian servers. To do so, use the ggshield auth login command. This command automates the provisioning of a personal access token and its configuration on the local workstation.
You can learn more about it from ggshield auth login documentation.
Manual setup
You can also create your personal access token manually and store it in the GITGUARDIAN_API_KEY environment variable to complete the setup.
Getting started
Secrets
You can now use ggshield to search for secrets:
- in files:
ggshield secret scan path -r . - in repositories:
ggshield secret scan repo . - in Docker images:
ggshield secret scan docker ubuntu:22.04 - in Pypi packages:
ggshield secret scan pypi flask - and more, have a look at
ggshield secret scan --helpoutput for details.
Infra as Code Security (IaC)
You can also search for vulnerabilities in your IaC files using the following command:
ggshield iac scan all .
However, if you are only interested in new potential IaC vulnerabilities, you can run:
ggshield iac scan diff --ref=HEAD~1 .
Have a look at ggshield iac scan --help for more details.
Integrations
You can integrate ggshield in your CI/CD workflow.
To catch errors earlier, use ggshield as a pre-commit, pre-push or pre-receive Git hook.
Learn more
For more information, have a look at the documentation
Output
If no secrets or policy breaks have been found, the exit code will be 0:
$ ggshield secret scan pre-commit
If a secret or other issue is found in your staged code or in your CI, you will have an alert giving you the type of policy break, the filename where the policy break has been found and a patch giving you the position of the policy break in the file:
$ ggshield secret scan pre-commit
🛡️ ⚔️ 🛡️ 2 policy breaks have been found in file production.rb
11 | config.paperclip_defaults = {
12 | :s3_credentials => {
13 | :bucket => "XXX",
14 | :access_key_id => "XXXXXXXXXXXXXXXXXXXX",
|_____AWS Keys_____|
15 | :secret_access_key => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|_______________AWS Keys_______________|
16 | }
17 | }
Lines that are too long are truncated to match the size of the terminal, unless the verbose mode is used (-v or --verbose).
Related open source projects
License
ggshield is MIT licensed.
Metadata
Release files for ggshield 1.30.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ggshield-1.30.1.tar.gz | 149.8 kB | Without provenance | Details for ggshield-1.30.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ggshield-1.30.1-py3-none-any.whl | Python 3 | none | any | Details for ggshield-1.30.1-py3-none-any.whl |
Total release size: 371.5 kB
Release files / ggshield-1.30.1.tar.gz
| Download URL | ggshield-1.30.1.tar.gz |
|---|---|
| Size | 149.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c9523c5c0cb0a42faf24ea6a4fdacdef3bcfb7a34d4d7234b8b70b979be641b
|
|
BLAKE2b-256 checksum How to use checksums |
8ed503c543a6bf4c00ecf99826ed273ef7355b9e43b5113a1f54b4f6f96dfd2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / ggshield-1.30.1-py3-none-any.whl
| Download URL | ggshield-1.30.1-py3-none-any.whl |
|---|---|
| Size | 221.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
196ebd66579cc576db6577392abe506f13f38a5bde8f9c60926c91e26e442895
|
|
BLAKE2b-256 checksum How to use checksums |
15d85d86c5925d4c33aca9501141f6d07d6b4ac8d664f7924c9ba0d453a3d3d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for ggshield 1.30.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.