-
Notifications
You must be signed in to change notification settings - Fork 0
Detect secrets #3
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
5d71b81
da054c1
6318dac
e76f971
a68c58a
649f7a7
ca1e2b2
e7b2d75
a2c063f
054e350
526aae3
280de7c
0818282
ef79aba
263320e
1bc1999
a72679d
69572e7
a458604
371720f
eb9ced3
09923c8
1dd2f79
8e4636e
5b402a1
2ff9fba
6151aae
52de5d1
4ad960d
b668785
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,146 @@ | ||||||||||||||||
| name: Detect Secrets Action | ||||||||||||||||
| description: | | ||||||||||||||||
| Scan the repository for secrets using the following tools: | ||||||||||||||||
| 1. Gitleaks: https://github.com/gitleaks/gitleaks | ||||||||||||||||
| 2. TruffleHog: https://github.com/trufflesecurity/trufflehog | ||||||||||||||||
| 3. detect-secrets: https://github.com/Yelp/detect-secrets | ||||||||||||||||
| 4. git-secrets: https://github.com/awslabs/git-secrets | ||||||||||||||||
| 5. Talisman: https://github.com/thoughtworks/talisman | ||||||||||||||||
| 6. credential-digger: https://github.com/SAP/credential-digger | ||||||||||||||||
| 7. kingfisher: https://github.com/mongodb/kingfisher | ||||||||||||||||
|
|
||||||||||||||||
| inputs: | ||||||||||||||||
| github-token: | ||||||||||||||||
| description: GitHub token for authentication | ||||||||||||||||
| required: true | ||||||||||||||||
| default: ${{ github.token }} | ||||||||||||||||
| gitleaks-license: | ||||||||||||||||
| description: Gitleaks license key for enterprise features | ||||||||||||||||
| required: true | ||||||||||||||||
| default: "" | ||||||||||||||||
|
|
||||||||||||||||
| runs: | ||||||||||||||||
| using: "composite" | ||||||||||||||||
| steps: | ||||||||||||||||
| - uses: actions/checkout@v6.0.1 | ||||||||||||||||
| with: | ||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Prepare report directory | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: mkdir -p secrets_report | ||||||||||||||||
|
|
||||||||||||||||
| - name: Setup Python | ||||||||||||||||
| uses: actions/setup-python@v6.1.0 | ||||||||||||||||
| with: | ||||||||||||||||
| python-version: "3.12.12" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install jq | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: sudo apt-get update && sudo apt-get install -y jq | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install detect-secrets | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: pip install detect-secrets | ||||||||||||||||
|
|
||||||||||||||||
| - name: Run detect-secrets | ||||||||||||||||
| continue-on-error: true | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| detect-secrets scan --force-use-all-plugins > secrets_report/detect_secrets.json | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install git-secrets | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| git clone https://github.com/awslabs/git-secrets.git | ||||||||||||||||
| cd git-secrets | ||||||||||||||||
| sudo make install | ||||||||||||||||
| cd .. | ||||||||||||||||
|
|
||||||||||||||||
| - name: Run git-secrets | ||||||||||||||||
| continue-on-error: true | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: git secrets --scan -r . | tee secrets_report/git_secrets.txt | ||||||||||||||||
|
|
||||||||||||||||
| - name: Run Gitleaks | ||||||||||||||||
| uses: gitleaks/gitleaks-action@v2.3.9 | ||||||||||||||||
| continue-on-error: true | ||||||||||||||||
| env: | ||||||||||||||||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||||||||||||||||
| GITLEAKS_LICENSE: ${{ inputs.gitleaks-license }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install Talisman | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh)" | ||||||||||||||||
|
||||||||||||||||
| run: bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh)" | |
| run: | | |
| set -euo pipefail | |
| curl --fail --show-error --silent --location \ | |
| -o /tmp/talisman-install.sh \ | |
| https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh | |
| bash /tmp/talisman-install.sh |
Copilot
AI
Dec 28, 2025
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.
Installing software by piping curl output directly to bash poses a security risk as it executes arbitrary code from a remote source without validation. Consider downloading the script first, reviewing it, and then executing it, or use a specific versioned release with checksum verification.
Copilot
AI
Dec 28, 2025
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 TruffleHog installation uses 'continue-on-error: true' which means if the installation fails, the workflow will continue without running TruffleHog. This silently skips the scan if installation fails. Consider moving this flag to the 'Run TruffleHog' step instead, or add explicit validation that the binary was installed successfully before attempting to run it.
Copilot
AI
Dec 28, 2025
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 step uses 'set -euo pipefail' for strict error handling, but the parent step has 'continue-on-error: true' which negates the benefit of strict error handling. If installation fails, it will continue silently. This creates inconsistent error handling behavior.
| set -euo pipefail |
Copilot
AI
Dec 28, 2025
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 TruffleHog version is hardcoded as '3.92.4' in the script. This makes it difficult to maintain and update. Consider extracting this as an input parameter with a default value, or using 'latest' from the GitHub releases API to avoid manually updating version numbers.
Copilot
AI
Dec 28, 2025
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 TruffleHog binary is installed to a temporary directory using '$RUNNER_TEMP' but is not added to the PATH. If the subsequent 'Run TruffleHog' step fails to execute, it will be difficult to debug whether the issue is a missing binary or an actual scan failure. Consider adding the binary to a well-known location or validating its presence before the scan step.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Secrets Scan Workflow | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| scan: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6.0.1 | ||
| - uses: ./.github/actions/detect-secrets | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| gitleaks-license: ${{ secrets.GITLEAKS_LICENSE }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .venv |
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 'gitleaks-license' input is marked as required but has a default value of empty string. An input cannot be both required and have an empty default. Either set 'required: false' if the license is optional, or remove the default value if it's truly required.