Repository navigation
Commit e71ed18
authored
[stable] [flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks (#192254)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
#191899
### Impact Description:
When Windows Smart App Control (SAC), Windows Defender Application Control (WDAC), or Group Policy blocks execution of Flutter binaries (such as `dartaotruntime.exe` executing `frontend_server_aot.dart.snapshot`), the Flutter tool crashes with an unhandled `ProcessException` instead of providing an actionable error message. This was the #1 tool crash in Flutter 3.47.1 (accounting for 354 crashes / 16.9% of the top 10 crashes). This fix catches the policy block error codes and displays a clear `ToolExit` explaining how to configure exclusions in Windows Security.
### Changelog Description:
[flutter/191899] When Windows Smart App Control or security policies block binary execution on Windows, gracefully handle the error with an actionable message instead of crashing.
### Workaround:
Manually add an exclusion for the Flutter SDK directory in Windows Security / Smart App Control / WDAC settings, or disable Smart App Control. However, users experiencing the crash currently receive an unhandled stack trace without clear indication of why execution was blocked.
### Risk:
### Test Coverage:
### Validation Steps:
1. Run `flutter test test/general.shard/base/error_handling_io_test.dart` to verify that Windows error codes 4551, 1260, and 454 are mapped to the expected `ToolExit` message.
2. On a Windows machine with Smart App Control or AppLocker configured to block unsigned binaries in user space, run `flutter build` or compile a Flutter project to verify that the tool exits cleanly with the explanatory error message rather than crashing with an unhandled `ProcessException`.1 parent e8113bf commit e71ed18
2 files changed
Lines changed: 56 additions & 0 deletions
File tree
- packages/flutter_tools
- lib/src/base
- test/general.shard/base
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1449 | 1449 | | |
1450 | 1450 | | |
1451 | 1451 | | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
1452 | 1455 | | |
1453 | 1456 | | |
1454 | 1457 | | |
| |||
1477 | 1480 | | |
1478 | 1481 | | |
1479 | 1482 | | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
1480 | 1490 | | |
1481 | 1491 | | |
1482 | 1492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
989 | 992 | | |
990 | 993 | | |
991 | 994 | | |
| |||
1180 | 1183 | | |
1181 | 1184 | | |
1182 | 1185 | | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1183 | 1229 | | |
1184 | 1230 | | |
1185 | 1231 | | |
| |||
0 commit comments