Skip to content

Use the new dataflow module without affecting any tested behavior#1142

Open
mbaluda wants to merge 3 commits into
mainfrom
mbaluda-new-dataflow
Open

Use the new dataflow module without affecting any tested behavior#1142
mbaluda wants to merge 3 commits into
mainfrom
mbaluda-new-dataflow

Conversation

@mbaluda

@mbaluda mbaluda commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Updated various QL files to replace deprecated 'DataFlow' and 'TaintTracking' imports with 'new.DataFlow' and 'new.TaintTracking'.
  • Removed warnings related to deprecated modules in test expectations for affected rules.

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 number here

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!)

…est behavior

- Updated various QL files to replace deprecated 'DataFlow' and 'TaintTracking' imports with 'new.DataFlow' and 'new.TaintTracking'.
- Removed warnings related to deprecated modules in test expectations for affected rules.
Copilot AI review requested due to automatic review settings June 18, 2026 19:14
GitHub Advanced Security started work on behalf of mbaluda June 18, 2026 19:15 View session
GitHub Advanced Security finished work on behalf of mbaluda June 18, 2026 19:16

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.

Pull request overview

This PR aims to migrate existing C/C++ CodeQL queries and shared libraries from deprecated semmle.code.cpp.dataflow.{DataFlow,TaintTracking} to semmle.code.cpp.dataflow.new.{DataFlow,TaintTracking}, and to update unit test .expected files by removing deprecation-warning lines so tested behavior remains unchanged.

Changes:

  • Updated many .ql/.qll files to use semmle.code.cpp.dataflow.new.DataFlow / semmle.code.cpp.dataflow.new.TaintTracking.
  • Updated numerous .expected files to drop deprecation warnings from expected outputs.
  • Adjusted some shared libraries’ import graphs (notably iterator/container helpers) to support the migration.

Items not satisfied / uncertain (per project checklist):

  • Some updated .qll/.ql files now reference DataFlow::... / TaintTracking::... without importing the corresponding module, which will break compilation.
  • The EXP50-CPP rule is not fully migrated (still using deprecated modules), and its .expected still asserts deprecation warnings.
  • Reviewer confirmation items in the PR description (VS Code validation + change note confirmation) are unchecked/uncertain.
