mirror of
https://github.com/github/codeql.git
synced 2025-12-23 04:06:37 +01:00
Merge branch 'main' into rb-last-msg
This commit is contained in:
28
ruby/ql/src/queries/meta/TaintedNodes.ql
Normal file
28
ruby/ql/src/queries/meta/TaintedNodes.ql
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @name Tainted nodes
|
||||
* @description Nodes reachable from a remote flow source via default taint-tracking steps.
|
||||
* @kind problem
|
||||
* @problem.severity recommendation
|
||||
* @id rb/meta/tainted-nodes
|
||||
* @tags meta
|
||||
* @precision very-low
|
||||
*/
|
||||
|
||||
import internal.TaintMetrics
|
||||
import codeql.ruby.DataFlow
|
||||
import codeql.ruby.TaintTracking
|
||||
|
||||
class BasicTaintConfiguration extends TaintTracking::Configuration {
|
||||
BasicTaintConfiguration() { this = "BasicTaintConfiguration" }
|
||||
|
||||
override predicate isSource(DataFlow::Node node) { node = relevantTaintSource(_) }
|
||||
|
||||
override predicate isSink(DataFlow::Node node) {
|
||||
// To reduce noise from synthetic nodes, only count nodes that have an associated expression.
|
||||
exists(node.asExpr().getExpr())
|
||||
}
|
||||
}
|
||||
|
||||
from DataFlow::Node node
|
||||
where any(BasicTaintConfiguration cfg).hasFlow(_, node)
|
||||
select node, "Tainted node"
|
||||
@@ -36,3 +36,10 @@ DataFlow::Node relevantTaintSink(string kind) {
|
||||
kind = "UrlRedirect" and result instanceof UrlRedirect::Sink
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root folder of the snapshot.
|
||||
*
|
||||
* This is selected as the location for project-wide metrics.
|
||||
*/
|
||||
Folder projectRoot() { result.getRelativePath() = "" }
|
||||
|
||||
Reference in New Issue
Block a user