From 2b515486a11307c7bc5aefdb4be231dddd3c82d1 Mon Sep 17 00:00:00 2001 From: Zhiwei Liang Date: Tue, 10 Dec 2024 00:57:51 -0500 Subject: [PATCH] Add advanced CodeQL and dependencies review workflows --- .github/workflows/codeql.yml | 46 +++++++++++++++++++ .../{gosec_pr.yml => security_pr.yml} | 15 +++++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codeql.yml rename .github/workflows/{gosec_pr.yml => security_pr.yml} (54%) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..06c9cab3f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +name: "CodeQL Advanced" + +on: + push: + branches: [ "dev", "main", "proj/*" ] + pull_request: + branches: [ "dev", "main", "proj/*" ] + schedule: + - cron: '39 0 * * 6' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: go + build-mode: autobuild + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-and-quality + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/gosec_pr.yml b/.github/workflows/security_pr.yml similarity index 54% rename from .github/workflows/gosec_pr.yml rename to .github/workflows/security_pr.yml index 64e63dff0..fcd8e2f69 100644 --- a/.github/workflows/gosec_pr.yml +++ b/.github/workflows/security_pr.yml @@ -1,8 +1,21 @@ -name: Gosec Scan +name: Security Checks for Pull Requests on: pull_request: null jobs: + dependency-review: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: 'Checkout repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 + with: + comment-summary-in-pr: on-failure + gosec_scan: runs-on: ubuntu-latest env: