Merge pull request #5728 from asgerf/js/source-sink-queries

Approved by erik-krogh
This commit is contained in:
CodeQL CI
2021-05-11 05:04:47 -07:00
committed by GitHub
3 changed files with 33 additions and 9 deletions

View File

@@ -0,0 +1,15 @@
/**
* @name Taint sinks
* @description Expressions that are vulnerable if containing untrusted data.
* @kind problem
* @problem.severity info
* @id js/summary/taint-sinks
* @tags summary
* @precision medium
*/
import javascript
import meta.internal.TaintMetrics
from string kind
select relevantTaintSink(kind), kind + " sink"

View File

@@ -0,0 +1,16 @@
/**
* @name Taint sources
* @description Sources of untrusted input.
* @kind problem
* @problem.severity info
* @id js/summary/taint-sources
* @tags summary
* @precision medium
*/
import javascript
import meta.internal.TaintMetrics
from RemoteFlowSource node
where node = relevantTaintSource()
select node, node.getSourceType()

View File

@@ -75,16 +75,9 @@ DataFlow::Node relevantTaintSink(string kind) {
DataFlow::Node relevantTaintSink() { result = relevantTaintSink(_) }
/**
* Gets a remote flow source or `document.location` source.
* Gets a relevant remote flow source.
*/
DataFlow::Node relevantTaintSource() {
not result.getFile() instanceof IgnoredFile and
(
result instanceof RemoteFlowSource
or
result = DOM::locationSource()
)
}
RemoteFlowSource relevantTaintSource() { not result.getFile() instanceof IgnoredFile }
/**
* Gets the output of a call that shows intent to sanitize a value