SPHA #35
This file contains 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: SPHA | |
on: | |
pull_request: | |
branches: ["main"] | |
merge_group: | |
types: [checks_requested] | |
schedule: | |
- cron: "12 12 * * 1" | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
# Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117 | |
actions: read | |
# Require writing security events to upload SARIF file to security tab | |
security-events: write | |
# Only need to read contents | |
contents: read | |
jobs: | |
osv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Run osv scanner | |
uses: google/osv-scanner-action/[email protected] | |
with: | |
scan-args: |- | |
--format=json | |
--output osv-results.json | |
--recursive | |
--skip-git=true | |
./ | |
continue-on-error: true | |
- name: Run SPHA Transform | |
uses: fraunhofer-iem/spha-action/[email protected] | |
with: | |
tool: osv | |
inputFile: osv-results.json | |
output: osv-raw-value.json | |
- name: Upload Results | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
with: | |
name: osv-kpi-results | |
path: osv-raw-value.json | |
trufflehog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
fetch-depth: 0 | |
- name: Secret Scanning via trufflehog | |
id: secret-scanning-trufflehog | |
env: | |
BASE: "" | |
HEAD: ${{ github.ref_name }} | |
VERSION: "latest" | |
run: | | |
docker run --rm -v .:/tmp -w /tmp \ | |
ghcr.io/trufflesecurity/trufflehog:${VERSION} \ | |
git file:///tmp/ \ | |
--since-commit \ | |
${BASE:-''} \ | |
--branch \ | |
${HEAD:-''} \ | |
--no-fail \ | |
--no-update \ | |
--github-actions \ | |
--json > trufflehog.log 2>&1 || true | |
grep -e '^{.*}$' trufflehog.log | awk 'BEGIN {print "{\"results\":["} {printf "%s%s", sep, $0; sep="," } END {print "]}"}' | jq > trufflehog-results.json | |
cat trufflehog-results.json | |
- name: Run SPHA Transform | |
uses: fraunhofer-iem/spha-action/[email protected] | |
with: | |
tool: trufflehog | |
inputFile: trufflehog-results.json | |
output: trufflehog-raw-value.json | |
- name: Upload Results | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
with: | |
name: trufflehog-kpi-results | |
path: trufflehog-raw-value.json | |
spha: | |
needs: [osv, trufflehog] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download scanner results | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Run SPHA Calculate | |
uses: fraunhofer-iem/spha-action/[email protected] | |
with: | |
source: $GITHUB_WORKSPACE | |
output: kpis.json | |
- name: Upload Results | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
with: | |
name: SPHA-KPIs | |
path: kpis.json |