Skip to content

Merge branch next and update CodeQL to v2.23.9 - #1154

Open
mbaluda wants to merge 116 commits into
mainfrom
mbaluda-next-merge
Open

Merge branch next and update CodeQL to v2.23.9#1154
mbaluda wants to merge 116 commits into
mainfrom
mbaluda-next-merge

Conversation

@mbaluda

@mbaluda mbaluda commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Description

Upgrades codeql/cpp-all and related CodeQL dependencies, migrating queries and shared libraries off the deprecated semmle.code.cpp.dataflow.DataFlow/TaintTracking modules and codingstandards.cpp.Concurrency onto their new/ConcurrencyNew replacements. This is a mechanical, repo-wide migration touching ~90 rules; most changes are import swaps only, with dataflow-node API updates (asIndirectExpr(), asDefiningArgument(), isBarrierIn, etc.) where required by the new library.

Four regressions were found and fixed, with matching test coverage:

  1. RULE-1-2: false negative for _Decimal32/_Decimal64/_Decimal128 compiler-extension detection.
  2. ENV30-C / RULE-21-19 / RULE-25-5-2 (ConstLikeReturnValue shared query): duplicate alert on the same pointer write.
  3. INT31-C: false positive on the standard-permitted (time_t)-1 conversion.
  4. RULE-14-3: false negative where an always-false compound loop condition (e.g. 1 == 0 && p1 > 12) was incorrectly treated as a permitted literal-0 exception.

Modified rules:

  • Behavior changes verified by tests): RULE-1-2, ENV30-C, RULE-21-19, RULE-25-5-2, INT31-C, RULE-14-3
  • Sataflow-API-only adaptations (no result change): ARR39-C, CON30-C, CON34-C, EXP16-C, EXP37-C, FIO44-C, MSC33-C, RULE-17-5, RULE-21-14, A15-2-2, A20-8-4, A5-1-7, M9-3-1, CTR55-CPP, MEM52-CPP.
  • Further rules received import-only changes with no logic or result impact.

These updates include changes from the next branch to maintain compatibility with the evolving CodeQL ecosystem.

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • RULE-1-2
    • ENV30-C
    • RULE-21-19
    • RULE-25-5-2
    • INT31-C
    • RULE-14-3

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

jketema and others added 30 commits June 30, 2026 12:35
Observe that `sizeof(...)` might not occur as a dataflow node if it has a
parent node with a concrete value. That value will be a dataflow node instead.
Hence, the query has be changed to check for expressions where `sizeof(...)`
is a child of an expression with a concrete value.
Note that we now properly report the offending cast instead of the expression
that is being cast.
As it is the dataflow used by `asctime` that is relevant, and not the pointer,
use the indirect expression.
Since the new dataflow library uses use-use dataflow and not def-use dataflow,
we now need to check for definitions. Note that these queries can probably be
improved by using a dataflow configuration - possibly limited to the local
context of a function by including `DataFlow::FeatureEqualSourceSinkCallContext`
…ataflow library"

This reverts commit b18c7b4. This change broke some
tests.
@codeql-coding-standards-automation

Copy link
Copy Markdown

🏁 Beep Boop! One or things failed during performance testing. Please check the release engineering repo for details.

GitHub Advanced Security started work on behalf of mbaluda June 30, 2026 17:59 View session
GitHub Advanced Security finished work on behalf of mbaluda June 30, 2026 18:00
GitHub Advanced Security started work on behalf of mbaluda June 30, 2026 18:15 View session
GitHub Advanced Security finished work on behalf of mbaluda June 30, 2026 18:16
@mbaluda
mbaluda force-pushed the mbaluda-next-merge branch from b5970a4 to d66ec8d Compare August 17, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 245/245 changed files
  • Comments generated: 10
  • Review effort level: Balanced

Comment thread c/cert/test/rules/SIG30-C/CallOnlyAsyncSafeFunctionsWithinSignalHandlers.expected Outdated
Comment thread c/common/src/codingstandards/c/Extensions.qll Outdated
Comment thread cpp/common/test/rules/unusedtypedeclarations/test.cpp Outdated
Comment thread c/cert/test/rules/INT31-C/test.c Outdated
Comment thread supported_codeql_configs.json
Comment thread cpp/common/src/codingstandards/cpp/ConcurrencyNew.qll
Comment thread c/misra/test/rules/RULE-14-3/test.c Outdated
Co-authored-by: mbaluda <5237080+mbaluda@users.noreply.github.com>
@MichaelRFairhurst

Copy link
Copy Markdown
Collaborator

/test-performance

@github-actions

Copy link
Copy Markdown

🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute.

💡 If you do not hear back from me please check my status! I will report even if I fail!

@mbaluda mbaluda changed the title Merge branch next and update CodeQL Merge branch next and update CodeQL to v2.23.9 Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants