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

More precise flow into splat parameters #13938

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

hmac
Copy link
Contributor

@hmac hmac commented Aug 10, 2023

We now precisely track flow from positional arguments to splat parameters, provided that splat arguments are not used and there are no positional parameters after the splat parameter. For example, in this case:

def f(x, y, *z); end

f(a, b, c, d)

we get flow from c to z[0] and d to z[1].

We get false flow if there are positional parameters after the splat parameter. For example in this case:

def g(x, y, *z, w); end

g(a, b, c, d)

we get flow from d to z[0] instead of w.

We also track flow in this case

def f(a, *b)
  sink b[0]
end

f(1, *[taint, 2])

@github-actions github-actions bot added the Ruby label Aug 10, 2023
We now precisely track flow from positional arguments to splat
parameters, provided that splat arguments are not used and there are no
positional parameters after the splat parameter. For example, in this
case:

    def f(x, y, *z); end

    f(a, b, c, d)

we get flow from `c` to `z[0]` and `d` to `z[1]`.

We get false flow if there are positional parameters after the splat
parameter. For example in this case:

    def g(x, y, *z, w); end

    g(a, b, c, d)

we get flow from `d` to `z[0]` instead of `w`.

We also track flow in this case

    def f(a, *b)
      sink b[0]
    end

    f(1, *[taint, 2])
Make this class into a proper subclass of `ParameterNodeImpl`, to
prevent some consistency test failures.
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

1 participant