Skip to content

Commit 4759fcb

Browse files
[Android] Refuse external setters of engine entrypoint and cached engine arguments via Intents (flutter#190249)
> [!WARNING] > This is a breaking change. Though the motivation for this change is the security of our users and migration to accommodate this change is critical, I looked at some top plugins that _might_ have been impacted to ensure they won't be broken: All 1P plugins, [`firebase_messaging`](https://pub.dev/packages/firebase_messaging) v16.5.0, [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications) v22.3.0, [`awesome_notifications`](https://pub.dev/packages/awesome_notifications) v0.12.1, [`android_alarm_manager_plus`](https://pub.dev/packages/android_alarm_manager_plus) v5.1.1, [`receive_sharing_intent`](https://pub.dev/packages/receive_sharing_intent) v1.9.0, [`onesignal_flutter`](https://pub.dev/packages/onesignal_flutter), [`workmanager`](https://pub.dev/packages/workmanager) v0.10.7 [`flutter_background_service`](https://pub.dev/packages/flutter_background_service) v5.1.0, [`app_links`](https://pub.dev/packages/app_links) v7.2.1, [`uni_links`](https://pub.dev/packages/uni_links) v0.5.1 Changes the embedding to only allow setting app launch entry-point and cached engine related arguments via `Intent`s in debug/profile mode or when the `Intent` sender is verifiably the app itself. This hardens the embedding against arbitrary argument injection by a malicious actor, preventing unauthorized access to sensitive app routes and engine controls. Below Android 13, it is impossible to verify the `Intent` sender is verifiably the app itself in all cases, so apps/plugins that do not migrate and run on those versions will be impacted. In debug/profile modes, if an unverified `Intent` attempts to set these arguments, the embedding now logs a detailed warning containing the target component, the intent details, and the specific `Intent` extra keys that triggered the verification failure. It also links to the breaking changes migration guide for help on migrating: flutter/website#13645 For deep links, the `Intent` is compared against the app's `Intent` filters to ensure the app should allow that link. This is standard for the OS; see [Android's Intents and Intent Filters documentation](https://developer.android.com/guide/components/intents-filters) for more information on that. Fixes flutter#190452 and fixes flutter#190450. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent c11ae55 commit 4759fcb

17 files changed

Lines changed: 1875 additions & 86 deletions

‎.ci.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,6 +3169,15 @@ targets:
31693169
["devicelab", "linux"]
31703170
task_name: android_engine_flags_debug_test
31713171

3172+
- name: Linux_android_emu android_intent_security_test
3173+
recipe: devicelab/devicelab_drone
3174+
bringup: true
3175+
timeout: 60
3176+
properties:
3177+
tags: >
3178+
["devicelab", "linux"]
3179+
task_name: android_intent_security_test
3180+
31723181
- name: Linux_android_emu android_engine_flags_release_test
31733182
recipe: devicelab/devicelab_drone
31743183
timeout: 60

‎TESTOWNERS‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
/dev/devicelab/bin/tasks/analyzer_benchmark.dart @bkonyi @flutter/tool
1313
/dev/devicelab/bin/tasks/android_choreographer_do_frame_test.dart @reidbaker @flutter/engine
1414
/dev/devicelab/bin/tasks/android_defines_test.dart @jesswrd @flutter/android
15+
/dev/devicelab/bin/tasks/android_engine_flags_debug_test.dart @camsim99 @flutter/android
16+
/dev/devicelab/bin/tasks/android_engine_flags_release_test.dart @camsim99 @flutter/android
17+
/dev/devicelab/bin/tasks/android_intent_security_test.dart @camsim99 @flutter/android
1518
/dev/devicelab/bin/tasks/android_java11_dependency_smoke_tests.dart @jesswrd @flutter/android
1619
/dev/devicelab/bin/tasks/android_java17_dependency_smoke_tests.dart @jesswrd @flutter/android
1720
/dev/devicelab/bin/tasks/android_lifecycles_test.dart @reidbaker @flutter/engine
@@ -116,8 +119,6 @@
116119
/dev/devicelab/bin/tasks/web_size__compile_test.dart @yjbanov @flutter/web
117120
/dev/devicelab/bin/tasks/wide_gamut_ios.dart @gaaclarke @flutter/engine
118121
/dev/devicelab/bin/tasks/wide_gamut_macos.dart @gaaclarke @flutter/engine
119-
/dev/devicelab/bin/tasks/android_engine_flags_debug_test.dart @camsim99 @flutter/android
120-
/dev/devicelab/bin/tasks/android_engine_flags_release_test.dart @camsim99 @flutter/android
121122

122123
## Windows Android DeviceLab tests
123124
/dev/devicelab/bin/tasks/basic_material_app_win__compile.dart @bkonyi @flutter/tool
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_devicelab/framework/framework.dart';
6+
import 'package:flutter_devicelab/tasks/android_intent_security_test.dart';
7+
8+
Future<void> main() async {
9+
await task(androidIntentSecurityTest());
10+
}

0 commit comments

Comments
 (0)