Skip to content

Commit b0f6cf1

Browse files
committed
expose more marsdb calls as database accesses
1 parent 9df1ac7 commit b0f6cf1

File tree

2 files changed

+19
-2
lines changed
  • javascript/ql
    • experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling
    • lib/semmle/javascript/frameworks

2 files changed

+19
-2
lines changed

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/CoreKnowledge.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ predicate isOtherModeledArgument(DataFlow::Node n, FilteringReason reason) {
200200
or
201201
call instanceof FileSystemAccess and reason instanceof FileSystemAccessReason
202202
or
203+
// TODO database accesses are less well defined than database query sinks, so this may cover unmodeled sinks
203204
call instanceof DatabaseAccess and reason instanceof DatabaseAccessReason
204205
or
205206
call = DOM::domValueRef() and reason instanceof DOMReason

javascript/ql/lib/semmle/javascript/frameworks/NoSQL.qll

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,30 @@ private module Minimongo {
618618
* Provides classes modeling the MarsDB library.
619619
*/
620620
private module MarsDB {
621+
private class MarsDBAccess extends DatabaseAccess {
622+
string method;
623+
624+
MarsDBAccess() {
625+
this =
626+
API::moduleImport("marsdb")
627+
.getMember("Collection")
628+
.getInstance()
629+
.getMember(method)
630+
.getACall()
631+
}
632+
633+
string getMethod() { result = method }
634+
635+
override DataFlow::Node getAQueryArgument() { none() }
636+
}
637+
621638
/** A call to a MarsDB query method. */
622639
private class QueryCall extends DatabaseAccess, API::CallNode {
623640
int queryArgIdx;
624641

625642
QueryCall() {
626643
exists(string m |
627-
this =
628-
API::moduleImport("marsdb").getMember("Collection").getInstance().getMember(m).getACall() and
644+
this.(MarsDBAccess).getMethod() = m and
629645
// implements parts of the Minimongo interface
630646
Minimongo::CollectionMethodSignatures::interpretsArgumentAsQuery(m, queryArgIdx)
631647
)

0 commit comments

Comments
 (0)