Skip to content

Commit a5009ef

Browse files
authored
Merge pull request #5 from RasmusWL/nosql-fixes
Small NoSQL fixes
2 parents eb16018 + 318694c commit a5009ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python/ql/src/experimental/Security/CWE-943/NoSQLInjection.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
NoSQL injections can be prevented by escaping user-input's special characters that are passed into the NoSQL query from the user-supplied source.
2121
Alternatively, using a sanitize library such as MongoSanitizer will ensure that user-supplied sources can not act as a malicious query.
2222
</p>
23-
<recommendation>
23+
</recommendation>
2424

2525
<example>
2626
<p>In the example below, the user-supplied source is passed to a MongoDB function that queries the MongoDB database.</p>
2727
<sample src="examples/NoSQLInjection-bad.py" />
2828
<p> This can be fixed by using a sanitizer library like MongoSanitizer as shown in this annotated code version below.</p>
2929
<sample src="examples/NoSQLInjection-good.py" />
30-
<example>
30+
</example>
3131

3232
<references>
3333
<li>Mongoengine: <a href="http://mongoengine.org/">Documentation</a>.</li>

python/ql/src/experimental/semmle/python/security/injection/NoSQLInjection.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class RFSToDictConfig extends TaintTracking::Configuration {
1717
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
1818

1919
override predicate isSink(DataFlow::Node sink) {
20-
exists(Decoding decoding | decoding.getFormat() = "JSON" and sink = decoding)
20+
exists(Decoding decoding | decoding.getFormat() = "JSON" and sink = decoding.getOutput())
2121
}
2222

2323
override predicate isSanitizer(DataFlow::Node sanitizer) {
@@ -32,7 +32,7 @@ class FromDataDictToSink extends TaintTracking2::Configuration {
3232
FromDataDictToSink() { this = "FromDataDictToSink" }
3333

3434
override predicate isSource(DataFlow::Node source) {
35-
exists(Decoding decoding | decoding.getFormat() = "JSON" and source = decoding)
35+
exists(Decoding decoding | decoding.getFormat() = "JSON" and source = decoding.getOutput())
3636
}
3737

3838
override predicate isSink(DataFlow::Node sink) { sink = any(NoSQLQuery noSQLQuery).getQuery() }

0 commit comments

Comments
 (0)