Use the new dataflow module without affecting any tested behavior#1142
Use the new dataflow module without affecting any tested behavior#1142mbaluda wants to merge 3 commits into
Conversation
…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.
There was a problem hiding this comment.
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/.qllfiles to usesemmle.code.cpp.dataflow.new.DataFlow/semmle.code.cpp.dataflow.new.TaintTracking. - Updated numerous
.expectedfiles 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/.qlfiles now referenceDataFlow::.../TaintTracking::...without importing the corresponding module, which will break compilation. - The EXP50-CPP rule is not fully migrated (still using deprecated modules), and its
.expectedstill 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
…pecificStorage and AccessOfUndefinedMemberThroughUninitializedStaticPointer
|
🏁 Beep Boop! One or things failed during performance testing. Please check the release engineering repo for details. |
|
🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You can find full graphs and stats in the PR that was created for this test in the release engineering repo. 🏁 Below are the slowest predicates for the last 2 releases vs this PR. |
Description
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
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.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
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
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.
Reviewer
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.