Skip to content

Commit

Permalink
Restrict walking mode changed broadcast to package
Browse files Browse the repository at this point in the history
Fixes potential privacy leak and lint error:

/home/runner/work/privacy-friendly-pedometer/privacy-friendly-pedometer/app/src/main/java/org/secuso/privacyfriendlyactivitytracker/persistence/WalkingModePersistenceHelper.java:152:
Error: The intent action
org.secuso.privacyfriendlystepcounter.WALKING_MODE_CHANGED (used to send
a broadcast) matches the intent filter of a non-exported component
org.secuso.privacyfriendlyactivitytracker.receivers.StepCountPersistenceReceiver
from a manifest. If you are trying to invoke this specific component via
the action then you should make the intent explicit by calling
Intent.set{Component,Class,ClassName}. [UnsafeImplicitIntentLaunch]
Intent localIntent = new
Intent(BROADCAST_ACTION_WALKING_MODE_CHANGED);
  • Loading branch information
morckx committed Dec 17, 2023
1 parent 23d4aa6 commit cbee29f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public static boolean setActiveMode(WalkingMode mode, Context context) {
boolean success = save(mode, context).isActive();
// broadcast the event
Intent localIntent = new Intent(BROADCAST_ACTION_WALKING_MODE_CHANGED);
localIntent.setPackage(context.getApplicationContext().getPackageName());
localIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
if (currentActiveMode != null) {
localIntent.putExtra(BROADCAST_EXTRA_OLD_WALKING_MODE, currentActiveMode.getId());
Expand Down

0 comments on commit cbee29f

Please sign in to comment.