Skip to content

Commit

Permalink
GitHub Actions and Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kadraman committed Nov 28, 2023
1 parent c46bc17 commit 65aa85d
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 437 deletions.
2 changes: 1 addition & 1 deletion .github/actions/gradle-fod-oss-scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inputs:
fod_parent_release_name:
required: false
description: "FoD Parent Release Name"
default: "main"
default: "dev"
gradle_version:
required: false
description: "Version of Gradle to use"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/gradle-fod-sast-scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inputs:
fod_parent_release_name:
required: false
description: "FoD Parent Release Name"
default: "main"
default: "dev"
gradle_version:
required: false
description: "Version of Gradle to use"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/gradle-fortify-sast-scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inputs:
ssc_parent_appver_name:
required: false
description: "SSC Parent Application Version Name"
default: "main"
default: "develop"
ssc_sensor_ver:
required: false
description: "SSC Sensor Version"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/debricked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
name: OSS SCA with Debricked

on:
# Triggers the workflow on push or pull request events but only for the main branch
# Triggers the workflow on push or pull request events but only for the main and develop branches
push:
paths:
- 'build.gradle'
branches:
- '**' # matches every branch
pull_request:
branches: [ main ]
branches: [ main, develop ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/fod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# Create GitHub Action Repository Variables for your version of the application:
# FOD_BASE_URL should be FoD BASE URL for your tenant (e.g. https://emea.fortify.com)
# FOD_API_URL should be FoD API URL for your tenant (e.g. https://api.emea,fortify.com)
# FOD_PARENT_RELEASE_NAME is the FoD release name corresponding to the parent branch of any newly created branch, this is typically "main"
# FOD_BASE_URL should be FoD BASE URL for your tenant (e.g. https://ams.fortify.com)
# FOD_API_URL should be FoD API URL for your tenant (e.g. https://api.ams,fortify.com)
# FOD_PARENT_RELEASE_NAME is the FoD release name corresponding to the parent branch of any newly created branch, this is typically "main" or "develop"
# Create GitHub Action Secrets for your version of the application:
# FOD_CLIENT_ID should be an API Key obtained from your FoD tenant.
# FOD_CLIENT_SECRET should be the secret for the API Key obtained for your FoD tenant.
Expand All @@ -14,7 +14,7 @@
name: DevSecOps with Fortify on Demand

on:
# Triggers the workflow on push or pull request events but only for the main branch
# Triggers the workflow on push or pull request events but only for the main or develop branches
push:
paths-ignore:
- '.github/**/**'
Expand All @@ -29,7 +29,7 @@ on:
branches:
- '**' # matches every branch
pull_request:
branches: [ main ]
branches: [ main, develop ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -112,6 +112,7 @@ jobs:
fod_client_secret: ${{ secrets.FOD_CLIENT_SECRET }}
fod_app_name: ${{ steps.fortify-app-and-rel-name.outputs.app_name }}
fod_release_name: ${{ steps.fortify-app-and-rel-name.outputs.release_name }}
fod_parent_release_name: ${{ vars.FOD_PARENT_RELEASE_NAME }}

Quality-Gate:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -152,6 +153,7 @@ jobs:
fod_client_secret: ${{ secrets.FOD_CLIENT_SECRET }}
fod_app_name: ${{ steps.fortify-app-and-rel-name.outputs.app_name }}
fod_release_name: ${{ steps.fortify-app-and-rel-name.outputs.release_name }}
fod_parent_release_name: ${{ vars.FOD_PARENT_RELEASE_NAME }}

FoD-DAST-Scan:
runs-on: ubuntu-latest
Expand Down
41 changes: 19 additions & 22 deletions .github/workflows/fortify.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

# Create GitHub Action Repository Variables for your version of the application:
# FORTIFY_BASE_URL should be the Fortify Base URL (e.g. https://ssc.uat.fortifyhosted.net)
# FORTIFY_PARENT_APPVER_NAME is the Fortify SSC Application Version Name corresponding to the parent branch of any newly created branch, this is typically "main"
# FORTIFY_PARENT_APPVER_NAME is the Fortify SSC Application Version Name corresponding to the parent branch of any newly created branch, this is typically "main" or "develop"
# Create GitHub Action Secrets for your version of the application:
# FORTIFY_SSC_TOKEN should be an SSC Authorization token (CIToken) obtained from your Fortify tenant.
# FORTIFY_SCSAST_CLIENT_AUTH_TOKEN should be the ScanCentral SAST Client Authentication token for your Fortify tenant.

name: DevSecOps with Fortify (Hosted)

on:
# Triggers the workflow on push or pull request events but only for the main branch
# Triggers the workflow on push or pull request events but only for the main or develop branches
push:
paths-ignore:
- '.github/**/**'
Expand All @@ -24,7 +24,7 @@ on:
branches:
- '**' # matches every branch
pull_request:
branches: [ main ]
branches: [ main, develop ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -33,10 +33,10 @@ on:
description: 'Carry out SAST scan using Fortify'
required: false
default: 'true'
# runDebrickedScan:
# description: 'Carry out SCA scan using Debricked'
# required: false
# default: 'false'
runSonatypeScan:
description: 'Carry out SCA scan using Sonatype Nexus IQ'
required: false
default: 'false'
runFortifyDASTScan:
description: 'Carry out DAST scan using Fortify'
required: false
Expand Down Expand Up @@ -72,21 +72,18 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build

# TODO: changed to FoD OSS Scan
# Debricked-SCA:
# runs-on: ubuntu-latest
# if: ${{ (github.event_name == 'push') || (github.event_name == 'pull_request') || (github.event.inputs.runDebrickedScan == 'true') }}
# steps:
# - uses: actions/[email protected]
# - uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '11'
# - run: ./gradlew dependencies > .debricked-gradle-dependencies.txt
# - uses: debricked/vulnerable-functionality/java/gradle@v0
# - uses: debricked/actions/scan@v1
# env:
# DEBRICKED_TOKEN: ${{ secrets.DEBRICKED_TOKEN }}
Sonatype-SCA:
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'push') || (github.event_name == 'pull_request') || (github.event.inputs.runSonatypeScan == 'true') }}
steps:
- uses: actions/[email protected]
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- run: ./gradlew dependencies > .debricked-gradle-dependencies.txt

