This repository maintains shared GitHub Actions workflows that can be used by applications across the organization.
A reusable workflow that performs comprehensive secret scanning using
- Gitleaks with HMCTS-specific rules along with built-in rules
- trufflehog
- Comprehensive Secret Detection: Uses Gitleaks to scan for exposed secrets, API keys, passwords, and other sensitive information
- HMCTS-Specific Rules: Includes custom rules tailored for identifying HMCTS sensitive information
- Reusable Design: Can be easily integrated into any repository's CI/CD pipeline
To use this workflow in your repository, create a workflow file (e.g., .github/workflows/secret-scanning.yml) with the following content:
name: Secret Scanning
on:
push:
branches: [ main, develop ]
pull_request: #Run on all branches
jobs:
scan:
uses: hmcts/cp-shared-git-workflows/.github/workflows/shared-secret-scanning.yml@main
secrets:
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
secrets: inheritThe following secrets must be configured:
| Secret Name | Description | Required |
|---|---|---|
GITLEAKS_LICENSE |
Gitleaks license key for advanced scanning capabilities | Yes |
HMCTS_CP_GITLEAKS_REGEX_INTERNAL_URL |
Regex patterns for detecting internal HMCTS URLs | Yes |
HMCTS_CP_GITLEAKS_REGEX_SYSTEM_IDS |
Regex patterns for detecting HMCTS system identifiers | Yes |
-
Add Secrets to Repository:
- Go to your repository's/Organisation Settings → Secrets and variables → Actions
- Add the required secrets listed above
-
Create Workflow File:
- Create
.github/workflows/secret-scanning.ymlin your repository - Use the example configuration provided above
- Create
-
Customize Triggers:
- Modify the
onsection to match your repository's branching strategy - Add additional triggers as needed (e.g., schedule, manual dispatch)
- Modify the
- Missing Secrets: Ensure all required secrets are properly configured
- False Positives: Review and adjust regex patterns if legitimate content is flagged
For issues or questions regarding this workflow, please:
- Check the Issues page
- Create a new issue with detailed information about your problem
- Contact the development team for urgent security concerns