Merge pull request #9756 from erik-krogh/greyMatter

JS: add model for the gray-matter library to js/code-injection
This commit is contained in:
Erik Krogh Kristensen
2022-07-01 12:19:12 +02:00
committed by GitHub
4 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The `gray-matter` library is now modeled as a sink for the `js/code-injection` query.

View File

@@ -51,6 +51,18 @@ module CodeInjection {
}
}
/** An expression parsed by the `gray-matter` library. */
class GrayMatterSink extends Sink {
GrayMatterSink() {
exists(API::CallNode call |
call = DataFlow::moduleImport("gray-matter").getACall() and
this = call.getArgument(0) and
// if the js/javascript engine is set, then we assume they are set to something safe.
not exists(call.getParameter(1).getMember("engines").getMember(["js", "javascript"]))
)
}
}
/**
* A template tag occurring in JS code, viewed as a code injection sink.
*/