Skip to content

Commit bdee99a

Browse files
committed
stash
1 parent 01fb29e commit bdee99a

14 files changed

Lines changed: 355 additions & 275 deletions

File tree

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@ module AWS {
2626
)
2727
}
2828

29-
/**
30-
* An expression that is used as an AWS config value: `{ accessKeyId: <user>, secretAccessKey: <password>}`.
31-
*/
32-
class Credentials extends CredentialsNode {
33-
string kind;
29+
// /**
30+
// * An expression that is used as an AWS config value: `{ accessKeyId: <user>, secretAccessKey: <password>}`.
31+
// */
32+
// class Credentials extends CredentialsNode {
33+
// string kind;
3434

35-
Credentials() {
36-
exists(string prop, DataFlow::InvokeNode invk, int i |
37-
takesConfigurationObject(invk, i) and
38-
this = invk.getOptionArgument(i, prop)
39-
|
40-
prop = "accessKeyId" and kind = "user name"
41-
or
42-
prop = "secretAccessKey" and kind = "password"
43-
)
44-
}
35+
// Credentials() {
36+
// exists(string prop, DataFlow::InvokeNode invk, int i |
37+
// takesConfigurationObject(invk, i) and
38+
// this = invk.getOptionArgument(i, prop)
39+
// |
40+
// prop = "accessKeyId" and kind = "user name"
41+
// or
42+
// prop = "secretAccessKey" and kind = "password"
43+
// )
44+
// }
4545

46-
override string getCredentialsKind() { result = kind }
47-
}
46+
// override string getCredentialsKind() { result = kind }
47+
// }
4848
}

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ module Azure {
88
/**
99
* An expression that is used for authentication at Azure`.
1010
*/
11-
class Credentials extends CredentialsNode {
12-
string kind;
11+
// class Credentials extends CredentialsNode {
12+
// string kind;
1313

14-
Credentials() {
15-
exists(DataFlow::CallNode mce |
16-
mce =
17-
DataFlow::moduleMember("ms-rest-azure",
18-
["loginWithUsernamePassword", "loginWithServicePrincipalSecret"]).getACall()
19-
|
20-
this = mce.getArgument(0) and kind = "user name"
21-
or
22-
this = mce.getArgument(1) and kind = "password"
23-
)
24-
}
14+
// Credentials() {
15+
// exists(DataFlow::CallNode mce |
16+
// mce =
17+
// DataFlow::moduleMember("ms-rest-azure",
18+
// ["loginWithUsernamePassword", "loginWithServicePrincipalSecret"]).getACall()
19+
// |
20+
// this = mce.getArgument(0) and kind = "user name"
21+
// or
22+
// this = mce.getArgument(1) and kind = "password"
23+
// )
24+
// }
2525

26-
override string getCredentialsKind() { result = kind }
27-
}
26+
// override string getCredentialsKind() { result = kind }
27+
// }
2828
}

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,21 @@ module ClientRequest {
285285
}
286286

287287
/** An expression that is used as a credential in a request. */
288-
private class AuthorizationHeader extends CredentialsNode {
289-
AuthorizationHeader() {
290-
exists(DataFlow::PropWrite write | write.getPropertyName().regexpMatch("(?i)authorization") |
291-
this = write.getRhs()
292-
)
293-
or
294-
exists(DataFlow::MethodCallNode call | call.getMethodName() = ["append", "set"] |
295-
call.getNumArgument() = 2 and
296-
call.getArgument(0).getStringValue().regexpMatch("(?i)authorization") and
297-
this = call.getArgument(1)
298-
)
299-
}
300-
301-
override string getCredentialsKind() { result = "authorization header" }
302-
}
288+
// private class AuthorizationHeader extends CredentialsNode {
289+
// AuthorizationHeader() {
290+
// exists(DataFlow::PropWrite write | write.getPropertyName().regexpMatch("(?i)authorization") |
291+
// this = write.getRhs()
292+
// )
293+
// or
294+
// exists(DataFlow::MethodCallNode call | call.getMethodName() = ["append", "set"] |
295+
// call.getNumArgument() = 2 and
296+
// call.getArgument(0).getStringValue().regexpMatch("(?i)authorization") and
297+
// this = call.getArgument(1)
298+
// )
299+
// }
300+
301+
// override string getCredentialsKind() { result = "authorization header" }
302+
// }
303303

304304
/**
305305
* A model of a URL request made using an implementation of the `fetch` API.

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,23 @@ module Connect {
100100
DataFlow::Node getARouteHandlerNode() { result = this.getAnArgument() }
101101
}
102102

103-
/** An expression that is passed as `basicAuthConnect(<user>, <password>)`. */
104-
class Credentials extends CredentialsNode {
105-
string kind;
106-
107-
Credentials() {
108-
exists(DataFlow::CallNode call |
109-
call = DataFlow::moduleImport("basic-auth-connect").getAnInvocation() and
110-
call.getNumArgument() = 2
111-
|
112-
this = call.getArgument(0) and kind = "user name"
113-
or
114-
this = call.getArgument(1) and kind = "password"
115-
)
116-
}
117-
118-
override string getCredentialsKind() { result = kind }
119-
}
103+
// /** An expression that is passed as `basicAuthConnect(<user>, <password>)`. */
104+
// class Credentials extends CredentialsNode {
105+
// string kind;
106+
107+
// Credentials() {
108+
// exists(DataFlow::CallNode call |
109+
// call = DataFlow::moduleImport("basic-auth-connect").getAnInvocation() and
110+
// call.getNumArgument() = 2
111+
// |
112+
// this = call.getArgument(0) and kind = "user name"
113+
// or
114+
// this = call.getArgument(1) and kind = "password"
115+
// )
116+
// }
117+
118+
// override string getCredentialsKind() { result = kind }
119+
// }
120120

