Skip to content
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

Data flow: Synthesize parameter return nodes #16394

Merged
merged 4 commits into from
May 21, 2024

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented May 2, 2024

This PR adds synthetic return nodes for flow that returns from methods via a parameter. For example, in

class C
{
    public string Field;
}

public void TaintField(C c) // (1)
{
    c.Field = "taint"; // (2)
}

void M(C c)
{
    c.TaintField(); // (3)
    Sink(c.Field);
}

we would previously have a direct flow step from [post] c at (2) to [post] c at (3), whereas now we first have a step from [post] c at (2) to c [Return] at (1), and then from c [Return] at (1) to [post] c at (3).

The motivation for adding the extra node is two-fold: Firstly, it may help with generating fewer subpaths, and secondly it will be easier to follow flow path explanations (especially when the parameter write happens in a large method).

@hvitved hvitved force-pushed the dataflow/synth-param-ret-node branch 3 times, most recently from 7b3811a to c14d652 Compare May 6, 2024 12:24
@github-actions github-actions bot removed the Python label May 6, 2024
@hvitved hvitved force-pushed the dataflow/synth-param-ret-node branch from c14d652 to 4b024f8 Compare May 6, 2024 12:31
@hvitved hvitved added the depends on internal PR This PR should only be merged in sync with an internal Semmle PR label May 6, 2024
@hvitved hvitved marked this pull request as ready for review May 6, 2024 13:02
@hvitved hvitved requested review from a team as code owners May 6, 2024 13:02
@hvitved hvitved requested a review from aschackmull May 6, 2024 13:02
Copy link
Contributor

@aschackmull aschackmull left a comment

Choose a reason for hiding this comment

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

LGTM

@hvitved hvitved force-pushed the dataflow/synth-param-ret-node branch from 11c6dd2 to bebcd67 Compare May 21, 2024 12:52
Copy link
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

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

Go and Shared parts LGTM

@hvitved hvitved merged commit a87ceed into github:main May 21, 2024
60 of 61 checks passed
@hvitved hvitved deleted the dataflow/synth-param-ret-node branch May 21, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants