forked from DarkFlippers/unleashed-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (103 loc) · 3.76 KB
/
codeql.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# 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"
run-name: "CodeQL Analyze ${{ github.ref_name }} by @${{ github.ACTOR }}"
on:
push:
branches: ["dev"]
workflow_dispatch:
jobs:
analyze:
name: Analyze
# 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
# Consider using larger runners for possible analysis time improvements.
runs-on: [ "ubuntu-latest" ]
timeout-minutes: 60
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["cpp"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
env:
PATH_SARIF_DIR: ".github/results.sarif"
PATH_SARIF_FILE: ".github/results.sarif/${{ matrix.language }}.sarif"
FBT_NO_SYNC: 0
DIST_SUFFIX: "codeql"
WORKFLOW_BRANCH_OR_TAG: release-cfw
LANG_CATEGORY: "/language:${{matrix.language}}"
steps:
- name: Checkout Firmware Files
uses: actions/checkout@v3
with:
clean: "true"
submodules: "true"
fetch-depth: "0"
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
setup-python-dependencies: true
- name: Resolve CodeQL Build Env
uses: github/codeql-action/resolve-environment@v2
with:
language: ${{ matrix.language }}
#debug: true
- name: Build Firmware
shell: bash
if: ${{ success() }}
run: |
./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=${{ env.FBT_NO_SYNC }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
if: ${{ success() }}
with:
threads: 4
category: "${{ env.LANG_CATEGORY }}"
output: "${{ env.PATH_SARIF_DIR }}"
upload-database: false
upload: "failure-only" # disable the upload here - we will upload in a different action
- name: Filter dirs for SARIF
uses: advanced-security/filter-sarif@v1
if: ${{ success() }}
with:
# filter out all test files unless they contain a sql-injection vulnerability
patterns: |
-build/**
-dist/**
-toolchain/**
-lib/**
input: "${{ env.PATH_SARIF_FILE }}"
output: "${{ env.PATH_SARIF_FILE }}"
- name: Upload CodeQL SARIF
uses: github/codeql-action/upload-sarif@v2
if: ${{ success() }}
with:
category: "${{ env.LANG_CATEGORY }}"
sarif_file: "${{ env.PATH_SARIF_FILE }}"
# optional: for debugging the uploaded sarif
# - name: Upload loc as a Build Artifact
# uses: actions/upload-artifact@v3
# with:
# name: sarif-results
# path: sarif-results
# retention-days: 1