Skip to content
name: Truffle Security Secrets Scanner
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Secret Scanning
id: trufflehog
uses: trufflesecurity/trufflehog@main
with:
extra_args: --only-verified --json
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN_2 }}
- name: Save TruffleHog Output
run: echo "${{ steps.trufflehog.outputs.json }}" > trufflehog-secrets.json
- name: List files
run: ls -al # Check if the script is in the expected location
- name: Convert TruffleHog Output to SARIF
run: |
python convert_to_sarif.py trufflehog-secrets.json trufflehog-secrets.sarif
- name: Install Snyk CLI
run: npm install -g snyk
- name: Monitor TruffleHog identified secrets with Snyk
uses: trufflesecurity/trufflehog@main
with:
command: monitor --all-projects --json-file=trufflehog-secrets.json
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN_2 }}
continue-on-error: true
#With Enterprise Plan
- name: Send results to Snyk
run: |
curl -X POST "https://snyk.io/api/v1/test" \
-H "Authorization: token ${{ secrets.SNYK_TOKEN_2 }}" \
-H "Content-Type: application/json" \
-d @trufflehog-secrets.json
continue-on-error: true
#RUN TS SCANNER
#ADD IN SNYK TEST
#CONVERT FINDINGS TO SARIF
#UPLOAD TO GIHUB
#SEND TO SNYK