From 030bf8a68f2e640d5ca5240b20808d948972a003 Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:39:20 -0600 Subject: [PATCH] Improve CodeQL workflow with SARIF filtering Adds SARIF filtering for Go analysis to exclude third-party code from results and updates the workflow to upload filtered SARIF files. This enhances the accuracy of security reports by ignoring irrelevant files. --- .github/workflows/codeql.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 06d9bc81f..f30257878 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,12 +38,25 @@ jobs: with: languages: ${{ matrix.language }} queries: security-and-quality - config: | - paths-ignore: - - 'third-party/**' - - 'third-party-licenses.*.md' - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: category: "/language:${{ matrix.language }}" + upload: false + output: sarif-results + + - name: Filter SARIF for third-party code + if: matrix.language == 'go' + uses: advanced-security/filter-sarif@bc96d9fb9338c5b48cc440b1b4d0a350b26a20db # v1.0.0 + with: + patterns: | + -third-party/** + input: sarif-results/${{ matrix.language }}.sarif + output: sarif-results/${{ matrix.language }}.sarif + + - name: Upload filtered SARIF + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: sarif-results/${{ matrix.language }}.sarif + category: "/language:${{ matrix.language }}"