mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Add new AlarmManager sinks
This commit is contained in:
@@ -2,6 +2,7 @@ package com.example.test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import android.app.Activity;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@@ -217,6 +218,28 @@ public class ImplicitPendingIntentsTest {
|
||||
|
||||
}
|
||||
|
||||
public static void testPendingIntentInAnAlarm(Context ctx) {
|
||||
AlarmManager aManager = (AlarmManager) ctx.getSystemService(Context.ALARM_SERVICE);
|
||||
{
|
||||
Intent baseIntent = new Intent();
|
||||
PendingIntent pi = PendingIntent.getActivity(ctx, 0, baseIntent, 0);
|
||||
aManager.set(0, 0, pi); // $hasImplicitPendingIntent
|
||||
aManager.setAlarmClock(null, pi); // $hasImplicitPendingIntent
|
||||
aManager.setAndAllowWhileIdle(0, 0, pi); // $hasImplicitPendingIntent
|
||||
aManager.setExact(0, 0, pi); // $hasImplicitPendingIntent
|
||||
aManager.setExactAndAllowWhileIdle(0, 0, pi); // $hasImplicitPendingIntent
|
||||
aManager.setInexactRepeating(0, 0, 0, pi); // $hasImplicitPendingIntent
|
||||
aManager.setRepeating(0, 0, 0, pi); // $hasImplicitPendingIntent
|
||||
aManager.setWindow(0, 0, 0, pi); // $hasImplicitPendingIntent
|
||||
}
|
||||
{
|
||||
Intent baseIntent = new Intent();
|
||||
PendingIntent pi =
|
||||
PendingIntent.getActivity(ctx, 0, baseIntent, PendingIntent.FLAG_IMMUTABLE); // Sanitizer
|
||||
aManager.set(0, 0, pi); // Safe
|
||||
}
|
||||
}
|
||||
|
||||
static class TestActivity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
|
||||
Reference in New Issue
Block a user