build(deps): bump getsentry/testing-ai-sdk-integrations from dba21cbfb57482556338983d8c35e6b09b534667 to 5b57253605660c813c237839a42826d3d003ee0b #7227
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Secret Scan | |
| on: [pull_request, merge_group] | |
| jobs: | |
| secret-scan: | |
| name: Secret Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| outputs: | |
| latest_release: ${{ steps.trufflehog_release.outputs.latest_release }} | |
| latest_tag_name: ${{ steps.trufflehog_release.outputs.latest_tag_name }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Install Cosign | |
| uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0 | |
| - name: Pin Trufflehog to a know good release | |
| id: trufflehog_release | |
| shell: bash | |
| # run: | | |
| # LATEST_TAG_NAME=$(curl -s https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest | jq -r .name) | |
| # LATEST_RELEASE=$(echo ${LATEST_TAG_NAME:1}) | |
| # echo "latest_tag_name=$LATEST_TAG_NAME" >> "$GITHUB_OUTPUT" | |
| # echo "latest_release=$LATEST_RELEASE" >> "$GITHUB_OUTPUT" | |
| run: | | |
| echo "latest_tag_name=$(curl -s https://api.github.com/repos/trufflesecurity/trufflehog/releases | jq -r '.[1].tag_name')" >> "$GITHUB_OUTPUT" | |
| echo "latest_release=$(curl -s https://api.github.com/repos/trufflesecurity/trufflehog/releases | jq -r '.[1].tag_name | ltrimstr("v")')" >> "$GITHUB_OUTPUT" | |
| - name: Download and verify TruffleHog release | |
| run: | | |
| curl -fsSL --retry 3 --retry-delay 5 -O https://github.com/trufflesecurity/trufflehog/releases/download/${{ steps.trufflehog_release.outputs.latest_tag_name }}/trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt | |
| curl -fsSL --retry 3 --retry-delay 5 -O https://github.com/trufflesecurity/trufflehog/releases/download/${{ steps.trufflehog_release.outputs.latest_tag_name }}/trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt.pem | |
| curl -fsSL --retry 3 --retry-delay 5 -O https://github.com/trufflesecurity/trufflehog/releases/download/${{ steps.trufflehog_release.outputs.latest_tag_name }}/trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt.sig | |
| curl -fsSL --retry 3 --retry-delay 5 -O https://github.com/trufflesecurity/trufflehog/releases/download/${{ steps.trufflehog_release.outputs.latest_tag_name }}/trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_linux_amd64.tar.gz | |
| cosign verify-blob trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt \ | |
| --certificate trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt.pem \ | |
| --signature trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt.sig \ | |
| --certificate-identity-regexp 'https://github\.com/trufflesecurity/trufflehog/\.github/workflows/.+' \ | |
| --certificate-oidc-issuer "https://token.actions.githubusercontent.com" | |
| sha256sum --ignore-missing -c trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_checksums.txt | |
| - name: Extract TruffleHog | |
| run: | | |
| tar xzf trufflehog_${{ steps.trufflehog_release.outputs.latest_release }}_linux_amd64.tar.gz -C /usr/local/bin | |
| chmod +x /usr/local/bin/trufflehog | |
| - name: Run TruffleHog scan | |
| continue-on-error: true | |
| id: scan | |
| run: | | |
| if [ -e .secret_scan_ignore ]; then | |
| trufflehog git file://. --only-verified --github-actions --fail --exclude-paths=.secret_scan_ignore --exclude-detectors="datadogtoken" | |
| else | |
| trufflehog git file://. --only-verified --github-actions --fail --exclude-detectors="datadogtoken" | |
| fi | |
| - name: Send Alert to SIEM | |
| id: alert | |
| run: | | |
| if [[ -n "${{vars.SECRET_SCAN_SIEM_WEBHOOK_URL}}" ]]; then | |
| curl "${{vars.SECRET_SCAN_SIEM_WEBHOOK_URL}}" \ | |
| --data '{"event":"github_secret_scanning", "status":"${{steps.scan.outcome}}", "createdAt":"${{ github.event.pull_request.created_at }}", "repo":"${{ github.repository }}","pull_request":"https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}","actor":"${{ github.event.pull_request.user.login }}"}' | |
| fi | |
| - name: Fail workflow if secret detected | |
| if: steps.scan.outcome != 'success' | |
| run: exit 1 |