Skip to content

Commit

Permalink
CI: Split SCA from SAST
Browse files Browse the repository at this point in the history
SCA (dependency scanning) is slow and has little value in change
assurance. This splits it out to be run only as a regular scan against
the code-base.

SAST (CodeQL) is moved into the standard change assurance workflow.
  • Loading branch information
daniel-ac-martin committed Jan 23, 2023
1 parent b6e0568 commit 079693a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 37 deletions.
30 changes: 0 additions & 30 deletions .github/actions/scan-code/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Scan code-base
description: Scans the code-base for credentials and security vulnerabilities
inputs:
token:
description: GitHub token
required: true
runs:
using: composite
steps:
Expand All @@ -13,31 +9,5 @@ runs:
with:
languages: 'javascript'

- name: Cache vdb
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/vdb
key: vdb-os_${{ runner.os }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

- name: Scan
uses: ShiftLeftSecurity/scan-action@master
env:
DISABLE_TELEMETRY: 'true'
ENABLE_OSS_RISK: 'true'
FETCH_LICENSE: 'true'
VDB_HOME: ${{ github.workspace }}/vdb
WORKSPACE: https://github.com/${{ github.repository }}/blob/${{ github.sha }}
GITHUB_TOKEN: ${{ inputs.token }}
with:
type: json,yaml,serverless,dockerfile,kubernetes,depscan,bom
output: reports

- name: Upload scan reports
uses: actions/upload-artifact@master
with:
name: slscan-reports
path: reports
35 changes: 35 additions & 0 deletions .github/actions/scan-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Scan dependencies
description: Scans the dependencies for known security vulnerabilities
inputs:
token:
description: GitHub token
required: true
runs:
using: composite
steps:

- name: Cache vdb
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/vdb
key: vdb-os_${{ runner.os }}

- name: Scan
uses: ShiftLeftSecurity/scan-action@master
env:
DISABLE_TELEMETRY: 'true'
ENABLE_OSS_RISK: 'true'
FETCH_LICENSE: 'true'
VDB_HOME: ${{ github.workspace }}/vdb
WORKSPACE: https://github.com/${{ github.repository }}/blob/${{ github.sha }}
GITHUB_TOKEN: ${{ inputs.token }}
with:
type: json,yaml,serverless,dockerfile,kubernetes,depscan,bom
output: reports

- name: Upload scan reports
uses: actions/upload-artifact@master
with:
name: slscan-reports
path: reports
15 changes: 15 additions & 0 deletions .github/workflows/change-assurance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ name: Change assurance
on:
pull_request:
jobs:
analyse:
name: Analyse
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:

- name: Checkout repository
uses: actions/checkout@v3

- name: Scan code-base
uses: ./.github/actions/scan-code

common:
name: Dependencies, Unit tests
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: 'Analysis'
name: 'Static Security Analysis'
on:
pull_request:
branches: [ 'master' ]
schedule:
- cron: '35 1 * * 2'
jobs:
Expand All @@ -18,12 +16,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Scan code-base
uses: ./.github/actions/scan-code

- name: Setup
uses: ./.github/actions/setup
with:
node: 16

- name: Scan code-base
uses: ./.github/actions/scan-code
- name: Scan dependencies
uses: ./.github/actions/scan-dependencies
with:
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/update-built-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
with:
node: 16

- name: Scan code-base
uses: ./.github/actions/scan-code
- name: Scan dependencies
uses: ./.github/actions/scan-dependencies
with:
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down

1 comment on commit 079693a

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.