# TODO: Sonatype Nexus IQ scan

Quality-Gate:
runs-on: ubuntu-latest
Expand Down
7 changes: 0 additions & 7 deletions bin/create-config-package.ps1

This file was deleted.

4 changes: 2 additions & 2 deletions bin/create-iac-zip.ps1 → bin/create-infrastructure-zip.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Write-Host $RootPath
$compress = @{
Path = "$($RootPath)\etc\*.yml", "$($RootPath)\etc\*.json", "$($RootPath)\docker-compose.*", "$($RootPath)\Docker*.*", "$($RootPath)\.github\workflows\*.yml"
CompressionLevel = "Fastest"
DestinationPath = "$($RootPath)\IACPackage.zip"
DestinationPath = "$($RootPath)\infrastructure.zip"
}
Compress-Archive @compress -Verbose
Compress-Archive @compress -Verbose
11 changes: 11 additions & 0 deletions bin/fcli-examples/fod-sast-scan.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$EnvSettings = $(ConvertFrom-StringData -StringData (Get-Content ".\.env" | Where-Object {-not ($_.StartsWith('#'))} | Out-String))
$AppName = $EnvSettings['FOD_APP_NAME']
$RelName = $EnvSettings['FOD_REL_NAME']

scancentral package -bt gradle -bc 'clean build -x test' -o package.zip

fcli fod session login
fcli fod sast-scan start --release "$($AppName):$($RelName)" --notes "Started from CLI" -f package.zip --store curScan
fcli fod sast-scan wait-for ::curScan::
fcli fod sast-scan get ::curScan:: -o expr="Fortify Security Rating: {starRating}"
fcli fod session logout
9 changes: 9 additions & 0 deletions bin/fcli-examples/ssc-security-gate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

$EnvSettings = $(ConvertFrom-StringData -StringData (Get-Content ".\.env" | Where-Object {-not ($_.StartsWith('#'))} | Out-String))
$AppName = $EnvSettings['SSC_APP_NAME']
$AppVersion = $EnvSettings['SSC_APP_VER_NAME']

fcli ssc session login
#fcli ssc issue list-filtersets --appversion "$($AppName):$($AppVersion)"
fcli ssc issue count --appversion "$($AppName):$($AppVersion)" --filterset "Security Gate"
fcli ssc session logout
100 changes: 0 additions & 100 deletions bin/fod-list-users.ps1

This file was deleted.

66 changes: 0 additions & 66 deletions bin/fortify-fod.ps1

This file was deleted.

Loading

0 comments on commit 65aa85d

Please sign in to comment.