-
Notifications
You must be signed in to change notification settings - Fork 250
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
[dataflowengineoss] handle python imports in globalFromLiteral #4576
Conversation
d6e9e81
to
8c7f351
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This was also picked up yesterday by others, good timing and nice tests
dataflowengineoss/src/main/scala/io/joern/dataflowengineoss/package.scala
Outdated
Show resolved
Hide resolved
…ckage.scala name -> nameExact Co-authored-by: David Baker Effendi <dave@whirlylabs.com>
@xavierpinho Seems this case is still failing: https://github.com/dbMundada/privado-python-test/blob/main/src/basic/tag-index-access-sources.py#L14 Likely, since these are represented by |
@DavidBakerEffendi yeah... :( I stumbled in a similar issue and am currently investigating with the following sample: x = foo("X")
def run():
bar = {"x": x}
print(10) Here I'm querying for any literal that taints
Thanks for pointing that sample. Will be useful to add a bunch more unit-tests around this stuff. EDIT: A tentative fix could be to recover |
…io#4576) * [dataflowengineoss] handle python imports in globalFromLiteral * Update dataflowengineoss/src/main/scala/io/joern/dataflowengineoss/package.scala name -> nameExact Co-authored-by: David Baker Effendi <dave@whirlylabs.com> --------- Co-authored-by: David Baker Effendi <dave@whirlylabs.com>
Noticed a regression after #4559, in which flows from imported members would not longer propagate, e.g.
At play is the representation of
import
statements, which look likeFOOBAR = import("models", "FOOBAR")
.Prior to #4559,
globalFromLiteral
would yieldFOOBAR
in the aforementioned import statement, since it would recursively look for literals in assignments. That wasn't bullet-proof because then inx = foo(20)
we would also yieldx
, leading to an extra (incorrect) data-flow from20
tox
(see #4549.)In #4559, we changed that to only look for literals as the proper RHS of assignments, which then misses this particular representation of import statements.
So in this patch we extend
globalFromLiteral
to also account for literals found insideimport
statements.