Skip to content

Commit 98ced25

Browse files
authored
feat(secret-scanning): Forward alerts to Panther (#142)
* send failed result to panther * rename variables * remove unnecessary `<`
1 parent cd530b6 commit 98ced25

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/secret-scan.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,20 @@ jobs:
5454
chmod +x /usr/local/bin/trufflehog
5555
5656
- name: Run TruffleHog scan
57+
id: scan
5758
run: |
5859
if [ -e .secret_scan_ignore ]; then
5960
trufflehog git file://. --only-verified --github-actions --fail --exclude-paths=.secret_scan_ignore --exclude-detectors="datadogtoken"
6061
else
6162
trufflehog git file://. --only-verified --github-actions --fail --exclude-detectors="datadogtoken"
6263
fi
64+
- name: Send Alert to Panther
65+
id: alert
66+
if: steps.scan.outcome != 'success'
67+
run: |
68+
curl "${{vars.SECRET_SCAN_PANTHER_WEBHOOK_URL}}" \
69+
--header "Authorization: Bearer ${{ secrets.SECRET_SCAN_PANTHER_WEBHOOK_HEADER }}" \
70+
--data '{"event":"github_secret_scanning_failed", 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 }}"}'
71+
- name: Fail workflow if secret detected
72+
if: steps.scan.outcome != 'success'
73+
run: exit 1

0 commit comments

Comments
 (0)