Show a summary per file
File Description
cpp/misra/src/rules/RULE-0-1-1/UnnecessaryWriteToLocalObject.ql Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/standardlibrary/STLContainers.qll Updates taint/dataflow imports (needs new.DataFlow import restored).
cpp/common/src/codingstandards/cpp/standardlibrary/FileStreams.qll Updates taint/dataflow imports (needs new.DataFlow import restored).
cpp/common/src/codingstandards/cpp/SmartPointers.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/useonlyarrayindexingforpointerarithmetic/UseOnlyArrayIndexingForPointerArithmetic.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/stringnumberconversionmissingerrorcheck/StringNumberConversionMissingErrorCheck.qll Switches to new.TaintTracking import.
cpp/common/src/codingstandards/cpp/rules/predicatefunctionobjectsshouldnotbemutable/PredicateFunctionObjectsShouldNotBeMutable.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/placementnewnotproperlyaligned/PlacementNewNotProperlyAligned.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/nonconstantformat/NonConstantFormat.qll Switches to new.TaintTracking import.
cpp/common/src/codingstandards/cpp/rules/iofstreammissingpositioning/IOFstreamMissingPositioning.qll Switches to new.TaintTracking import.
cpp/common/src/codingstandards/cpp/rules/invalidatedenvstringpointers/InvalidatedEnvStringPointers.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/functionerroneousreturnvaluenottested/FunctionErroneousReturnValueNotTested.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/donotpassaliasedpointertorestrictqualifiedparamshared/DoNotPassAliasedPointerToRestrictQualifiedParamShared.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/danglingcapturewhenmovinglambdaobject/DanglingCaptureWhenMovingLambdaObject.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/containeraccesswithoutrangecheck/ContainerAccessWithoutRangeCheck.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/rules/basicstringmaynotbenullterminated/BasicStringMayNotBeNullTerminated.qll Removes DataFlow import but still uses deprecated dataflow APIs (needs new.{DataFlow,TaintTracking}).
cpp/common/src/codingstandards/cpp/rules/accessofundefinedmemberthroughuninitializedstaticpointer/AccessOfUndefinedMemberThroughUninitializedStaticPointer.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/ReadErrorsAndEOF.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/Overflow.qll Import change (currently still deprecated + missing explicit new.DataFlow).
cpp/common/src/codingstandards/cpp/OutOfBounds.qll Removes DataFlow import (needs private import ...new.DataFlow).
cpp/common/src/codingstandards/cpp/Iterators.qll Removes DataFlow import (needs private import ...new.DataFlow).
cpp/common/src/codingstandards/cpp/FgetsErrorManagement.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/Expr.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/ConstHelpers.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/Allocations.qll Switches to new.DataFlow import.
cpp/common/src/codingstandards/cpp/AccessPath.qll Switches to new.DataFlow import.
cpp/cert/test/rules/MSC51-CPP/BadlySeededRandomNumberGenerator.expected Removes deprecated-module warnings from expected output.
cpp/cert/test/rules/MEM52-CPP/DetectAndHandleMemoryAllocationErrors.expected Removes deprecated-module warnings from expected output.
cpp/cert/test/rules/EXP50-CPP/DoNotDependOnTheOrderOfEvaluationForSideEffectsInFunctionCallsAsFunctionArguments.expected Still asserts deprecation warnings (should be removed if query is migrated).
cpp/cert/test/rules/CTR53-CPP/UseValidIteratorRanges.expected Removes deprecated-module warnings from expected output.
cpp/cert/test/rules/CTR52-CPP/GuaranteeGenericCppLibraryFunctionsDoNotOverflow.expected Removes deprecated-module warnings from expected output.
cpp/cert/src/rules/MSC51-CPP/BadlySeededRandomNumberGenerator.ql Switches to new.TaintTracking import.
cpp/cert/src/rules/MEM52-CPP/DetectAndHandleMemoryAllocationErrors.ql Switches to new.DataFlow import.
cpp/cert/src/rules/EXP50-CPP/DoNotDependOnTheOrderOfEvaluationForSideEffectsInFunctionCallsAsFunctionArguments.ql Drops DataFlow import but still uses deprecated TaintTracking (needs new.{DataFlow,TaintTracking}).
cpp/cert/src/rules/CTR53-CPP/UseValidIteratorRanges.ql Switches to new.DataFlow import.
cpp/cert/src/rules/CTR52-CPP/GuaranteeGenericCppLibraryFunctionsDoNotOverflow.ql Switches to new.TaintTracking import.
cpp/autosar/test/rules/M3-9-3/UnderlyingBitRepresentationsOfFloatingPointValuesUsed.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A9-3-1/ReturnsNonConstRawPointersOrReferencesToPrivateOrProtectedData.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A8-4-12/UniquePtrPassedToFunctionWithImproperSemantics.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A8-4-11/SmartPointerAsParameterWithoutLifetimeSemantics.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A7-5-1/InvalidFunctionReturnType.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A5-1-7/LambdaPassedToDecltype.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A27-0-4/CStyleStringsUsed.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A15-1-3/ThrownExceptionsShouldBeUnique.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A13-2-1/AssignmentOperatorReturnThis.expected Removes deprecated-module warnings from expected output.
cpp/autosar/test/rules/A13-1-3/UserDefinedLiteralsOperatorsShallOnlyPerformConversionOfPassedParameters.expected Removes deprecated-module warnings from expected output.
cpp/autosar/src/rules/M5-0-17/PointerSubtractionOnDifferentArrays.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/M3-9-3/UnderlyingBitRepresentationsOfFloatingPointValuesUsed.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A9-3-1/ReturnsNonConstRawPointersOrReferencesToPrivateOrProtectedData.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A8-4-12/UniquePtrPassedToFunctionWithImproperSemantics.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A8-4-11/SmartPointerAsParameterWithoutLifetimeSemantics.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A7-5-1/InvalidFunctionReturnType.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A5-1-7/LambdaPassedToDecltype.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A27-0-4/CStyleStringsUsed.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A15-1-3/ThrownExceptionsShouldBeUnique.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A13-2-1/AssignmentOperatorReturnThis.ql Switches to new.DataFlow import.
cpp/autosar/src/rules/A13-1-3/UserDefinedLiteralsOperatorsShallOnlyPerformConversionOfPassedParameters.ql Switches to new.TaintTracking import.
c/misra/test/rules/RULE-22-7/EofShallBeComparedWithUnmodifiedReturnValues.expected Removes deprecated-module warnings from expected output.
c/misra/test/rules/RULE-22-4/AttemptToWriteToAReadOnlyStream.expected Removes deprecated-module warnings from expected output.
c/misra/test/rules/RULE-22-3/FileOpenForReadAndWriteOnDifferentStreams.expected Removes deprecated-module warnings from expected output.
c/misra/test/rules/RULE-13-2/UnsequencedAtomicReads.expected Removes deprecated-module warnings from expected output.
c/misra/src/rules/RULE-22-7/EofShallBeComparedWithUnmodifiedReturnValues.ql Switches to new.DataFlow import.
c/misra/src/rules/RULE-22-4/AttemptToWriteToAReadOnlyStream.ql Switches to new.DataFlow import.
c/misra/src/rules/RULE-22-3/FileOpenForReadAndWriteOnDifferentStreams.ql Switches to new.DataFlow import.
c/misra/src/rules/RULE-13-2/UnsequencedAtomicReads.ql Switches to new.TaintTracking import.
c/common/src/codingstandards/c/Signal.qll Switches to new.DataFlow import.
c/common/src/codingstandards/c/OutOfBounds.qll Removes DataFlow import (needs private import ...new.DataFlow).
c/cert/test/rules/STR31-C/StringsHasSufficientSpaceForTheNullTerminator.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/SIG35-C/DoNotReturnFromAComputationalExceptionHandler.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/SIG30-C/CallOnlyAsyncSafeFunctionsWithinSignalHandlers.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/MSC33-C/DoNotPassInvalidDataToTheAsctimeFunction.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/MEM35-C/InsufficientMemoryAllocatedForObject.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/FIO45-C/ToctouRaceConditionsWhileAccessingFiles.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/FIO40-C/ResetStringsOnFgetsOrFgetwsFailure.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/EXP30-C/DependenceOnOrderOfFunctionArgumentsForSideEffects.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/ERR33-C/DetectAndHandleStandardLibraryErrors.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/ERR30-C/SetlocaleMightSetErrno.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/ERR30-C/ErrnoReadBeforeReturn.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/CON34-C/ThreadObjectStorageDurationsNotInitialized.expected Removes deprecated-module warnings from expected output.
c/cert/test/rules/CON30-C/CleanUpThreadSpecificStorage.expected Removes deprecated-module warnings from expected output.
c/cert/src/rules/STR31-C/StringsHasSufficientSpaceForTheNullTerminator.ql Switches to new.TaintTracking import.
c/cert/src/rules/SIG35-C/DoNotReturnFromAComputationalExceptionHandler.ql Switches to new.DataFlow import.
c/cert/src/rules/SIG30-C/CallOnlyAsyncSafeFunctionsWithinSignalHandlers.ql Switches to new.DataFlow import.
c/cert/src/rules/MSC33-C/DoNotPassInvalidDataToTheAsctimeFunction.ql Switches to new.DataFlow import.
c/cert/src/rules/MEM35-C/InsufficientMemoryAllocatedForObject.ql Removes taint import but still uses TaintTracking (needs new.TaintTracking import restored).
c/cert/src/rules/FIO45-C/ToctouRaceConditionsWhileAccessingFiles.ql Switches to new.DataFlow import.
c/cert/src/rules/FIO40-C/ResetStringsOnFgetsOrFgetwsFailure.ql Switches to new.DataFlow import.
c/cert/src/rules/FIO37-C/SuccessfulFgetsOrFgetwsMayReturnAnEmptyString.ql Switches to new.DataFlow import.
c/cert/src/rules/EXP30-C/DependenceOnOrderOfFunctionArgumentsForSideEffects.ql Switches to new.TaintTracking import.
c/cert/src/rules/ERR33-C/DetectAndHandleStandardLibraryErrors.ql Switches to new.DataFlow import.
c/cert/src/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.ql Switches to new.DataFlow import.
c/cert/src/rules/ERR30-C/SetlocaleMightSetErrno.ql Switches to new.DataFlow import.
c/cert/src/rules/ERR30-C/ErrnoReadBeforeReturn.ql Switches to new.DataFlow import.
c/cert/src/rules/CON30-C/CleanUpThreadSpecificStorage.ql Switches to new.DataFlow import.

Copilot's findings

  • Files reviewed: 95/95 changed files
  • Comments generated: 10

Comment thread c/cert/src/rules/MEM35-C/InsufficientMemoryAllocatedForObject.ql
Comment thread cpp/common/src/codingstandards/cpp/Overflow.qll
Comment thread cpp/common/src/codingstandards/cpp/standardlibrary/FileStreams.qll
Comment thread cpp/common/src/codingstandards/cpp/Iterators.qll
Comment thread cpp/common/src/codingstandards/cpp/OutOfBounds.qll
Comment thread c/common/src/codingstandards/c/OutOfBounds.qll
…pecificStorage and AccessOfUndefinedMemberThroughUninitializedStaticPointer
GitHub Advanced Security started work on behalf of mbaluda June 18, 2026 19:33 View session
GitHub Advanced Security finished work on behalf of mbaluda June 18, 2026 19:35
@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 18, 2026 20:24 View session
GitHub Advanced Security finished work on behalf of mbaluda June 18, 2026 20:25
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.

2 participants