Add additional test cases

This commit is contained in:
Joe Farebrother
2024-01-11 16:14:27 +00:00
parent f9bb004618
commit a1a2acd3ce
2 changed files with 18 additions and 0 deletions

View File

@@ -10,6 +10,10 @@ private module NotificationTrackingConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof SensitiveExpr }
predicate isSink(DataFlow::Node sink) { sinkNode(sink, "notification") }
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet c) {
isSink(node) and exists(c)
}
}
/** Taint tracking flow for sensitive data flowing to system notifications. */

View File

@@ -1,6 +1,8 @@
import android.app.Activity;
import android.app.Notification;
import androidx.core.app.NotificationCompat;
import android.content.Intent;
import android.app.PendingIntent;
class Test extends Activity {
void test(String password) {
@@ -12,5 +14,17 @@ class Test extends Activity {
void test2(String password) {
Notification.Builder builder = new Notification.Builder(this, "");
builder.setContentText(password); // $sensitive-notification
builder.setContentTitle(password); // $sensitive-notification
builder.addAction(0, password, null); // $sensitive-notification
builder.addAction(new Notification.Action(0, password, null)); // $sensitive-notification
// builder.setStyle( // TODO: update stubs to include MessagingStyle
// new Notification.MessagingStyle(password) // $sensitive-notification
// .setConversationTitle(password)) // $sensitive-notification
// .addMessage(password, 0, null); // $sensitive-notification
builder.setStyle(new Notification.BigTextStyle().bigText(password)); // $sensitive-notification
Intent intent = new Intent();
intent.putExtra("a", password);
builder.setContentIntent(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)); // $MISSING: sensitive-notification // missing model for getActivity
}
}