Skip to content

Shared: Re-factor summary, source and sink model generators into separate modules. #19382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Apr 25, 2025

In this PR we re-write the model generator into separate (nested) parameterized modules. Prior to this change it was only possible to create a model generator that could create summaries, neutrals, source and sinks. If only summary/neutral models are of interest, one still needed to provide all the source and sink model generation related parameters (as these were included in the input signature for model generator). With this change the model generator is turned into a series of nested parameterized modules.
That is, to create a model generator one now needs to

  • Instantiate a model generator factory (this is the shared part of the model generation logic between summaries, neutrals, sources and sinks).
  • Instantiate a summary/neutral, source or sink model generator using the model generator factory from above.

Furthermore, in this PR we sprinkle sensible predicate defaults for some of the model generator input predicates.

private import semmle.code.cpp.ir.IR
private import semmle.code.cpp.dataflow.ExternalFlow as ExternalFlow
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplSpecific
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate as DataFlowPrivate
private import semmle.code.cpp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
private import semmle.code.cpp.ir.dataflow.internal.TaintTrackingImplSpecific
private import semmle.code.cpp.dataflow.new.TaintTracking
private import semmle.code.cpp.dataflow.new.TaintTracking as Tt

Check warning

Code scanning / CodeQL

Names only differing by case Warning

Tt is only different by casing from TT that is used elsewhere for modules.
private import semmle.code.cpp.ir.IR
private import semmle.code.cpp.dataflow.ExternalFlow as ExternalFlow
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplSpecific
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate as DataFlowPrivate
private import semmle.code.cpp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
private import semmle.code.cpp.ir.dataflow.internal.TaintTrackingImplSpecific
private import semmle.code.cpp.dataflow.new.TaintTracking
private import semmle.code.cpp.dataflow.new.TaintTracking as Tt
private import semmle.code.cpp.dataflow.new.DataFlow as Df

Check warning

Code scanning / CodeQL

Names only differing by case Warning

Df is only different by casing from DF that is used elsewhere for modules.
@michaelnebel michaelnebel force-pushed the shared/modelgenrefactor branch 2 times, most recently from 4fea2b0 to fbe0394 Compare April 28, 2025 08:42
@michaelnebel michaelnebel added the no-change-note-required This PR does not need a change note label Apr 28, 2025
@michaelnebel michaelnebel force-pushed the shared/modelgenrefactor branch from fbe0394 to c9d01bc Compare April 29, 2025 13:25
@michaelnebel michaelnebel marked this pull request as ready for review April 29, 2025 14:01
@michaelnebel michaelnebel requested review from a team as code owners April 29, 2025 14:01
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

The C/C++ parts LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# C++ Java no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants