RI Development to main #175
Conversation
* Update build-codeql.yaml test codeql action Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml manual download Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml add back yest of build step Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml try all jobs Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml test all jobs Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml dvl tests Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Add files via upload Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Create readme Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * restructure * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * add test projects * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update dvl_tests.ps1 Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * update build_create_analyze_test.py to fail when different results are found * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * change when results get uploaded * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * fix exit code * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * update to use driver_snippet.c instead of other driver projects * add template path variable * fix path * fix path * test * fix template path * test * update template project to have arm configuration * fix msbuild command * fix driver_snippet.c * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * print results location * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * fix sarif copy and compare sarif results * add expected sarif results * Delete src/drivers/test/dvl_tests/readme Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * test secret condition without deleting secret Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml change condition back Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml test env Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml test env Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml fail test-codeql-latest-vs-current if prev job fails Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * Update build-codeql.yaml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
…cts (#110) * init commit * moved files around added the snippets * I think this fixes the build * update the WFP library to be more robust. Driver_snippets still need some edits * Update the ID path * fixes build issue * attempt 2 * forgot () added them * fix spelling * updated ID path and hopefully fixed the last compile error * I had another typo, this should fix it * changes the id property * lowercase letters * synced the forked made name change to one query * other name edit --------- Co-authored-by: Elaine Houha <elhouha@microsoft.com>
This reverts commit c282407.
* WIP C28129 * C28129 * add sarif file and update diff file * update id and move out of experimental * add query to ported ca checks suite --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* C28133 * add query to ported ca checks suite --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* codeql port of c28151 * Update IrqlIllegalValue.ql Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
codeql port of C28730
Port of C28162
* WIP C28161 * port of C28161 * move from kmdf to wdm * remove old files
* port of C28132 * update to remove false positives
* port of C28716 * add other bool types
* port of C29715 * add other bool types
* port of C28714 * improve query * add other bool types * update name
* C28101 * add query to ported ca checks suite * specifically check for driver_initialize --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* codeql port of C28165 * update query to also work with typedef types and _use_decl_annotations_ * update sarif
* WIP FloatHardwareStateProtection * FloatHardwareStateProtection.ql TODO test on samples * add more control flow * add query to ported ca checks suite * move from kmdf to wdm. add sarif file. * fix output message * resolve todos
* C28131 * updates to ql * update id and move out of experimental * add query to ported ca checks suite * update to also check for local pointers to structs --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* port of C28114, Copying a whole IRP stack entry * update unit tests * fix ql name * update id and move out of experimental * add query to ported ca checks suite * fix sarif file --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* WIP driver isolation * WIP driver isolation. add zw* using non-null rootdirectory * add flow config for OK open reg key functions? * query finds Zw* isolation function use where OBJECT_ATTRIBUTES has non-null RootDirectory AND the RootDirectory didn't come from allowed function * WIP null rootdir * WIP null rootdir * WIP split into read/write accesses * Preliminary query * fix zwRead and zwWrite predicates * fix null root dir * bug fixes and add test cases * query improvements and tests * flow update * add tests and small query improvements * add exceptions * add extra barriers to flow * refactor query and fix barriers in dataflow * update qhelp files and queries and tests * fix comment * query improvements * WIP query updates * bug fixes and improvements * fix exception for SERIALCOMM to also match as prefix * allow handles that are relative to handles obtained from approved ddi * add recursive check for allowed handle source * change @kind from path-problem for debugging to problem * update select message * update zw violation 2 * small fix * add allowed handle source to driverisolation.qll and zwviolation2. update zwViolation1 to use lib * improve query * query updates * update query to remove potential true results * WIP wdf isolation * move isolation queries to experimental * update config file * Update codeql-config.yml Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com> * remove wdf WIP query for dev * update version of qlpack * update driver_snippet --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* Suite updates to add additional queries * update windows_driver_mustfix.qls * update readme * qlpack version update * update query packs * update github action * update query suites with missing query * update version * sort query suites * add missing queries * Fix opaqueid fields. For some reason opaque-id causes issues with sarif reader. * fix changed file
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* Revert must-fix to current requirements. Make recommended contain what next mustfix will. Make mustrun suite. * update version * remove old suite files * update dependency versions. update dvl_tests.ps1 for changed mustfix suite name * fix version number in suites * update qlpack version
* Revert must-fix to current requirements. Make recommended contain what next mustfix will. Make mustrun suite. * update version * remove old suite files * Updating documentation for new version * update dependency versions. update dvl_tests.ps1 for changed mustfix suite name * fix version number in suites * update qlpack version * update readme * update qlpack dependency versions --------- Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces several new query implementations, updates to query documentation, and modifications to the CodeQL configuration and workflow. Key changes include new and updated CodeQL queries for driver entry buffer handling, current function type correctness, annotation syntax checking, and an experimental check for unsafe calls in global initializers; dependency updates in codeql-pack.lock.yml; and significant refinements in the GitHub Actions workflows.
Reviewed Changes
Copilot reviewed 302 out of 302 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/drivers/general/queries/DriverEntrySaveBuffer/driver_snippet.c | Added multiple DriverEntry functions with variations in how RegistryPath is saved, triggering CodeQL rule warnings |
| src/drivers/general/queries/AnnotationSyntax/driver_snippet.c | Introduced test cases for various annotation scenarios, including cases with out-of-range dispatch type values |
| Other files (SARIF, .ql, .qhelp, workflows, README.md, config files) | Updated or added new CodeQL queries, documentation, and dependency & workflow configuration changes |
| PUNICODE_STRING RegistryPath | ||
| ) | ||
| { | ||
| g_RP3 = *RegistryPath; |
There was a problem hiding this comment.
Assigning the dereferenced RegistryPath directly may not perform a proper copy of the buffer. Consider using a dedicated string copy function like RtlUnicodeStringCopy to ensure that the contents are safely duplicated before the I/O Manager frees the original buffer.
| g_RP3 = *RegistryPath; | |
| RtlUnicodeStringCopy(&g_RP3, RegistryPath); |
| } | ||
|
|
||
| // out of range | ||
| __drv_dispatchType(65) |
There was a problem hiding this comment.
The value 65 used in __drv_dispatchType is outside the allowed range (-1 to 63). Updating this value to a valid number is recommended to prevent annotation-related errors.
| __drv_dispatchType(65) | |
| __drv_dispatchType(0) |
|
@jacob-ronstadt I asked Copilot to summarize the changes in this RI (see below). It's missing some obvious things (like all the queries that have been added) that got caught in the above summary, but it's got some things that that summary missed too. Between these two comments do we have good coverage of everything in this RI? This pull request introduces significant updates to the CodeQL workflow and documentation for Windows driver development. Key changes include improvements to the Workflow UpdatesCodeQL Automation Enhancements:
Testing Improvements:
Documentation UpdatesCodeQL Usage Clarity:
|
|
@NateD-MSFT Copilot doesn't seem to work with *.ql files. Most of the changes are additional queries. There are also codeql library improvements and additions, new test templates, workflow improvements, and qlpack updates. |
Signed-off-by: Jacob Ronstadt <147542405+jacob-ronstadt@users.noreply.github.com>
* fixing azure file upload * testing * fix pack version check * only compare detailed results * bug fix * use more threads with codeql * save latest version if the results are the same * testing * add manual publish workflow
* suppress breaking change warning. NA because we don't get the output from set-azstoragefilecontent * move float safe/unsafe queries to kmdf folder and fix output strings * move float safe/unsafe queries to kmdf folder and fix output strings
* Improve replacement recommendations in ExtendedDeprecatedApis * Bump query version
This reverts commit d853571.
Checklist for Pull Requests
@versioncomment in the file header.codeql database createandcodeql database analyzehave completed successfully.