A Python-based wrapper for Gitleaks that provides an easy way to scan directories for sensitive information leaks. This tool supports running scans locally or within a Docker container and provides structured outputs for easy integration with other tools.
git clone https://github.com/an1604/GitLeaksController.git
cd GitLeaksController
docker build -t gitleaks-controller:latest .
docker run --rm -v "<LOCAL_DIRECTORY_TO_SCAN>:/code/<CHOOSE_DIRECTORY_NAME>" gitleaks-controller:latest --dir /code/<CHOOSE_DIRECTORY_NAME> - Replace
<LOCAL_DIRECTORY_TO_SCAN>with the absolute path of the local directory to scan. - Replace
<CHOOSE_DIRECTORY_NAME>with a valid directory name inside the container.
- For Windows, ensure paths use
\\(e.g.,C:\\Users\\YourName\\YourFolder). - Verify local paths exist and placeholders (
<...>) are replaced correctly.
If you prefer not to build the Docker image locally, you can pull the prebuilt image from Docker Hub:
docker pull avivnat13/gitleaks-controller:latest
docker run --rm -v "<LOCAL_DIRECTORY_TO_SCAN>:/code/<CHOOSE_DIRECTORY_NAME>" avivnat13/gitleaks-controller:latest --dir /code/<CHOOSE_DIRECTORY_NAME>The Gitleaks Controller supports several configurable flags that allow you to customize its behavior. You can use these flags whether running the tool locally or via Docker.
| Flag | Default | Description |
|---|---|---|
--dir DIRNAME |
Current working directory | Path to the directory to scan for sensitive information leaks. |
--output_filename |
output.json |
Name of the file where scan results will be saved. |
--show_result, --no-show_result |
True |
Print the scan results directly to the terminal after completion. |
--bonus, --no-bonus |
True |
Include additional structured output using Pydantic models. |
You can pass the flags as arguments.
docker run --rm -v "<LOCAL_DIRECTORY_TO_SCAN>:/code" gitleaks-controller:latest --dir /code --output_filename results.json --bonus --show_resultdocker run --rm -v "<LOCAL_DIRECTORY_TO_SCAN>:/code" avivnat13/gitleaks-controller:latest --dir /code --output_filename results.json --bonus --show_result