GoSecretScanv2 is a fast secret scanner for code. It uses deterministic patterns with entropy and light context. LLM verification is optional.
- Detects credentials, API keys, private keys, and connection strings
- CLI and GitHub Actions support
- Sensible defaults; no services required
- Optional local LLM verification for triage
./scripts/download-models.sh
./scripts/run-llama-server.sh # exposes http://localhost:8080
./gosecretscanner --llm
# Optionally point to a remote/local endpoint
export GOSECRETSCANNER_LLM_ENDPOINT=http://localhost:8080git clone https://github.com/m1rl0k/GoSecretScanv2.git
cd GoSecretScanv2
go build -o gosecretscanner main.gogo install github.com/m1rl0k/GoSecretScanv2@latest# Build the Docker image
docker build -t gosecretscanner .
# Run the scanner on current directory
docker run --rm -v $(pwd):/workspace gosecretscanner
# Run on a specific directory
docker run --rm -v /path/to/scan:/workspace gosecretscanner
Action inputs (when using enable-llm):
enable-llm: set to'true'to download Granite, launch llama.cpp via Docker, and run the scan with--llm.model-path: overrides the GGUF path (relative to the action directory by default).llm-endpoint/llm-port: control how the scanner reaches the llama.cpp HTTP server.llama-image: change the Docker image used to serve Granite (defaultghcr.io/ggerganov/llama.cpp:full).manage-llm-server: set to'false'when your workflow spins up the llama.cpp container viaservices:(as shown below).
Example workflow step:
- name: Run GoSecretScan Action with LLM
uses: ./
with:
scan-path: '.'
fail-on-secrets: 'false'
enable-llm: 'true'
llm-port: '8080'
manage-llm-server: 'false'Navigate to the directory you want to scan and run:
cd /path/to/your/project
./gosecretscannerThe scanner will:
- Recursively scan all files in the current directory
- Skip
.gitandnode_modulesdirectories - Report any secrets found with file location and line numbers
- Exit with code 1 if secrets are found, 0 otherwise
Add to .git/hooks/pre-commit:
#!/bin/bash
./gosecretscanner
if [ $? -ne 0 ]; then
echo "Secret scan failed! Please remove secrets before committing."
exit 1
fiThe repository also exposes a reusable GitHub Action for CI pipelines:
name: Security Scan
on: [push, pull_request]
jobs:
secret-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Use GoSecretScan as a reusable action
- name: Run Secret Scanner
uses: m1rl0k/GoSecretScanv2@main
with:
scan-path: '.'
fail-on-secrets: 'true'go build -o gosecretscanner main.gogo test ./...gofmt -w .- Binary files are not automatically filtered.
- Configuration files for custom settings are not yet supported.
- Custom patterns require code changes.
- Allowlists/whitelists must currently be handled outside the tool.
Contributions are welcome via pull requests.
This project is licensed under the MIT License; see LICENSE for details.
Please open an issue on GitHub for bugs or feature requests.