Secret Scanner Installation
Before you begin
You'll need:
- A ByteHide account and project token
- Python 3.7 or higher installed
- Node.js 16+ installed (required by the scanner engine)
Installation
Install the ByteHide Secret Scanner using pip:
Bash
pip install bytehide-secrets-scannerpip install bytehide-secrets-scannerBasic Setup
After installation, initialize the scanner configuration:
Bash
bytehide-secrets initbytehide-secrets initThis interactive command will create a bytehide.secrets.json file in your project root directory:
JSON
{
"token": "<your-project-token>",
"appName": "My Python Project",
"environment": "development",
"sync": true,
"fix": false,
"anonymize": false
}{
"token": "<your-project-token>",
"appName": "My Python Project",
"environment": "development",
"sync": true,
"fix": false,
"anonymize": false
}Security Warning
Never commit your bytehide.secrets.json file to source control. Add it to your .gitignore file.
Verify Installation
After installation, run a scan to verify everything is working:
Bash
bytehide-secrets scanbytehide-secrets scanThe scanner will automatically:
- Check if scanning is enabled for your configuration
- Scan source code for secrets
- Report any findings to your ByteHide dashboard
- Export detected secrets to your ByteHide Secrets Manager (if configured)
Build Integration
For automatic scanning, you can add the scanner to your build or test pipeline:
Using a Makefile
MAKEFILE
.PHONY: scan-secrets
scan-secrets:
bytehide-secrets scan .
.PHONY: test
test: scan-secrets
pytest tests/.PHONY: scan-secrets
scan-secrets:
bytehide-secrets scan .
.PHONY: test
test: scan-secrets
pytest tests/Using setup.cfg or pyproject.toml
Add a custom script entry to run the scanner before tests:
TOML
# pyproject.toml
[tool.pytest.ini_options]
# Run scanner as part of your test suite# pyproject.toml
[tool.pytest.ini_options]
# Run scanner as part of your test suiteBash
bytehide-secrets scan && pytest tests/bytehide-secrets scan && pytest tests/Scanner Workflow
The Secret Scanner integrates into your development workflow:
- Installation: Install the pip package
- Configuration: Set up the scanner via the JSON file or init command
- Scanning: Run manually or automatically during builds
- Reporting: Detected secrets appear in your ByteHide dashboard
- Action: Export, fix, or receive alerts about found secrets