Skip to content

[stable] [flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks - #192254

Merged
auto-submit[bot] merged 1 commit into
flutter:flutter-3.47-candidate.0from
flutteractionsbot:cp-stable-adb776015b43e393373cb72e97a4d79bea4d6395
Sep 9, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:flutter-3.47-candidate.0from
flutteractionsbot:cp-stable-adb776015b43e393373cb72e97a4d79bea4d6395

Conversation

@flutteractionsbot

@flutteractionsbot flutteractionsbot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is created by automatic cherry pick workflow
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:

  • Low
  • Medium
  • High

Test Coverage:

  • Yes
  • No

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.

…urity policy execution blocks (flutter#191912)

When Windows Smart App Control (SAC), Windows Defender Application
Control (WDAC), or Group Policy blocks execution of Flutter binaries
(such as `dartaotruntime.exe` during frontend_server compilation),
Dart's Win32 process runner raises a `ProcessException` with Win32 error
code 4551 (`ERROR_APPLICATION_CONTROL_POLICY_BLOCK`), 1260
(`ERROR_ACCESS_DISABLED_BY_POLICY`), or 454
(`ERROR_SYSTEM_INTEGRITY_POLICY_VIOLATION`).

Previously, `_handleWindowsException` did not recognize these error
codes and returned `null`, which resulted in an unhandled
`ProcessException` crash report (accounting for 354 crashes in Flutter
3.47.1).

This PR catches these security and application control policy error
codes in `_handleWindowsException` and surfaces a clean, actionable
`ToolExit` instructing users to check their Windows Security Smart App
Control, WDAC, or Group Policy settings and configure an exclusion for
the Flutter SDK directory.

Fixes flutter#191899
@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Sep 3, 2026
@flutteractionsbot

Copy link
Copy Markdown
Contributor Author

@bkonyi please fill out the PR description above, afterwards the release team will review this request.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 3, 2026
@flutter-dashboard

Copy link
Copy Markdown

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Sep 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds handling for Windows-specific security policy execution blocks (error codes 4551, 1260, and 454) in error_handling_io.dart, throwing a descriptive ToolExit message suggesting checking Windows Security settings or adding an exclusion. It also adds corresponding unit tests in error_handling_io_test.dart to verify this behavior. There are no review comments, and I have no feedback to provide.

@bkonyi bkonyi changed the title [CP-stable][flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks [stable] [flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks Sep 3, 2026
@walley892

Copy link
Copy Markdown
Contributor

@bkonyi, can you add a secondary reviewer on this PR?

@bkonyi
bkonyi requested a review from dcharkes September 9, 2026 16:54
@bkonyi

bkonyi commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Done! @dcharkes, would you mind rubber stamping this? :)

@walley892 walley892 added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 9, 2026
@auto-submit
auto-submit Bot merged commit e71ed18 into flutter:flutter-3.47-candidate.0 Sep 9, 2026
12 checks passed
@flutteractionsbot
flutteractionsbot deleted the cp-stable-adb776015b43e393373cb72e97a4d79bea4d6395 branch September 9, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD cp: review Cherry-picks in the review queue tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants