mirror of
https://github.com/github/codeql.git
synced 2026-02-28 21:03:50 +01:00
30 lines
972 B
Plaintext
30 lines
972 B
Plaintext
/**
|
|
* @name Cross-site scripting from local source
|
|
* @description Writing user input directly to a web page
|
|
* allows for a cross-site scripting vulnerability.
|
|
* @kind path-problem
|
|
* @problem.severity recommendation
|
|
* @precision medium
|
|
* @id java/xss-local
|
|
* @tags security
|
|
* external/cwe/cwe-079
|
|
*/
|
|
|
|
import java
|
|
import semmle.code.java.dataflow.FlowSources
|
|
import semmle.code.java.security.XSS
|
|
import DataFlow::PathGraph
|
|
|
|
class XSSLocalConfig extends TaintTracking::Configuration {
|
|
XSSLocalConfig() { this = "XSSLocalConfig" }
|
|
|
|
override predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput }
|
|
|
|
override predicate isSink(DataFlow::Node sink) { sink instanceof XssSink }
|
|
}
|
|
|
|
from DataFlow::PathNode source, DataFlow::PathNode sink, XSSLocalConfig conf
|
|
where conf.hasFlowPath(source, sink)
|
|
select sink.getNode(), source, sink, "Cross-site scripting vulnerability due to $@.",
|
|
source.getNode(), "user-provided value"
|