-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b14bbf
commit 1a2b93f
Showing
3 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Security Scan | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
schedule: | ||
- cron: '0 12 * * *' # each day at lunch time | ||
|
||
jobs: | ||
security-scan: | ||
name: Security Scan | ||
|
||
runs-on: ubuntu-latest | ||
|
||
continue-on-error: false | ||
|
||
strategy: | ||
matrix: | ||
branch-name: | ||
- 'release/8.0' | ||
- 'release/8.1' | ||
- 'release/8.2' | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ matrix.branch-name }} | ||
- name: "PHP_VERSION Env" | ||
run: echo "PHP_VERSION=`grep "ARG PHP_VERSION" Dockerfile | cut -f 2 -d '"'`" > GITHUB_ENV | ||
- name: "BRANCH_SHA Env" | ||
run: echo "BRANCH_SHA=`git rev-parse HEAD" >> GITHUB_ENV | ||
|
||
- name: Run Alpine Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: endava/php:${{ env.PHP_VERSION }} | ||
format: 'table' | ||
exit-code: '0' # we don't break the build if vulnerabilities are included! | ||
ignore-unfixed: true | ||
vuln-type: 'os,library' | ||
severity: 'CRITICAL,HIGH' | ||
|
||
- if: contains(github.ref, 'refs/heads/release/') | ||
name: Run Alpine Trivy vulnerability scanner and upload to github security tab | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: endava/php:${{ env.PHP_VERSION }} | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
|
||
- if: contains(github.ref, 'refs/heads/release/') | ||
name: Upload Alpine Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
ref: refs/heads/${{ matrix.branch-name }} | ||
sha: ${{ env.BRANCH_SHA }} | ||
sarif_file: 'trivy-results.sarif' |
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
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