Add value-preserving steps for SharedPreferences

This commit is contained in:
Tony Torralba
2022-04-22 17:44:59 +02:00
parent ebdf553621
commit f1c08bc492
3 changed files with 26 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ private module Frameworks {
private import semmle.code.java.frameworks.android.ContentProviders
private import semmle.code.java.frameworks.android.Intent
private import semmle.code.java.frameworks.android.Notifications
private import semmle.code.java.frameworks.android.SharedPreferences
private import semmle.code.java.frameworks.android.Slice
private import semmle.code.java.frameworks.android.SQLite
private import semmle.code.java.frameworks.android.Widget

View File

@@ -1,6 +1,7 @@
/** Provides classes related to `android.content.SharedPreferences`. */
import java
import semmle.code.java.dataflow.ExternalFlow
/** The interface `android.content.SharedPreferences`. */
class SharedPreferences extends Interface {
@@ -55,3 +56,19 @@ class StoreSharedPreferenceMethod extends Method {
this.hasName(["commit", "apply"])
}
}
private class SharedPreferencesSummaries extends SummaryModelCsv {
override predicate row(string row) {
row =
[
"android.content;SharedPreferences$Editor;true;clear;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;putBoolean;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;putFloat;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;putInt;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;putLong;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;putString;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;putStringSet;;;Argument[-1];ReturnValue;value",
"android.content;SharedPreferences$Editor;true;remove;;;Argument[-1];ReturnValue;value"
]
}
}