Optimize the query

This commit is contained in:
luchua-bc
2021-01-06 16:21:26 +00:00
parent ad0ac5b874
commit 5690bf49f4
2 changed files with 6 additions and 11 deletions

View File

@@ -35,7 +35,7 @@ private predicate sharedPreferencesStore(DataFlow::Node sharedPrefs, Expr store)
}
/** Flow from `SharedPreferences` to either a setter or a store method. */
class SharedPreferencesFlowConfig extends TaintTracking::Configuration {
class SharedPreferencesFlowConfig extends DataFlow::Configuration {
SharedPreferencesFlowConfig() {
this = "CleartextStorageSharedPrefs::SharedPreferencesFlowConfig"
}
@@ -65,7 +65,7 @@ class EncryptedValueFlowConfig extends DataFlow5::Configuration {
EncryptedValueFlowConfig() { this = "CleartextStorageSharedPrefs::EncryptedValueFlowConfig" }
override predicate isSource(DataFlow5::Node src) {
exists(EncryptedSensitiveMethodAccess ema | src.asExpr() = ema.getAnArgument())
exists(EncryptedSensitiveMethodAccess ema | src.asExpr() = ema)
}
override predicate isSink(DataFlow5::Node sink) {
@@ -74,13 +74,6 @@ class EncryptedValueFlowConfig extends DataFlow5::Configuration {
sink.asExpr() = ma.getArgument(1)
)
}
override predicate isAdditionalFlowStep(DataFlow5::Node n1, DataFlow5::Node n2) {
exists(EncryptedSensitiveMethodAccess ema |
n1.asExpr() = ema.getAnArgument() and
n2.asExpr() = ema
)
}
}
/** Flow from the create method of `androidx.security.crypto.EncryptedSharedPreferences` to its instance. */
@@ -109,7 +102,7 @@ class SharedPreferencesEditor extends MethodAccess {
)
}
/** Gets an input, for example `input` in `editor.putString("password", password);`. */
/** Gets an input, for example `password` in `editor.putString("password", password);`. */
Expr getAnInput() {
exists(SharedPreferencesFlowConfig conf, DataFlow::Node n |
sharedPreferencesInput(n, result) and

View File

@@ -1,4 +1,6 @@
import semmle.code.java.Type
/** Provides classes related to `android.content.SharedPreferences`. */
import java
/** Definitions related to `android.content.SharedPreferences`. */
module SharedPreferences {