JS: Move ExceptionXss source into Xss.qll

This commit is contained in:
Asger Feldthaus
2021-03-02 13:16:10 +00:00
parent fd9604c5ef
commit d916118ea4
3 changed files with 62 additions and 52 deletions

View File

@@ -15,18 +15,8 @@ import javascript
import semmle.javascript.security.dataflow.ExceptionXss::ExceptionXss
import DataFlow::PathGraph
/**
* Gets a description of the source.
*/
string getSourceDescription(DataFlow::Node source) {
result = source.(ErrorSource).getDescription()
or
not source instanceof ErrorSource and
result = "Exception text"
}
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
where cfg.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
"$@ is reinterpreted as HTML without escaping meta-characters.", source.getNode(),
getSourceDescription(source.getNode())
source.getNode().(Source).getDescription()