git-secret
Git without secrets
Prerequisites
Python 3 is required. Python 2 is not supported.
Second, Python 3's bin directory needs to be in your PATH environment variable. For example, if you are using the
python.org install on macOS, you will need to add the following to your ~/.profile.
PATH="/Library/Frameworks/Python.framework/Versions/3.*/bin:${PATH}"
Installation
git-secrets is located on PyPI.
To install, run the following.
$ pip3 install qpp-git-secrets
sudo may be needed if your Python 3 installation is in a protected directory. This will put the command the bin
directory of your Python 3 installation.
To update git-secrets to the latest version, run the following.
$ pip3 install --upgrade qpp-git-secrets
Again, sudo may be required.
Usage
Currently, git-secrets only checks the added lines of staged files. AKA, only the added lines that are about to be
committed will be checked.
Installing the Pre-commit Hook
Run the following when the PWD is in the repository you want to add a pre-commit hook...
$ git secrets install
If there exists a pre-commit.d directory, this will add a bash script into that directory. If that directory doesn't
exist, the pre-commit bash script will be created directly. If the pre-commit script already exists, git-secrets
will exit with an error since it chooses to not remove the previous pre-commit script.
Manually scanning
If you want to manually scan a repository, you can run the following while your PWD is in the repository...
$ git secrets scan
Secrets are then scanned.
Specifying Secrets
There are two locations that git-secrets checks for secret specifications. The secrets from the two locations are
merged together.
- A
.gitsecretsfile in the top level directory of the repository. ~/.gitsecrets.
Each line in these files should contain a regular expression. The regular expression syntax is based off what the
Python 3 re module supports.
Example Secrets
TINs that don't start with 000 or 999 or don't have 00 for the middle number group.
(\D|^)(?!000)(?!999)\d{3}\s(?!00)\d{2}\s\d{4}(\D|$)
(\D|^)(?!000)(?!999)\d{3}-(?!00)\d{2}-\d{4}(\D|$)
(\D|^)(?!000)(?!999)\d{3}(?!00)\d{2}\d{4}(\D|$)
Development
I accept PRs! Check out the issues.
Metadata
Release files for qpp-git-secrets 1.1.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 |
|---|---|---|---|---|
| qpp-git-secrets-1.1.1.tar.gz | 5.2 kB | Without provenance | Details for qpp-git-secrets-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qpp_git_secrets-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for qpp_git_secrets-1.1.1-py3-none-any.whl |
Total release size: 25.6 kB
Release files / qpp-git-secrets-1.1.1.tar.gz
| Download URL | qpp-git-secrets-1.1.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da3c7648977e7f38f69394f3934bdf6a717ead60261b21a993c53a2269dc6219
|
|
BLAKE2b-256 checksum How to use checksums |
a7532a3302269cf5eacbad1ed61afec9701ba9afa46d8df3fd355ee26c92bc7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Release files / qpp_git_secrets-1.1.1-py3-none-any.whl
| Download URL | qpp_git_secrets-1.1.1-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5952bd4194cf41d8a048475a4ae89da405349857c4c273ff8e13de1f677b1e34
|
|
BLAKE2b-256 checksum How to use checksums |
c8972256c9d38b727d7efbcc168535e63a005ad7dca9413dd3be8243b7d7024e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for qpp-git-secrets 1.1.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.