CodeQL #49
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
name: "CodeQL" | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: '35 2 * * 0' | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
analyze: | |
name: Analyze (${{ matrix.language }}) | |
runs-on: ubuntu-22.04 | |
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | |
permissions: | |
# required for all workflows | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- language: c-cpp | |
build-mode: manual | |
sarif-name: cpp | |
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
build-mode: ${{ matrix.build-mode }} | |
config-file: ./.github/codeql/codeql-config.yml | |
# 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. | |
# If the analyze step fails for one of the languages you are analyzing with | |
# "We were unable to automatically build your code", modify the matrix above | |
# to set the build mode to "manual" for that language. Then modify this step | |
# to build your code. | |
# ℹ️ Command-line programs to run using the OS shell. | |
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | |
- name: Build | |
if: matrix.build-mode == 'manual' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libcurl4-openssl-dev libboost-dev libboost-system-dev libboost-thread-dev | |
QuoteGeneration/download_prebuilt.sh | |
wget -r -l1 -np -nd --accept 'sgx_linux_x64_sdk_*.bin' https://download.01.org/intel-sgx/latest/linux-latest/distro/ubuntu22.04-server/ | |
chmod +x ./sgx_linux_x64_sdk_*.bin | |
./sgx_linux_x64_sdk_*.bin <<< "yes" | |
source ./sgxsdk/environment; make all | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
with: | |
category: "/language:${{matrix.language}}" | |
output: sarif-results | |
upload: failure-only | |
- name: Filter SARIF | |
uses: advanced-security/filter-sarif@v1 | |
with: | |
patterns: | | |
-external/**/* | |
-QuoteVerification/QuoteVerificationService/**/* | |
-QuoteVerification/QVL/**/* | |
-QuoteVerification/sgxssl/**/* | |
input: sarif-results/${{ matrix.sarif-name }}.sarif | |
output: sarif-results/${{ matrix.sarif-name }}.sarif | |
- name: Upload SARIF | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: sarif-results/${{ matrix.sarif-name }}.sarif | |