JavaScript: Pull reasoning about encode/encrypt-like calls into library.

This commit is contained in:
Max Schaefer
2019-01-29 09:14:23 +00:00
parent 1fe4c44b36
commit a8dd97a2c9
2 changed files with 11 additions and 8 deletions

View File

@@ -144,6 +144,15 @@ class AuthorizationCall extends SensitiveAction, DataFlow::CallNode {
}
}
/** A call to a function whose name suggests that it encodes or encrypts its arguments. */
class ProtectCall extends DataFlow::CallNode {
ProtectCall() {
exists(string s | getCalleeName().regexpMatch("(?i).*" + s + ".*") |
s = "protect" or s = "encode" or s = "encrypt"
)
}
}
/**
* Classes for expressions containing cleartext passwords.
*/

View File

@@ -53,14 +53,8 @@ module CleartextStorage {
override string describe() { result = astNode.describe() }
}
/** A call to any method whose name suggests that it encodes or encrypts the parameter. */
class ProtectSanitizer extends Sanitizer, DataFlow::ValueNode {
ProtectSanitizer() {
exists(string s | astNode.(CallExpr).getCalleeName().regexpMatch("(?i).*" + s + ".*") |
s = "protect" or s = "encode" or s = "encrypt"
)
}
}
/** A call to any function whose name suggests that it encodes or encrypts its arguments. */
class ProtectSanitizer extends Sanitizer { ProtectSanitizer() { this instanceof ProtectCall } }
/**
* An expression set as a value on a cookie instance.