Skip to content

Bump github/codeql-action/analyze from 4.37.4 to 4.37.6 #526

Bump github/codeql-action/analyze from 4.37.4 to 4.37.6

Bump github/codeql-action/analyze from 4.37.4 to 4.37.6 #526

Workflow file for this run

# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '24 4 * * 1'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || '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: csharp
# manual build (see the step below): ONE TFM is enough for analysis, where autobuild would
# compile all of net11+net10+net8 plus the netstandard2.0 "lite" variants under the CodeQL
# tracer for no additional coverage
build-mode: manual
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install .NET SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: 11.0.x
dotnet-quality: 'preview'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Single-TFM build for the CodeQL tracer: the extractor sees every compiler invocation, and every
# project already targets net10.0, so building ONLY net10.0 (and skipping the netstandard2.0
# "lite" variants) analyzes the same code - source generators included - in a fraction of the
# time. The finer-grained version properties are passed (instead of CoreSdkVersions) because
# global properties are immutable: this stays deterministic even if a parent repo overrides the
# defaults. Bump net10.0 to net11.0 once .NET 11 is out of preview.
- if: matrix.build-mode == 'manual'
name: Build (single TFM for analysis)
shell: bash
run: |
dotnet restore -p:CoreSdkRuntimeVersions=net10.0 -p:CloudSdkRuntimeVersions=net10.0 -p:CoreSdkNetStandardEnabled=false
dotnet build --no-restore -nowarn:CS1591 -p:CoreSdkRuntimeVersions=net10.0 -p:CloudSdkRuntimeVersions=net10.0 -p:CoreSdkNetStandardEnabled=false
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
category: "/language:${{matrix.language}}"
upload: false
output: sarif-results
# Test code is still compiled and analyzed (it is real code), but findings located in it are
# filtered out before upload: security alerts on test fixtures (fake cookies over the virtual
# network, dummy credentials, throwaway certificates) are noise by construction, and every test
# project follows the *.Tests naming convention. Results filtered out here auto-close their
# existing alerts on the next scan, and dismissals are never needed for this class again.
- name: Filter test projects out of the results
uses: advanced-security/filter-sarif@2da736ff05ef065cb2894ac6892e47b5eac2c3c0 # v1.1
with:
patterns: |
-**/*.Tests/**
input: sarif-results/${{ matrix.language }}.sarif
output: sarif-results/${{ matrix.language }}.sarif
- name: Upload filtered results
uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
category: "/language:${{matrix.language}}"