A practical sandbox for testing GitHub Advanced Security (GHAS) custom secret scanning patterns
From the Office of the CTO, Globomantics Corp.
This repository serves as a learning sandbox for implementing and testing custom secret scanning patterns with GitHub Advanced Security. It's specifically designed for teams learning how to protect their unique authentication token formats using GHAS.
- How to define custom secret scanning patterns
- Testing your patterns in a safe environment
- Implementing push protection for custom secrets
- Best practices for secret pattern definition
- Fork this repository to your organization
- Enable GitHub Advanced Security features:
gh api -X PATCH repos/YOUR-ORG/globomantics-secret-sandbox \ -f security_and_analysis.advanced_security.status=enabled \ -f security_and_analysis.secret_scanning.status=enabled \ -f security_and_analysis.secret_scanning_push_protection.status=enabled
- Run the test script:
./run-secret-test.sh
This repository includes a sample custom pattern for Globomantics robot authentication tokens:
gbot-(dev|prod)-[A-Fa-f0-9]{16}
This pattern matches our standard robot token format:
gbot-dev-xxxxabcd5678ef90
gbot-prod-A1B2C3D4E5F6xxxx
- Check the pattern definition in
globomantics-robot-auth-token-formats.md
- Use the provided test script:
run-secret-test.sh
- Monitor results in GitHub Security tab
- GitHub Docs: Custom Patterns for Secret Scanning
- Pluralsight Course: GitHub Advanced Security Deep Dive
- This is a sandbox environment - perfect for learning and testing
- Never use real secrets or tokens
- Pattern testing may take a few minutes to complete
- Push protection requires additional configuration
Found a way to improve the patterns or tests? Submit a PR! We're always looking to enhance our security practices.
MIT - See LICENSE for details
This repository includes Git hooks for security scanning. To enable them, either:
-
Run the setup script:
./setup-hooks.sh
-
Or manually configure:
git config core.hooksPath .hooks
The pre-commit hook will:
- Scan staged files for AWS keys
- Block commits that contain potential secrets
- Show which files contain secrets
"Security is not a product, but a process." - Bruce Schneier