Skip to content

Commit 9081795

Browse files
author
Brian
committed
Add CodeQL Workflow for Code Security Analysis
Add CodeQL Workflow for Code Security Analysis This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats. We added a new CodeQL workflow file (.github/workflows/codeql.yml) that - Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience). - Runs daily. - Excludes queries with a high false positive rate or low-severity findings. - Does not display results for git submodules, focusing only on our own codebase. Testing: To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code. Deployment: Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps: 1. Under the repository name, click on the Security tab. 2. In the left sidebar, click Code scanning alerts. Additional Information: - You can further customize the workflow to adapt to your specific needs by modifying the workflow file. - For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/). Signed-off-by: Brian <[email protected]>
1 parent 5c82de9 commit 9081795

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

.github/workflows/codeql.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ name: "CodeQL"
1414
on:
1515
push:
1616
branches: [ "main", "master" ]
17-
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ "main", "master" ]
2017
schedule:
21-
- cron: '28 21 * * 0'
18+
- cron: '0 0 * * *'
19+
pull_request:
20+
branches: '*'
2221

2322
jobs:
2423
analyze:
@@ -103,21 +102,25 @@ jobs:
103102
-**:cpp/suspicious-pointer-scaling
104103
-**:cpp/suspicious-pointer-scaling-void
105104
-**:cpp/unsigned-comparison-zero
106-
-**/third*party/**
107-
-**/3rd*party/**
108-
-**/external/**
105+
-**/cmake*/Modules/**
109106
input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
110107
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
111108

112-
- name: Upload SARIF
109+
- name: Upload CodeQL results to code scanning
113110
uses: github/codeql-action/upload-sarif@v2
114111
with:
115112
sarif_file: ${{ steps.step1.outputs.sarif-output }}
116113
category: "/language:${{matrix.language}}"
117114

118-
- name: Archive CodeQL results
115+
- name: Upload CodeQL results as an artifact
116+
if: success() || failure()
119117
uses: actions/upload-artifact@v3
120118
with:
121119
name: codeql-results
122120
path: ${{ steps.step1.outputs.sarif-output }}
123-
retention-days: 5
121+
retention-days: 5
122+
123+
- name: Fail if an error is found
124+
run: |
125+
./.github/workflows/fail_on_error.py \
126+
${{ steps.step1.outputs.sarif-output }}/cpp.sarif

0 commit comments

Comments
 (0)