Skip to content

Commit a38e108

Browse files
authored
Merge pull request #224 from microsoft/development
Integration: Merge development into main (v1.10)
2 parents 838880f + e9b390c commit a38e108

111 files changed

Lines changed: 9544 additions & 3374 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-codeql.yaml

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,18 @@ jobs:
5252

5353
- name: Build must-fix driver suite
5454
shell: cmd
55-
run: .\codeql-cli\codeql.cmd query compile --check-only mustfix.qls
55+
run: .\codeql-cli\codeql.cmd query compile --check-only --threads=0 mustfix.qls
5656

5757
- name: Build recommended driver suite
5858
shell: cmd
59-
run: .\codeql-cli\codeql.cmd query compile --check-only recommended.qls
60-
61-
- name: Build CA ported queries
62-
shell: cmd
63-
run: .\codeql-cli\codeql.cmd query compile --check-only ported_driver_ca_checks.qls
59+
run: .\codeql-cli\codeql.cmd query compile --check-only --threads=0 recommended.qls
6460

6561
- name: Build all Windows queries
6662
shell: cmd
67-
run: .\codeql-cli\codeql.cmd query compile --check-only .\src
63+
run: .\codeql-cli\codeql.cmd query compile --check-only --threads=0 .\src
6864

6965
test-query-health:
7066
runs-on: windows-latest
71-
needs: build
7267
permissions:
7368
contents: read
7469
packages: write
@@ -111,13 +106,15 @@ jobs:
111106
- name: Add msbuild to PATH
112107
uses: microsoft/setup-msbuild@v2
113108
- name: Azure Login
109+
if: github.event_name != 'pull_request'
114110
uses: azure/login@v2
115111
with:
116112
client-id: ${{ secrets.AZURE_CLIENT_ID }}
117113
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
118114
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
119115
enable-AzPSSession: true
120116
- name: Download previous results
117+
if: github.event_name != 'pull_request'
121118
uses: azure/powershell@v2
122119
with:
123120
azPSVersion: latest
@@ -127,24 +124,40 @@ jobs:
127124
Get-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Path "detailedfunctiontestresults.xlsx" -Destination $destination -Context $context
128125
- name: Run test script
129126
shell: pwsh
130-
run: python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results -v
127+
run: |
128+
# Run per-test build/analyze in parallel inside the script. Default is
129+
# one worker per logical CPU (--jobs <N>); each worker is isolated to
130+
# its own working/, TestDB/, and AnalysisFiles/<name>.sarif paths.
131+
$pyArgs = @('src\drivers\test\build_create_analyze_test.py', '--codeql_path', '.\codeql-cli\codeql.exe', '--no_build', '-v', '--jobs', "$env:NUMBER_OF_PROCESSORS")
132+
if ("${{ github.event_name }}" -ne "pull_request") {
133+
$pyArgs += '--compare_results'
134+
}
135+
python @pyArgs
131136
- name: Upload result diff
132-
if: ${{ hashFiles('diffdetailedfunctiontestresults.xlsx') != '' }} # Only upload if there are changes
137+
if: github.event_name != 'pull_request' && hashFiles('diffdetailedfunctiontestresults.xlsx') != ''
133138
uses: azure/powershell@v2
134139
with:
135140
azPSVersion: latest
136141
inlineScript: |
137142
Update-AzConfig -DisplayBreakingChangeWarning $false
138143
$context = New-AzStorageContext -StorageAccountName "$env:ACCOUNT_NAME" -UseConnectedAccount -EnableFileBackupRequestIntent
139144
Set-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Source "diffdetailedfunctiontestresults.xlsx" -Path "health-diffdetailedfunctiontestresults.xlsx" -Context $context -Force
140-
exit 1
145+
- name: Fail if result diff detected
146+
if: github.event_name != 'pull_request' && hashFiles('diffdetailedfunctiontestresults.xlsx') != ''
147+
shell: pwsh
148+
run: |
149+
Write-Host "::error::Test results differ from the stored baseline. The diff has been uploaded to Azure Storage as 'health-diffdetailedfunctiontestresults.xlsx'. Please review."
150+
exit 1
141151
142152

