Android 12: Security and privacy - Safer component exporting#16076
Merged
Android 12: Security and privacy - Safer component exporting#16076
Conversation
Exported values are taken from respective guidelines: https://firebase.google.com/docs/cloud-messaging/android/client#manifest https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceIdService
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APKs: |
antonis
approved these changes
Mar 10, 2022
Contributor
antonis
left a comment
There was a problem hiding this comment.
Great work @ashiagr 👍
I tested on a Pixel 5 with Android 12 and everything works as expected. Specifically:
- Activities & Activity Alias
- A. android:exported is set to true
- Validated that the documented errors are solved with the exported set to true ✅
- B. android:exported is set to false for
- TestB.1: Stats widgets configure activities ✅
- TestB.2: Share intent receiver activity ✅
- A. android:exported is set to true
- Services ✅
- Receivers
-
- Stats widget providers ✅
-
NotificationsPendingDraftsReceiver✅
-
The code changes also look consistent to me and I didn't find anything missing according to the documentation 🎉
ps. Thank you for documenting the changes in detail. This helped a lot the review process 🙇
Contributor
Author
|
Thank you @antonis, for taking out time to test it. 🙏 |
3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16064
This PR explicitly declares the
android:exportedattribute in the manifest for activities, services, and receivers including an intent filter as part of (behavior changes: safer component exporting forAndroid 12 - Target SDK Version 31.Note: These changes were simple to be addressed, can exist with the existing
targetSdkVersion=30and so the PR targetstrunk.Review Instructions
Details
Activities & Activity Alias 86f3307 & 86f3307
A.
android:exportedis set totrueforLaunchable activities/ activity-alias
(error shown if
exportedset to false:A launchable activity must be exported as of Android 12, which also makes it available to other apps.)WPLaunchActivityPostsActivity(alias)Activities supporting
ACTION_VIEW(error shown if
exportedset to false:Activity supporting ACTION_VIEW is not exported)LoginMagicLinkInterceptActivityNotificationsSettingsActivityEditPostActivityJetpackConnectionResultActivityDeepLinkingIntentReceiverActivityWPComPostReaderActivity(alias)AddQuickPressShortcutActivity(accessed using widgets)(if
exportedset to false, app crashes with logs)B.
android:exportedis set tofalseforStats widgets configure activities
StatsViewsWidgetConfigureActivityStatsAllTimeWidgetConfigureActivityStatsTodayWidgetConfigureActivityStatsMinifiedWidgetConfigureActivityShareIntentReceiverActivityTesting Instructions (for activities with
android:exported=false)TestB.1: Stats widgets configure activities
B.1and place it on the device screenTestB.2: Share intent receiver activity
Services 89f8b6f
android:exportedfor below services is set based on their respective documentation:GCMMessageService: https://firebase.google.com/docs/cloud-messaging/android/client#manifestInstanceIDService: https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceIdServiceReceivers 534eb3b
android:exportedis set tofalsefor Stats widget providers based on the below guideline:StatsViewsWidgetStatsAllTimeWidgetStatsTodayWidgetStatsMinifiedWidgetNotificationsPendingDraftsReceiver- this receiver is triggered when a draft is scheduled from the app and notification is enabled for it. It doesn't look like we need to export it considering no external process need to broadcast to it.Note that currently these notifications are not shown due to an existing bug: Pending drafts local notifications #14240
Regression Notes
Potential unintended areas of impact
Push notifications (needs to be tested well)
What I did to test those areas of impact (or what existing automated tests I relied on)
See notes and testing instructions
What automated tests I added (or what prevented me from doing so) - N/A
PR submission checklist:
RELEASE-NOTES.txtif necessary.