Skip to content

Commit

Permalink
Merge pull request #22 from fortify/new-gh-action
Browse files Browse the repository at this point in the history
Update fortify.yml
  • Loading branch information
dylanbthomas authored Nov 3, 2023
2 parents b174132 + 711b292 commit 2990263
Showing 1 changed file with 16 additions and 40 deletions.
56 changes: 16 additions & 40 deletions .github/workflows/fortify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ name: Fortify on Demand Scan

on:
push:
branches: ["main", "pr-scan-test-branch"]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main", "pr-scan-test-branch"]
branches: ["main"]
workflow_dispatch:

jobs:
Expand All @@ -38,46 +37,23 @@ jobs:
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

# Java is required to run the various Fortify utilities.
# Java is required to run the various Fortify utilities. Ensuring proper version is installed on the runner.
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

# Prepare source+dependencies for upload. ScanCentral Client documentation is located at https://www.microfocus.com/documentation/fortify-software-security-center/
- name: Download Fortify ScanCentral Client
uses: fortify/gha-setup-scancentral-client@v2
- name: Package Code + Dependencies
run: scancentral package -bf IWA.Net.sln -o package.zip -oss

# Start Fortify on Demand SAST scan and wait until results complete. For more information on FoDUploader commands, see https://github.com/fod-dev/fod-uploader-java
- name: Download Fortify on Demand Universal CI Tool
uses: fortify/gha-setup-fod-uploader@v1
- name: Perform SAST Scan
id: scan
run: java -jar ${env:FOD_UPLOAD_JAR} -z package.zip -aurl ${env:FOD_API_URL} -purl ${env:FOD_URL} -rid ${env:FOD_RELEASE_ID} -tc ${env:FOD_TENANT} -uc ${env:FOD_USER} ${env:FOD_PAT} -n ${env:FOD_UPLOADER_NOTES} -ep 2 -pp 0 -I 1 -apf
env:
FOD_URL: "https://ams.fortify.com/"
FOD_API_URL: "https://api.ams.fortify.com/"
FOD_TENANT: ${{ secrets.FOD_TENANT }}
FOD_USER: ${{ secrets.FOD_USER }}
FOD_PAT: ${{ secrets.FOD_PAT }}
FOD_RELEASE_ID: ${{ secrets.FOD_RELEASE_ID }}
FOD_UPLOADER_NOTES: 'Triggered by GitHub Actions (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'

# Once scan completes, pull SAST issues from Fortify on Demand and generate SARIF output.
- name: Export results to GitHub-optimized SARIF
uses: fortify/gha-export-vulnerabilities@v1
# Perform Fortify on Demand SAST + SCA scan and import SAST results into GitHub code scanning alerts
- name: Run FoD SAST Scan
uses: fortify/github-action@v1
with:
fod_base_url: "https://ams.fortify.com/"
fod_tenant: ${{ secrets.FOD_TENANT }}
fod_user: ${{ secrets.FOD_USER }}
fod_password: ${{ secrets.FOD_PAT }}
fod_release_id: ${{ secrets.FOD_RELEASE_ID }}

# Import Fortify on Demand results to GitHub Security Code Scanning
- name: Import Results from Fortify on Demand
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ./gh-fortify-sast.sarif
sast-scan: true
env:
FOD_URL: https://ams.fortify.com
FOD_TENANT: ${{secrets.FOD_TENANT}}
FOD_USER: ${{secrets.FOD_USER}}
FOD_PASSWORD: ${{secrets.FOD_PAT}}
FOD_RELEASE: ${{ secrets.FOD_RELEASE_ID }}
EXTRA_PACKAGE_OPTS: -oss
DO_EXPORT: true

0 comments on commit 2990263

Please sign in to comment.