-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Rust: Add basic skeleton setup for data flow #17871
Conversation
4f855c5
to
7217469
Compare
7217469
to
44bebed
Compare
The qldoc CI job is failling with the errors below. I'm not sure why it's complaining about these modules, as they're preexisting modules?
|
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.
LGTM, only some minor things. I think it would also be nice to enable the consistency checks, see e.g. https://github.com/github/codeql/blob/main/ruby/ql/consistency-queries/DataFlowConsistency.ql.
|
||
private import rust | ||
private import codeql.dataflow.DataFlow | ||
private import internal.DataFlowImpl as DataFlowImpl |
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.
I don't think the as DataFlowImpl
bit is needed.
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.
I added it for this line here.
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.
I see, that goes away with the other suggested changes 😄
/** | ||
* Gets the expression that corresponds to this node, if any. | ||
*/ | ||
Expr asExpr() { none() } |
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.
The return type here should be CfgNode
, because we will base data flow on the CFG and not on the AST.
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.
To me it seems a bit confusing for users and query writers if asExpr
doesn't return an expression? There is also another predicate getCfgNode
to get a CFG node.
From a quick grep it seems that in Swift, Go, Java, C++, and C# the asExpr
predicate gives an expression. Only in Ruby does it give a CFG node.
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.
Let's leave it at Expr
, for now, and then change it once we have a proper Expr
layer on top of CfgNode
.
private module Cached { | ||
cached | ||
newtype TNode = | ||
TExprNode(CfgNode n, Expr e) or |
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.
Cartesian product
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.
Is now
TExprNode(CfgNode n, Expr e) { n.getAstNode() = e } or
This PR adds the basic setup for data flow and taint tracking with the goal that