【问题标题】:Google denied update due Remediation for Implicit PendingIntent Vulnerability由于隐式 PendingIntent 漏洞的补救措施,Google 拒绝了更新
【发布时间】:2021-09-06 08:20:06
【问题描述】:

当我尝试更新我的应用时 - 我在审核过程中遇到了错误。隐式 PendingIntent 漏洞的修复 - https://support.google.com/faqs/answer/10437428。在我的应用程序中,我正在创建 PendingIntent - 用于 Firebase 推送通知:

内部类 FCMService 扩展 FirebaseMessagingService

@Override
    public void onMessageReceived(@NotNull RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        Intent intent = new Intent(this, ApplicationActivity.class);
        intent.setAction("com.google.firebase.MESSAGING_EVENT");
        intent.setPackage(getApplicationContext().getPackageName());

        Map<String, String> data = remoteMessage.getData();
        for (Map.Entry<String, String> entry : data.entrySet()) {
            String value = entry.getValue();
            String key = entry.getKey();
            if (key.equals(ApplicationActivity.LINK_URL) ||
                    key.equals(ApplicationActivity.FLOCKTORY_LINK_URL)) {
                intent.putExtra(ApplicationActivity.FLOCKTORY_LINK_URL, value);
                if (remoteMessage.getNotification() != null && remoteMessage.getNotification().getTitle() != null) {
                    intent.putExtra(ApplicationActivity.HMS_PUSH_TITLE, remoteMessage.getNotification().getTitle());
                }
            }
        }

        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);

        RemoteMessage.Notification notification = remoteMessage.getNotification();
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this, getString(R.string.channel_id))
                .setSmallIcon(R.drawable.ic_launcher_notification)
                .setColor(getResources().getColor(R.color.colorNotification))
                .setContentTitle(notification == null ? "" : notification.getTitle())
                .setContentText(notification == null ? "" : notification.getBody())
                .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                .setContentIntent(pendingIntent)
                .setAutoCancel(true);

        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
        notificationManager.notify(new Random(UUID.randomUUID().getLeastSignificantBits()).nextInt(), builder.build());

在清单中:

<service
            android:name="ru.svyaznoy.shop.domain.FCMService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

实现“com.google.firebase:firebase-messaging:22.0.0”

minSdkVersion 24 targetSdkVersion 30

我只是无法弄清楚这段代码有什么问题 - 我通过明确的 Intent 并设置了所有必填字段。我头晕目眩——这次更新非常重要。有没有人遇到过类似的问题?

【问题讨论】:

  • 这里也一样。谷歌没有解释。
  • @Amit@dephinera,我已经在下面发布了我的答案,请参考。

标签: java android google-play huawei-mobile-services huawei-push-notification


【解决方案1】:

您示例中的意图是具有给定操作的显式意图。所以这不应该是您的更新问题的原因。

我面临同样的安全问题,我认为这是依赖关系。因为我的应用中只有明确的待处理意图。

我认为谷歌不会因为他们自己的库中的漏洞而阻止更新,所以我目前正在研究华为 SDK 的依赖关系。这只是一个猜测,但没有来自 Play 商店的更多信息,我们唯一能做的就是猜测。

【讨论】:

  • 我们也有华为的依赖 - 将在此处查看并分享结果。
  • 你们在华为 SDK 中找到什么了吗?它们是开源的,还是您正在检查类文件?我找不到回购
  • 我现在正在为 Google Play 版本隔离 huwaei 依赖项。我想从捆绑包中排除这些库并再次尝试更新。这将给出直接的答案。希望明天会发现。
  • 我们已经收到谷歌的详细回复,他们说问题是com.huawei.hms.push.o.a,是华为。我们现在也在构建没有任何适用于 Google Play 的华为包。
  • 这就是问题 - 华为推送库。我们已经在没有那个库的情况下向 Google 发送了邮件,并且我们获得了批准。
【解决方案2】:

感谢@kkazakov 问题解决了。库 com.huawei.hms:push 包含隐式 PendingIntents 的不安全使用。 Google 批准了没有此库的构建更新。

对我来说,是时候创建 gms 和 hms 构建风格,以避免将来与华为出现问题。

【讨论】:

    【解决方案3】:

    感谢您的反馈。此问题已在 Push SDK 5.3.0.304 版本中得到解决。 它已经过开发者的测试和验证,可以被谷歌批准发布。

    详情可以查看Push kit Version Change History description

    【讨论】:

      猜你喜欢
      • 2011-06-20
      • 1970-01-01
      • 1970-01-01
      • 2022-08-20
      • 1970-01-01
      • 2014-12-16
      • 1970-01-01
      • 1970-01-01
      • 2012-08-12
      相关资源
      最近更新 更多