Skip to content

Commit 922b276

Browse files
authored
Merge pull request github#5728 from asgerf/js/source-sink-queries
Approved by erik-krogh
2 parents a7f9789 + df5eab3 commit 922b276

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name Taint sinks
3+
* @description Expressions that are vulnerable if containing untrusted data.
4+
* @kind problem
5+
* @problem.severity info
6+
* @id js/summary/taint-sinks
7+
* @tags summary
8+
* @precision medium
9+
*/
10+
11+
import javascript
12+
import meta.internal.TaintMetrics
13+
14+
from string kind
15+
select relevantTaintSink(kind), kind + " sink"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @name Taint sources
3+
* @description Sources of untrusted input.
4+
* @kind problem
5+
* @problem.severity info
6+
* @id js/summary/taint-sources
7+
* @tags summary
8+
* @precision medium
9+
*/
10+
11+
import javascript
12+
import meta.internal.TaintMetrics
13+
14+
from RemoteFlowSource node
15+
where node = relevantTaintSource()
16+
select node, node.getSourceType()

javascript/ql/src/meta/internal/TaintMetrics.qll

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,9 @@ DataFlow::Node relevantTaintSink(string kind) {
7575
DataFlow::Node relevantTaintSink() { result = relevantTaintSink(_) }
7676

7777
/**
78-
* Gets a remote flow source or `document.location` source.
78+
* Gets a relevant remote flow source.
7979
*/
80-
DataFlow::Node relevantTaintSource() {
81-
not result.getFile() instanceof IgnoredFile and
82-
(
83-
result instanceof RemoteFlowSource
84-
or
85-
result = DOM::locationSource()
86-
)
87-
}
80+
RemoteFlowSource relevantTaintSource() { not result.getFile() instanceof IgnoredFile }
8881

8982
/**
9083
* Gets the output of a call that shows intent to sanitize a value

0 commit comments

Comments
 (0)