-
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand fix for potential Privilege Escalation via Content Provider (C…
- Loading branch information
Showing
6 changed files
with
72 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
sentry-android-core/src/main/java/io/sentry/android/core/EmptySecureContentProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.sentry.android.core; | ||
|
||
import android.content.ContentProvider; | ||
import android.content.ContentValues; | ||
import android.database.Cursor; | ||
import android.net.Uri; | ||
import io.sentry.android.core.internal.util.ContentProviderSecurityChecker; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* A ContentProvider that does NOT store or provide any data for read or write operations. | ||
* | ||
* <p>This does not allow for overriding the abstract query, insert, update, and delete operations | ||
* of the {@link ContentProvider}. Additionally, those functions are secure. | ||
*/ | ||
@ApiStatus.Internal | ||
abstract class EmptySecureContentProvider extends ContentProvider { | ||
|
||
private final ContentProviderSecurityChecker securityChecker = | ||
new ContentProviderSecurityChecker(); | ||
|
||
@Override | ||
public final @Nullable Cursor query( | ||
@NotNull Uri uri, | ||
@Nullable String[] strings, | ||
@Nullable String s, | ||
@Nullable String[] strings1, | ||
@Nullable String s1) { | ||
securityChecker.checkPrivilegeEscalation(this); | ||
return null; | ||
} | ||
|
||
@Override | ||
public final @Nullable Uri insert(@NotNull Uri uri, @Nullable ContentValues contentValues) { | ||
securityChecker.checkPrivilegeEscalation(this); | ||
return null; | ||
} | ||
|
||
@Override | ||
public final int delete(@NotNull Uri uri, @Nullable String s, @Nullable String[] strings) { | ||
securityChecker.checkPrivilegeEscalation(this); | ||
return 0; | ||
} | ||
|
||
@Override | ||
public final int update( | ||
@NotNull Uri uri, | ||
@Nullable ContentValues contentValues, | ||
@Nullable String s, | ||
@Nullable String[] strings) { | ||
securityChecker.checkPrivilegeEscalation(this); | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters