-
So I have this snippet, I would like to locate if ".." in e.name:
pass I unsuccessfully have written: import python
import semmle.python.dataflow.new.internal.Attributes
from Compare c, AttrRead e
where
c.getOp(0) instanceof In
and
c.getLeft() instanceof StrConst
and
c.getLeft().(StrConst).getText() = ".."
and
c.getAComparator().(AttrRead).accesses(e, "name")
select c, "c" But I get this error
It should work right ? |
Beta Was this translation helpful? Give feedback.
Answered by
Sim4n6
Sep 24, 2022
Replies: 2 comments
-
The error message comes from here: c.getAComparator().(AttrRead).accesses(e, "name") Why is expression cannot be compatible with an attribute node, please ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
c.getAComparator().(Attribute).getName() = "name"
by myself 🥂 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Sim4n6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expr
needs to be cast toAttribute
. I figured it out thanks to thegetAQlClass()
debugging capabilities.by myself 🥂