mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #5728 from asgerf/js/source-sink-queries
Approved by erik-krogh
This commit is contained in:
15
javascript/ql/src/Summary/TaintSinks.ql
Normal file
15
javascript/ql/src/Summary/TaintSinks.ql
Normal 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"
|
||||
16
javascript/ql/src/Summary/TaintSources.ql
Normal file
16
javascript/ql/src/Summary/TaintSources.ql
Normal 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()
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user