mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
@@ -118,3 +118,43 @@ private class SnarkdownStep extends TaintTracking::SharedTaintStep {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Classes and predicates for modelling taint steps the `markdown-it` library.
|
||||
*/
|
||||
private module MarkdownIt {
|
||||
/**
|
||||
* The creation of a parser from `markdown-it`.
|
||||
*/
|
||||
private API::Node markdownIt() {
|
||||
exists(API::InvokeNode call |
|
||||
call = API::moduleImport("markdown-it").getAnInvocation()
|
||||
or
|
||||
call = API::moduleImport("markdown-it").getMember("Markdown").getAnInvocation()
|
||||
|
|
||||
call.getParameter(0).getMember("html").getARhs().mayHaveBooleanValue(true) and
|
||||
result = call.getReturn()
|
||||
)
|
||||
or
|
||||
exists(API::CallNode call |
|
||||
call = markdownIt().getMember(["use", "set", "configure", "enable", "disable"]).getACall() and
|
||||
result = call.getReturn() and
|
||||
not call.getParameter(0).getAValueReachingRhs() =
|
||||
DataFlow::moduleImport("markdown-it-sanitizer")
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A taint step for the `markdown-it` library.
|
||||
*/
|
||||
private class MarkdownItStep extends TaintTracking::SharedTaintStep {
|
||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
exists(API::CallNode call |
|
||||
call = markdownIt().getMember(["render", "renderInline"]).getACall()
|
||||
|
|
||||
succ = call and
|
||||
pred = call.getArgument(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user