mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
add a markdown step through the mermaid library
This commit is contained in:
4
javascript/ql/lib/change-notes/2022-08-09-mermaid.md
Normal file
4
javascript/ql/lib/change-notes/2022-08-09-mermaid.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* A model for the `mermaid` library has been added. XSS queries can now detect flow through the `render` method of the `mermaid` library.
|
||||
@@ -78,6 +78,32 @@ module Markdown {
|
||||
}
|
||||
}
|
||||
|
||||
/** A taint step for the `mermaid` library. */
|
||||
private class MermaidStep extends MarkdownStep {
|
||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
exists(API::CallNode call |
|
||||
call =
|
||||
[API::moduleImport("mermaid"), API::moduleImport("mermaid").getMember("mermaidAPI")]
|
||||
.getMember("render")
|
||||
.getACall()
|
||||
|
|
||||
succ = [call, call.getParameter(2).getParameter(0).asSource()] and
|
||||
pred = call.getArgument(1)
|
||||
)
|
||||
or
|
||||
exists(DataFlow::CallNode call |
|
||||
call =
|
||||
[
|
||||
DataFlow::globalVarRef("mermaid"),
|
||||
DataFlow::globalVarRef("mermaid").getAPropertyRead("mermaidAPI")
|
||||
].getAMemberCall("render")
|
||||
|
|
||||
succ = [call.(DataFlow::Node), call.getABoundCallbackParameter(2, 0)] and
|
||||
pred = call.getArgument(1)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Classes and predicates for modeling taint steps in `unified` and `remark`.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user