mirror of
https://github.com/github/codeql.git
synced 2026-03-23 07:56:54 +01:00
23 lines
837 B
Plaintext
23 lines
837 B
Plaintext
/**
|
|
* @name Regular expression injection
|
|
* @description User input should not be used in regular expressions without first being escaped,
|
|
* otherwise a malicious user may be able to inject an expression that could require
|
|
* exponential time on certain inputs.
|
|
* @kind path-problem
|
|
* @problem.severity error
|
|
* @precision high
|
|
* @id js/regex-injection
|
|
* @tags security
|
|
* external/cwe/cwe-730
|
|
* external/cwe/cwe-400
|
|
*/
|
|
|
|
import javascript
|
|
import semmle.javascript.security.dataflow.RegExpInjection::RegExpInjection
|
|
import DataFlow::PathGraph
|
|
|
|
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
|
|
where cfg.hasFlowPath(source, sink)
|
|
select sink.getNode(), source, sink, "This regular expression is constructed from a $@.",
|
|
source.getNode(), "user-provided value"
|