JS: Add PreCallGraphStep and use some array steps in type tracking #3641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes the array steps for
.map
,.forEach
, andfor-of
loops work for type tracking by default, which, in combination with #3639 is needed to get call edges in https://github.com/github/codeql-javascript-CVE-coverage/issues/721.Due to negative recursion, it's not possible to use
AdditionalFlowStep
in the core type tracking library, since some contributions to that class depend on negatively on type tracking (and positive dependencies would likely cause performance issues).This therefore introduces an internal class,
PreCallGraphStep
, whose steps are contributed to bothAdditionalFlowStep
andAdditionalTypeTrackingStep
. This third class is needed since neither class of steps can contribute their contents to the other:AdditionalFlowStep
s can't be included inAdditionalTypeTrackingStep
due to negative recursion.AdditionalTypeTrackingStep
should in principle not be included inAdditionalFlowStep
s since type tracking steps are generally allowed to be more imprecise.The new class uses a unit type as base, but since this is an internal class we are free to change this later. For pure data flow steps, there isn't generally a need to categorize the steps so it seems independent of how we handle #3603.
Evaluations:
TODO
JS: Track functions through props and returns #3639JS: Support calls to returned functions #3715