Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f13b881

Browse files
committed
Update class/method names in the module
1 parent 5690bf4 commit f13b881

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

java/ql/src/experimental/Security/CWE/CWE-312/CleartextStorageSharedPrefs.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ private class EncryptedSharedPrefFlowConfig extends DataFlow4::Configuration {
8383
}
8484

8585
override predicate isSource(DataFlow4::Node src) {
86-
src.asExpr().(MethodAccess).getMethod() instanceof SharedPreferences::CreateEncryptedPrefsMethod
86+
src.asExpr().(MethodAccess).getMethod() instanceof SharedPreferences::CreateEncryptedMethod
8787
}
8888

8989
override predicate isSink(DataFlow4::Node sink) {
90-
sink.asExpr().getType() instanceof SharedPreferences::TypePrefs
90+
sink.asExpr().getType() instanceof SharedPreferences::TypeBase
9191
}
9292
}
9393

java/ql/src/semmle/code/java/frameworks/android/SharedPreferences.qll

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,35 @@ import java
55
/** Definitions related to `android.content.SharedPreferences`. */
66
module SharedPreferences {
77
/** The interface `android.content.SharedPreferences` */
8-
class TypePrefs extends Interface {
9-
TypePrefs() { hasQualifiedName("android.content", "SharedPreferences") }
8+
class TypeBase extends Interface {
9+
TypeBase() { hasQualifiedName("android.content", "SharedPreferences") }
1010
}
1111

1212
/** The class `androidx.security.crypto.EncryptedSharedPreferences`, which implements `SharedPreferences` with encryption support. */
13-
class TypeEncryptedPrefs extends Class {
14-
TypeEncryptedPrefs() {
15-
hasQualifiedName("androidx.security.crypto", "EncryptedSharedPreferences")
16-
}
13+
class TypeEncrypted extends Class {
14+
TypeEncrypted() { hasQualifiedName("androidx.security.crypto", "EncryptedSharedPreferences") }
1715
}
1816

1917
/** The create method of `androidx.security.crypto.EncryptedSharedPreferences` */
20-
class CreateEncryptedPrefsMethod extends Method {
21-
CreateEncryptedPrefsMethod() {
22-
getDeclaringType() instanceof TypeEncryptedPrefs and
18+
class CreateEncryptedMethod extends Method {
19+
CreateEncryptedMethod() {
20+
getDeclaringType() instanceof TypeEncrypted and
2321
hasName("create")
2422
}
2523
}
2624

2725
/** A getter method of `android.content.SharedPreferences`. */
2826
class GetPreferenceMethod extends Method {
2927
GetPreferenceMethod() {
30-
getDeclaringType() instanceof TypePrefs and
28+
getDeclaringType() instanceof TypeBase and
3129
getName().matches("get%")
3230
}
3331
}
3432

3533
/** Returns `android.content.SharedPreferences.Editor` from the `edit` call of `android.content.SharedPreferences`. */
3634
class GetEditorMethod extends Method {
3735
GetEditorMethod() {
38-
getDeclaringType() instanceof TypePrefs and
36+
getDeclaringType() instanceof TypeBase and
3937
hasName("edit") and
4038
getReturnType() instanceof TypeEditor
4139
}

0 commit comments

Comments
 (0)