Skip to content

Commit 9326fbd

Browse files
authored
Merge pull request #13841 from jeongsoolee09/log-injection-mad
JS: Add support for log injection in MaD
2 parents 2b74144 + 1d5eb4a commit 9326fbd

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

docs/codeql/codeql-language-guides/customizing-library-models-for-javascript.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ Unlike sources, sinks tend to be highly query-specific, rarely affecting more th
471471
- **request-forgery**: A sink that controls the URL of a request, such as in a **fetch** call.
472472
- **url-redirection**: A sink that can be used to redirect the user to a malicious URL.
473473
- **unsafe-deserialization**: A deserialization sink that can lead to code execution or other unsafe behaviour, such as an unsafe YAML parser.
474+
- **log-injection**: A sink that can be used for log injection, such as in a **console.log** call.
474475

475476
Summary kinds
476477
~~~~~~~~~~~~~
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added `log-injection` as a customizable sink kind for log injection.

javascript/ql/lib/semmle/javascript/security/dataflow/LogInjectionQuery.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ class HtmlSanitizer extends Sanitizer instanceof HtmlSanitizerCall { }
6666
class JsonStringifySanitizer extends Sanitizer {
6767
JsonStringifySanitizer() { this = any(JsonStringifyCall c).getOutput() }
6868
}
69+
70+
private class SinkFromModel extends Sink {
71+
SinkFromModel() { this = ModelOutput::getASinkNode("log-injection").asSink() }
72+
}

0 commit comments

Comments
 (0)