A PendingIntent is created without saying whether it is immutable
What it finds
A PendingIntent created with flags 0 is mutable on older Android versions, so the app that receives it can fill in or change the intent and act with this app's identity. Since Android 12 the call throws unless FLAG_IMMUTABLE or FLAG_MUTABLE is given. Reported when the flags are a literal or name neither.
From the rule's source, mutable_pending_intent.rs.
fun intents(context: Context, intent: Intent) { val a = PendingIntent.getActivity(context, 0, intent, 0)tx0 reports: the pending intent does not say whether it is immutable val b = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)tx0 reports: does not say whether it is immutable val c = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE) val d = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE) val e = PendingIntent.getActivity(context, 0, intent, flags())} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/kotlin:pending-intent-without-mutability" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/kotlin:pending-intent-without-mutability] reason="..."tx0 explain tx0/kotlin:pending-intent-without-mutability shows the same in the terminal. Found a false positive? Report it.