121121
deprecated class RequestExpr = NodeJSLib::RequestExpr;
122122

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ abstract class CryptographicKeyCreation extends DataFlow::Node {
3434
/**
3535
* A key used in a cryptographic algorithm, viewed as a `CredentialsNode`.
3636
*/
37-
class CryptographicKeyCredentialsExpr extends CredentialsNode instanceof CryptographicKey {
38-
override string getCredentialsKind() { result = "key" }
39-
}
37+
// class CryptographicKeyCredentialsExpr extends CredentialsNode instanceof CryptographicKey {
38+
// override string getCredentialsKind() { result = "key" }
39+
// }
4040

4141
// Holds if `algorithm` is an `EncryptionAlgorithm` that uses a block cipher
4242
private predicate isBlockEncryptionAlgorithm(CryptographicAlgorithm algorithm) {

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ module DigitalOcean {
88
/**
99
* An expression that is used for authentication at DigitalOcean: `digitalocean.client(<token>)`.
1010
*/
11-
class Credentials extends CredentialsNode {
12-
string kind;
11+
// class Credentials extends CredentialsNode {
12+
// string kind;
1313

14-
Credentials() {
15-
exists(DataFlow::CallNode mce |
16-
mce = DataFlow::moduleMember("digitalocean", "client").getACall()
17-
|
18-
this = mce.getArgument(0) and kind = "token"
19-
)
20-
}
14+
// Credentials() {
15+
// exists(DataFlow::CallNode mce |
16+
// mce = DataFlow::moduleMember("digitalocean", "client").getACall()
17+
// |
18+
// this = mce.getArgument(0) and kind = "token"
19+
// )
20+
// }
2121

22-
override string getCredentialsKind() { result = kind }
23-
}
22+
// override string getCredentialsKind() { result = kind }
23+
// }
2424
}

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,27 +1007,27 @@ module Express {
10071007
}
10081008
}
10091009

1010-
/** An expression that is passed as `expressBasicAuth({ users: { <user>: <password> }})`. */
1011-
class Credentials extends CredentialsNode {
1012-
string kind;
1013-
1014-
Credentials() {
1015-
exists(DataFlow::CallNode call, DataFlow::ModuleImportNode mod |
1016-
mod.getPath() = "express-basic-auth" and
1017-
call = mod.getAnInvocation() and
1018-
exists(DataFlow::ObjectLiteralNode usersSrc, DataFlow::PropWrite pwn |
1019-
usersSrc.flowsTo(call.getOptionArgument(0, "users")) and
1020-
usersSrc.flowsTo(pwn.getBase())
1021-
|
1022-
this = pwn.getPropertyNameExpr().flow() and kind = "user name"
1023-
or
1024-
this = pwn.getRhs() and kind = "password"
1025-
)
1026-
)
1027-
}
1028-
1029-
override string getCredentialsKind() { result = kind }
1030-
}
1010+
// /** An expression that is passed as `expressBasicAuth({ users: { <user>: <password> }})`. */
1011+
// class Credentials extends CredentialsNode {
1012+
// string kind;
1013+
1014+
// Credentials() {
1015+
// exists(DataFlow::CallNode call, DataFlow::ModuleImportNode mod |
1016+
// mod.getPath() = "express-basic-auth" and
1017+
// call = mod.getAnInvocation() and
1018+
// exists(DataFlow::ObjectLiteralNode usersSrc, DataFlow::PropWrite pwn |
1019+
// usersSrc.flowsTo(call.getOptionArgument(0, "users")) and
1020+
// usersSrc.flowsTo(pwn.getBase())
1021+
// |
1022+
// this = pwn.getPropertyNameExpr().flow() and kind = "user name"
1023+
// or
1024+
// this = pwn.getRhs() and kind = "password"
1025+
// )
1026+
// )
1027+
// }
1028+
1029+
// override string getCredentialsKind() { result = kind }
1030+
// }
10311031

10321032
/** A call to `response.sendFile`, considered as a file system access. */
10331033
private class ResponseSendFileAsFileSystemAccess extends FileSystemReadAccess,

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ private module JsonWebToken {
4444
*/
4545
private class JwtKey extends CredentialsNode {
4646
JwtKey() {
47-
this =
48-
API::moduleImport("jsonwebtoken").getMember(["sign", "verify"]).getParameter(1).asSink()
47+
this = API::moduleImport("jsonwebtoken").getMember(["verify"]).getParameter(1).asSink()
4948
}
5049

5150
override string getCredentialsKind() { result = "key" }

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,22 @@ private module MongoDB {
7777
result = API::Node::ofType("mongoose", "ConnectOptions")
7878
}
7979

80-
/**
81-
* An expression passed to `mongodb` or `mongoose` to supply credentials.
82-
*/
83-
class Credentials extends CredentialsNode {
84-
string kind;
85-
86-
Credentials() {
87-
exists(string prop | this = credentialsObject().getMember(prop).asSink() |
88-
prop = "user" and kind = "user name"
89-
or
90-
prop = "pass" and kind = "password"
91-
)
92-
}
93-
94-
override string getCredentialsKind() { result = kind }
95-
}
80+
// /**
81+
// * An expression passed to `mongodb` or `mongoose` to supply credentials.
82+
// */
83+
// class Credentials extends CredentialsNode {
84+
// string kind;
85+
86+
// Credentials() {
87+
// exists(string prop | this = credentialsObject().getMember(prop).asSink() |
88+
// prop = "user" and kind = "user name"
89+
// or
90+
// prop = "pass" and kind = "password"
91+
// )
92+
// }
93+
94+
// override string getCredentialsKind() { result = kind }
95+
// }
9696
}
9797

9898
private module Mongoose {

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,16 @@ module NodeJSLib {
425425
ServerDefinition() { isCreateServer(this) }
426426
}
427427

428-
/** An expression that is passed as `http.request({ auth: <expr> }, ...)`. */
429-
class Credentials extends CredentialsNode {
430-
Credentials() {
431-
exists(string http | http = "http" or http = "https" |
432-
this = DataFlow::moduleMember(http, "request").getACall().getOptionArgument(0, "auth")
433-
)
434-
}
428+
// /** An expression that is passed as `http.request({ auth: <expr> }, ...)`. */
429+
// class Credentials extends CredentialsNode {
430+
// Credentials() {
431+
// exists(string http | http = "http" or http = "https" |
432+
// this = DataFlow::moduleMember(http, "request").getACall().getOptionArgument(0, "auth")
433+
// )
434+
// }
435435

436-
override string getCredentialsKind() { result = "credentials" }
437-
}
436+
// override string getCredentialsKind() { result = "credentials" }
437+
// }
438438

439439
/**
440440
* A call a process-terminating function, such as `process.exit`.
@@ -1035,27 +1035,27 @@ module NodeJSLib {
10351035
}
10361036
}
10371037

1038-
/**
1039-
* A data flow node that is the username passed to the login callback provided by an HTTP or HTTPS request made by a Node.js process, for example `username` in `http.request(url).on('login', (res, cb) => {cb(username, password)})`.
1040-
*/
1041-
private class ClientRequestLoginUsername extends CredentialsNode {
1042-
ClientRequestLoginUsername() {
1043-
exists(ClientRequestLoginCallback callback | this = callback.getACall().getArgument(0))
1044-
}
1038+
// /**
1039+
// * A data flow node that is the username passed to the login callback provided by an HTTP or HTTPS request made by a Node.js process, for example `username` in `http.request(url).on('login', (res, cb) => {cb(username, password)})`.
1040+
// */
1041+
// private class ClientRequestLoginUsername extends CredentialsNode {
1042+
// ClientRequestLoginUsername() {
1043+
// exists(ClientRequestLoginCallback callback | this = callback.getACall().getArgument(0))
1044+
// }
10451045

1046-
override string getCredentialsKind() { result = "Node.js http(s) client login username" }
1047-
}
1046+
// override string getCredentialsKind() { result = "Node.js http(s) client login username" }
1047+
// }
10481048

1049-
/**
1050-
* A data flow node that is the password passed to the login callback provided by an HTTP or HTTPS request made by a Node.js process, for example `password` in `http.request(url).on('login', (res, cb) => {cb(username, password)})`.
1051-
*/
1052-
private class ClientRequestLoginPassword extends CredentialsNode {
1053-
ClientRequestLoginPassword() {
1054-
exists(ClientRequestLoginCallback callback | this = callback.getACall().getArgument(1))
1055-
}
1049+
// /**
1050+
// * A data flow node that is the password passed to the login callback provided by an HTTP or HTTPS request made by a Node.js process, for example `password` in `http.request(url).on('login', (res, cb) => {cb(username, password)})`.
1051+
// */
1052+
// private class ClientRequestLoginPassword extends CredentialsNode {
1053+
// ClientRequestLoginPassword() {
1054+
// exists(ClientRequestLoginCallback callback | this = callback.getACall().getArgument(1))
1055+
// }
10561056

1057-
override string getCredentialsKind() { result = "Node.js http(s) client login password" }
1058-
}
1057+
// override string getCredentialsKind() { result = "Node.js http(s) client login password" }
1058+
// }
10591059

10601060
/**
10611061
* A data flow node that is the parameter of an error callback for an HTTP or HTTPS request made by a Node.js process, for example `err` in `http.request(url).on('error', (err) => {})`.

0 commit comments

Comments
 (0)