Skip to content

Commit 1dffbcd

Browse files
committed
Fix tests disrupted by re-modelling and stubbing Android 9:
* Account for changed dataflow graph shape using external flow * Account for BaseBundle only existing as of Android 5 * Properly implement Parcelable, which we previously got away with due to a partial stub * Restore an Android 11 function that had been added to the Android 9 Context class (I won't get into enforcing the difference in this PR)
1 parent 81c0e66 commit 1dffbcd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2083
-3
lines changed

java/ql/lib/semmle/code/java/frameworks/android/Android.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,12 @@ class CreateFromParcelMethod extends Method {
221221

222222
private class TaintPropagationModels extends SummaryModelCsv {
223223
override predicate row(string s) {
224-
// BaseBundle getters
224+
// BaseBundle getters. These are also modelled on Bundle because BaseBundle was factored out of Bundle
225+
// in Android 5.0; before that these methods were declared directly on Bundle.
225226
s =
226-
"android.os;BaseBundle;true;get" + ["Boolean", "Double", "Int", "Long", "String"] +
227-
["", "Array"] + ";;;Argument[-1];ReturnValue;taint"
227+
"android.os;" + ["BaseBundle", "Bundle"] + ";true;get" +
228+
["Boolean", "Double", "Int", "Long", "String"] + ["", "Array"] +
229+
";;;Argument[-1];ReturnValue;taint"
228230
or
229231
// Bundle getters
230232
s =

java/ql/test/query-tests/security/CWE-502/ParcelableEntity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public void writeToParcel(Parcel parcel, int i) {
2121
parcel.writeString(GSON.toJson(obj));
2222
}
2323

24+
@Override
25+
public int describeContents() { return 0; }
26+
2427
public static final Parcelable.Creator CREATOR = new Creator<ParcelableEntity>() {
2528
@Override
2629
public ParcelableEntity createFromParcel(Parcel parcel) {

java/ql/test/stubs/google-android-9.0.0/android/content/ClipData.java

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/android/content/ClipDescription.java

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/android/content/ComponentCallbacks.java

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/android/content/ComponentCallbacks2.java

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/android/content/ContentProviderClient.java

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/android/content/ContentProviderOperation.java

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/android/content/ContentProviderResult.java

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)