Skip to content

Commit

Permalink
Push: Do not allow app data to override service fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Apr 29, 2024
1 parent 834736f commit cf65b1a
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -69,6 +69,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;

import javax.net.ssl.SSLContext;
Expand Down Expand Up @@ -562,6 +563,10 @@ private void handleAppMessage(DataMessageStanza msg) {
intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
}
for (AppData appData : msg.app_data) {
if (appData.key == null) continue;
String key = appData.key.toLowerCase(Locale.US);
// Some keys are exclusively set by the client and not the app.
if (key.equals(EXTRA_FROM) || (key.startsWith("google.") && !key.startsWith("google.c."))) continue;
intent.putExtra(appData.key, appData.value_);
}

Expand Down

0 comments on commit cf65b1a

Please sign in to comment.