Skip to content

Commit 83cacdd

Browse files
Create fortify-analysis.yml
1 parent 8e1e0e0 commit 83cacdd

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
################################################################################################################################################
2+
# Fortify lets you build secure software fast with an appsec platform that automates testing throughout the DevSecOps pipeline. Fortify static,#
3+
# dynamic, interactive, and runtime security testing is available on premises or as a service. To learn more about Fortify, start a free trial #
4+
# or contact our sales team, visit microfocus.com/appsecurity. #
5+
# #
6+
# Use this workflow template as a basis for integrating Fortify on Demand Static Application Security Testing(SAST) into your GitHub workflows.#
7+
# This template demonstrates the steps to prepare the code+dependencies, initiate a scan, download results once complete and import into #
8+
# GitHub Security Code Scanning Alerts. Existing customers should review inputs and environment variables below to configure scanning against #
9+
# an existing application in your Fortify on Demand tenant. Additional information is available in the comments throughout the workflow, the #
10+
# documentation for the Fortify actions used, and the Fortify on Demand / ScanCentral Client product documentation. If you need additional #
11+
# assistance with configuration, feel free to create a help ticket in the Fortify on Demand portal. #
12+
################################################################################################################################################
13+
14+
name: Fortify on Demand Scan
15+
16+
# TODO: Customize trigger events based on your DevSecOps processes and typical FoD SAST scan time
17+
on:
18+
workflow_dispatch:
19+
push:
20+
branches: [master]
21+
pull_request:
22+
# The branches below must be a subset of the branches above
23+
branches: [master]
24+
25+
jobs:
26+
FoD-SAST-Scan:
27+
# Use the appropriate runner for building your source code.
28+
# TODO: Use a Windows runner for .NET projects that use msbuild. Additional changes to RUN commands will be required to switch to Windows syntax.
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
# Check out source code
33+
- name: Check Out Source Code
34+
uses: actions/checkout@v2
35+
with:
36+
# Fetch at least the immediate parents so that if this is a pull request then we can checkout the head.
37+
fetch-depth: 2
38+
# If this run was triggered by a pull request event, then checkout the head of the pull request instead of the merge commit.
39+
- run: git checkout HEAD^2
40+
if: ${{ github.event_name == 'pull_request' }}
41+
# Java 8 required by ScanCentral Client and FoD Uploader(Univeral CI Tool)
42+
- name: Setup Java
43+
uses: actions/setup-java@v1
44+
with:
45+
java-version: 1.8
46+
47+
# Prepare source+dependencies for upload. The default example is for a Maven project that uses pom.xml.
48+
# TODO: Update PACKAGE_OPTS based on the ScanCentral Client documentation for your project's included tech stack(s). Helpful hints:
49+
# ScanCentral Client will download dependencies for maven (-bt mvn) and gradle (-bt gradle).
50+
# ScanCentral Client can download dependencies for msbuild projects (-bt msbuild); however, you must convert the workflow to use a Windows runner.
51+
# ScanCentral has additional options that should be set for PHP and Python projects
52+
# For other build tools, add your build commands to download necessary dependencies and prepare according to Fortify on Demand Packaging documentation.
53+
# ScanCentral Client documentation is located at https://www.microfocus.com/documentation/fortify-software-security-center/
54+
- name: Download Fortify ScanCentral Client
55+
uses: fortify/gha-setup-scancentral-client@v1
56+
- name: Package Code + Dependencies
57+
run: scancentral package $PACKAGE_OPTS -o package.zip
58+
env:
59+
PACKAGE_OPTS: "-bt mvn"
60+
61+
# 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
62+
# TODO: Update ENV variables for your application and create the necessary GitHub Secrets. Helpful hints:
63+
# Credentials and release ID should be obtained from your FoD tenant (either Personal Access Token or API Key can be used).
64+
# Automated Audit preference should be configured for the release's Static Scan Settings in the Fortify on Demand portal.
65+
- name: Download Fortify on Demand Universal CI Tool
66+
uses: fortify/gha-setup-fod-uploader@v1
67+
- name: Perform SAST Scan
68+
run: java -jar $FOD_UPLOAD_JAR -z package.zip -aurl $FOD_API_URL -purl $FOD_URL -rid "$FOD_RELEASE_ID" -tc "$FOD_TENANT" -uc "$FOD_USER" "$FOD_PAT" $FOD_UPLOADER_OPTS -n "$FOD_UPLOADER_NOTES"
69+
env:
70+
FOD_TENANT: ${{ secrets.FOD_TENANT }}
71+
FOD_USER: ${{ secrets.FOD_USER }}
72+
FOD_PAT: ${{ secrets.FOD_PAT }}
73+
FOD_RELEASE_ID: ${{ secrets.FOD_RELEASE_ID }}
74+
FOD_URL: "https://ams.fortify.com/"
75+
FOD_API_URL: "https://api.ams.fortify.com/"
76+
FOD_UPLOADER_OPTS: "-ep 2 -pp 0 -I 1 -apf"
77+
FOD_UPLOADER_NOTES: 'Triggered by GitHub Actions (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
78+
79+
# Once scan completes, pull SAST issues from Fortify on Demand and generate SARIF output.
80+
# TODO: Review Action inputs. For most users, these will be the same as used in the Perform SAST Scan step.
81+
- name: Download Results
82+
uses: fortify/gha-fod-generate-sarif@1.1.0
83+
with:
84+
base-url: https://ams.fortify.com
85+
tenant: ${{ secrets.FOD_TENANT }}
86+
user: ${{ secrets.FOD_USER }}
87+
password: ${{ secrets.FOD_PAT }}
88+
release-id: ${{ secrets.FOD_RELEASE_ID }}
89+
output: ./sarif/output.sarif
90+
91+
# Import Fortify on Demand results to GitHub Security Code Scanning
92+
- name: Import Results
93+
uses: github/codeql-action/upload-sarif@v1
94+
with:
95+
sarif_file: ./sarif/output.sarif

0 commit comments

Comments
 (0)