-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (83 loc) · 2.75 KB
/
Copy pathsecurity-codeql.yml
File metadata and controls
95 lines (83 loc) · 2.75 KB
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
# =============================================================================
# CODEQL SECURITY ANALYSIS
# =============================================================================
# Description: Analyze C/C++ source code for security vulnerabilities using GitHub CodeQL.
#
# Copyright (c) 2026 Dayron Mustelier (@DMsuDev)
# Licensed under the Apache License, Version 2.0.
# =============================================================================
name: CodeQL Security Analysis
on:
push:
branches: [main]
paths:
- "src/**"
- "include/**"
- "examples/**"
- "cmake/**"
- "CMakeLists.txt"
- "CMakePresets.json"
- ".github/workflows/security-codeql.yml"
pull_request:
branches: [main]
paths:
- "src/**"
- "include/**"
- "examples/**"
- "cmake/**"
- "CMakeLists.txt"
- "CMakePresets.json"
- ".github/workflows/security-codeql.yml"
workflow_dispatch:
permissions:
contents: read # Read-only access to repository contents
security-events: write # Allow upload of CodeQL analysis results to GitHub Security.
actions: read # Read-only access to GitHub Actions workflow files and logs.
jobs:
analyze:
name: CodeQL Analysis (C/C++)
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
CC: gcc-14
CXX: g++-14
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
- name: Install system dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends \
ninja-build \
libx11-dev libxrandr-dev libxinerama-dev \
libxcursor-dev libxi-dev libgl1-mesa-dev \
libglu1-mesa-dev libwayland-dev libxkbcommon-dev \
pkg-config
- name: Initialize CodeQL
uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
with:
languages: c-cpp
build-mode: none
# security-extended: security alerts only, without code quality noise
queries: security-extended
config: |
paths:
- src
- include
- examples
paths-ignore:
- build
- third_party
- docs
- tools
- name: Configure CMake
run: cmake --preset release
- name: Build for analysis
run: cmake --build --preset release --parallel
# Upload SARIF results to GitHub Security.
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
with:
category: "/language:c-cpp"
upload: always