From cb6476b25b1f00b1a56a2095db0c513f4ed8129d Mon Sep 17 00:00:00 2001 From: adityajoshi12 Date: Sat, 8 Oct 2022 00:31:04 +0530 Subject: [PATCH] CI: code analysis and vulnerability check Signed-off-by: adityajoshi12 --- .github/dependabot.yml | 11 +++++++++++ .github/workflows/codeql.yml | 38 ++++++++++++++++++++++++++++++++++++ .github/workflows/scan.yml | 29 +++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/scan.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..90e05c40 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..bd8ef29f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,38 @@ +name: "Code Scanning - Analysis" + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + CodeQL-Build: + runs-on: ubuntu-latest + + permissions: + security-events: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'adopt-openj9' + java-version: '11' + check-latest: true + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: java + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml new file mode 100644 index 00000000..8e554d45 --- /dev/null +++ b/.github/workflows/scan.yml @@ -0,0 +1,29 @@ +name: "Code Scan - Security" +on: + pull_request: + branches: + - main + push: + branches: + - main +jobs: + build: + name: Build + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif'