-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add reusable secrets-scan workflow + template #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||
| name: Secrets scan | ||||||
|
|
||||||
| # Reusable secrets-scan workflow for DVSA repositories. | ||||||
| # Standardised on awslabs/git-secrets with the AWS provider patterns — | ||||||
| # matches the convention used across DVSA (MOT, CVS, RSP, theory-test, …). | ||||||
| # | ||||||
| # Invoke from a repo via: | ||||||
| # jobs: | ||||||
| # secrets: | ||||||
| # uses: dvsa/.github/.github/workflows/secrets-scan.yaml@main | ||||||
|
|
||||||
| on: | ||||||
| workflow_call: | ||||||
| inputs: | ||||||
| fail-on-detection: | ||||||
| description: Fail the job when leaks are found. | ||||||
| type: boolean | ||||||
| default: true | ||||||
| scan-history: | ||||||
| description: Also run `git secrets --scan-history` (full git log). Slower; off by default for PR runs. | ||||||
| type: boolean | ||||||
| default: false | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
| pull-requests: read | ||||||
|
|
||||||
| jobs: | ||||||
| git-secrets: | ||||||
| name: git-secrets | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Checkout (full history) | ||||||
| uses: actions/checkout@v6 | ||||||
| with: | ||||||
| fetch-depth: 0 | ||||||
|
|
||||||
| - name: Install git-secrets | ||||||
| run: | | ||||||
| set -euo pipefail | ||||||
| tmp="$(mktemp -d)" | ||||||
| git clone --quiet --depth 1 https://github.com/awslabs/git-secrets "$tmp" | ||||||
|
||||||
| git clone --quiet --depth 1 https://github.com/awslabs/git-secrets "$tmp" | |
| git clone --quiet --depth 1 --branch 1.3.0 --single-branch https://github.com/awslabs/git-secrets "$tmp" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "name": "Secrets scan (git-secrets)", | ||
| "description": "Scan the repository for committed secrets using awslabs/git-secrets with the canonical AWS pattern set. Calls the shared dvsa/.github reusable workflow.", | ||
| "iconName": "octicon shield-lock", | ||
| "categories": ["Security"], | ||
| "filePatterns": [".*"] | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||
| name: Secrets scan | ||||||
|
|
||||||
| on: | ||||||
| pull_request: | ||||||
| push: | ||||||
| branches: [main, master] | ||||||
|
||||||
| branches: [main, master] | |
| branches: [ $default-branch ] |
Copilot
AI
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template references the reusable workflow with @main. In this repo’s other templates, reusable workflows are pinned to a released version tag (e.g. workflow-templates/php-security.yml:13 uses @v5.0.6) to avoid unexpected breaking changes for consumers. Consider pinning to a version tag and updating it on release.
| uses: dvsa/.github/.github/workflows/secrets-scan.yaml@main | |
| uses: dvsa/.github/.github/workflows/secrets-scan.yaml@v5.0.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes would want to do that @fibble
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow always checks out full git history (
fetch-depth: 0) even wheninputs.scan-historyis false, which undermines the “fast on PRs” intent and can be slow for large repositories. Consider using a conditional/parameterizedfetch-depth(0 only whenscan-historyis true; otherwise default/shallow).