143153
test-codeql-latest-vs-current:
144-
# Tests if the latest codeql version produces the same results as the current version.
154+
# Tests if the latest codeql version produces the same results as the current version.
155+
# Runs in parallel with `test-query-health` (no `needs:` dependency) to halve the
156+
# pipeline's wall-clock time. It is independent: it downloads its own (latest)
157+
# CodeQL CLI and runs the same per-test build/analyze cycle. `continue-on-error`
158+
# below means failures here never block the workflow regardless of order.
145159
runs-on: windows-latest
146160
continue-on-error: true # Allow script to return non-zero exit code
147-
needs: [build,test-query-health]
148161
permissions:
149162
contents: read
150163
packages: write
@@ -153,10 +166,6 @@ jobs:
153166
ACCOUNT_NAME: ${{ secrets.ACCOUNT_NAME }}
154167
SHARE_NAME: ${{ secrets.SHARE_NAME }}
155168
steps:
156-
- name: Check Prev Job
157-
if: ${{ needs.test-query-health.result == 'failure' }}
158-
shell: pwsh
159-
run: exit 1
160169
- name: Enable long git paths
161170
shell: cmd
162171
run: git config --global core.longpaths true
@@ -194,13 +203,15 @@ jobs:
194203
- name: Add msbuild to PATH
195204
uses: microsoft/setup-msbuild@v2
196205
- name: Azure Login
206+
if: github.event_name != 'pull_request'
197207
uses: azure/login@v2
198208
with:
199209
client-id: ${{ secrets.AZURE_CLIENT_ID }}
200210
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
201211
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
202212
enable-AzPSSession: true
203213
- name: Download previous results
214+
if: github.event_name != 'pull_request'
204215
uses: azure/powershell@v2
205216
with:
206217
azPSVersion: latest
@@ -210,16 +221,29 @@ jobs:
210221
Get-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Path "detailedfunctiontestresults.xlsx" -Destination $destination -Context $context
211222
- name: Run test script
212223
shell: pwsh
213-
run: python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results -v
224+
run: |
225+
# Run per-test build/analyze in parallel inside the script. Default is
226+
# one worker per logical CPU (--jobs <N>); each worker is isolated to
227+
# its own working/, TestDB/, and AnalysisFiles/<name>.sarif paths.
228+
$pyArgs = @('src\drivers\test\build_create_analyze_test.py', '--codeql_path', '.\codeql-cli\codeql.exe', '--no_build', '-v', '--jobs', "$env:NUMBER_OF_PROCESSORS")
229+
if ("${{ github.event_name }}" -ne "pull_request") {
230+
$pyArgs += '--compare_results'
231+
}
232+
python @pyArgs
214233
- name: Upload result diff
215-
if: ${{ hashFiles('diffdetailedfunctiontestresults.xlsx') != '' }} # Only upload if there are changes
234+
if: github.event_name != 'pull_request' && hashFiles('diffdetailedfunctiontestresults.xlsx') != ''
216235
uses: azure/powershell@v2
217236
with:
218237
azPSVersion: latest
219238
inlineScript: |
220239
$context = New-AzStorageContext -StorageAccountName "$env:ACCOUNT_NAME" -UseConnectedAccount -EnableFileBackupRequestIntent
221240
Set-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Source "diffdetailedfunctiontestresults.xlsx" -Path "version-diffdetailedfunctiontestresults.xlsx" -Context $context -Force
222-
exit 1
241+
- name: Fail if result diff detected
242+
if: github.event_name != 'pull_request' && hashFiles('diffdetailedfunctiontestresults.xlsx') != ''
243+
shell: pwsh
244+
run: |
245+
Write-Host "::error::Test results from latest CodeQL version differ from the stored baseline. The diff has been uploaded to Azure Storage as 'version-diffdetailedfunctiontestresults.xlsx'. Please review."
246+
exit 1
223247
- name: Save Latest Version
224248
if: ${{ hashFiles('diffdetailedfunctiontestresults.xlsx') == '' }} # Only if there were no differences
225249
uses: actions/upload-artifact@v4
@@ -230,7 +254,13 @@ jobs:
230254
231255
test-pack-version-update:
232256
runs-on: windows-latest
233-
needs: build
257+
# Only enforce qlpack version bumps when the change is actually heading to
258+
# `main`. We routinely stage many commits in `development` and bump the
259+
# qlpack version once when promoting to `main`, so requiring a bump on
260+
# every `development`-targeted PR/push is noise.
261+
if: |
262+
(github.event_name == 'pull_request' && github.base_ref == 'main') ||
263+
(github.event_name != 'pull_request' && github.ref == 'refs/heads/main')
234264
permissions:
235265
contents: read
236266
packages: write
@@ -272,7 +302,6 @@ jobs:
272302
}
273303
test-create-dvl:
274304
runs-on: windows-latest
275-
needs: build
276305
permissions:
277306
contents: read
278307
packages: write
@@ -319,7 +348,19 @@ jobs:
319348
publish:
320349
runs-on: windows-latest
321350
continue-on-error: true
322-
needs: [build, test-pack-version-update, test-query-health]
351+
needs: [build, test-pack-version-update, test-query-health, test-codeql-latest-vs-current, test-create-dvl]
352+
# Run when all required gates pass. `test-pack-version-update` is skipped
353+
# for non-`main` targets (see its `if:` above), so allow `success` *or*
354+
# `skipped`. `test-codeql-latest-vs-current` is `continue-on-error: true`,
355+
# which already produces a `success` result for `needs`, so we don't need
356+
# special handling for it here -- listing it in `needs` just makes publish
357+
# wait for it to finish before running.
358+
if: |
359+
always() &&
360+
needs.build.result == 'success' &&
361+
needs.test-query-health.result == 'success' &&
362+
needs.test-create-dvl.result == 'success' &&
363+
(needs.test-pack-version-update.result == 'success' || needs.test-pack-version-update.result == 'skipped')
323364
permissions:
324365
contents: read
325366
packages: write

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
# Change Log
33
All notable changes to this project will be documented in this file.
44

