File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @name Tainted nodes
3+ * @description Nodes reachable from a remote flow source via default taint-tracking steps.
4+ * @kind problem
5+ * @problem.severity recommendation
6+ * @id rb/meta/tainted-nodes
7+ * @tags meta
8+ * @precision very-low
9+ */
10+
11+ import internal.TaintMetrics
12+ import codeql.ruby.DataFlow
13+ import codeql.ruby.TaintTracking
14+
15+ class BasicTaintConfiguration extends TaintTracking:: Configuration {
16+ BasicTaintConfiguration ( ) { this = "BasicTaintConfiguration" }
17+
18+ override predicate isSource ( DataFlow:: Node node ) { node = relevantTaintSource ( _) }
19+
20+ override predicate isSink ( DataFlow:: Node node ) {
21+ // To reduce noise from synthetic nodes, only count nodes that have an associated expression.
22+ exists ( node .asExpr ( ) .getExpr ( ) )
23+ }
24+ }
25+
26+ from DataFlow:: Node node
27+ where any ( BasicTaintConfiguration cfg ) .hasFlow ( _, node )
28+ select node , "Tainted node"
Original file line number Diff line number Diff line change @@ -36,3 +36,10 @@ DataFlow::Node relevantTaintSink(string kind) {
3636 kind = "UrlRedirect" and result instanceof UrlRedirect:: Sink
3737 )
3838}
39+
40+ /**
41+ * Gets the root folder of the snapshot.
42+ *
43+ * This is selected as the location for project-wide metrics.
44+ */
45+ Folder projectRoot ( ) { result .getRelativePath ( ) = "" }
You can’t perform that action at this time.
0 commit comments