5+
## [1.10.0] - 2026-05-12
6+
7+
### Added
8+
- Added the following recommended rules to our Microsoft subfolder. These rules are *not* part of our must-run set at this time.
9+
- NonConstantFormat.ql: Detects printf-like function calls where the format string argument does not originate from a string literal, which could lead to format string vulnerabilities.
10+
- ImproperNullTermination.ql: Detects uses of strings that may not be null-terminated being passed to string functions, which can cause buffer overflows or over-reads.
11+
- StrncpyFlippedArgs.ql: Detects calls to strncpy where the size argument is based on the source buffer size instead of the destination, potentially causing buffer overflows.
12+
- UnsafeUseOfStrcat.ql: Detects uses of strcat where the source string size is not checked before concatenation, which may result in buffer overflow.
13+
- ArithmeticUncontrolled.ql: Detects arithmetic operations on data from random number generators that lack validation, potentially causing integer overflows.
14+
- ArithmeticWithExtremeValues.ql: Detects arithmetic operations on variables assigned extreme values (INT_MAX, INT_MIN, etc.) that could cause overflow or underflow.
15+
16+
### Fixed
17+
- Reduced false positive rate for InvalidFunctionClassTypedef.ql, IrqlAnnotationIssue.ql, IrqlTooHigh.ql, IrqlTooLow.ql, IllegalFieldAccess2.ql, OpaqueMdlUse.ql, OpaqueMdlWrite.ql, and UnguardedNullReturnDereference.ql. Thanks to zx2c4 for the contribution.
18+
- Significantly improved performance for DriverAlertSuppression.ql and MultiplePagedCode.ql.
19+
- Moderately improved performance and further reduced false positive rate for all IRQL queries.
20+
521
## [1.9.0] - 2026-02-27
622

723
### Added

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ This repository contains open-source components for supplemental use in developi
1010
When using the precompiled pack, please use the most recent CodeQL CLI version listed above.
1111

1212
### For WHCP Use (26H1)
13+
14+
Either of the options in the below table is accepted for 26H1. Please note that using the 1.10 windows-drivers pack provides improved accuracy and performance for several rules; see [CHANGELOG.md](./CHANGELOG.md).
15+
1316
| CodeQL CLI Version | microsoft/windows-drivers CodeQL Pack Version | microsoft/cpp-queries CodeQL Pack Version | Associated Repo Branch|
1417
|--------------------------|------------------------------------------|-------------------------------|-----------------------------|
18+
| 2.25.5 | [1.10.0](https://github.com/microsoft/Windows-Driver-Developer-Supplemental-Tools/pkgs/container/windows-drivers/900152685?tag=1.10.0) | 0.0.5 | Main |
1519
| 2.24.1 | [1.8.2](https://github.com/microsoft/Windows-Driver-Developer-Supplemental-Tools/pkgs/container/windows-drivers/655126590?tag=1.8.2) | 0.0.4 | Main |
1620

1721
See appendix for information on CLI+query version combinations for previous Windows releases and WHCP programs.

0 commit comments

Comments
 (0)