Skip to content

phase1: integrate Win32k mitigation and UI Job Object into AppContainer runner#308

Merged
MGudgin merged 1 commit into
mainfrom
user/gudge/downlevel_phase1_integrate
May 14, 2026
Merged

phase1: integrate Win32k mitigation and UI Job Object into AppContainer runner#308
MGudgin merged 1 commit into
mainfrom
user/gudge/downlevel_phase1_integrate

Conversation

@MGudgin

@MGudgin MGudgin commented May 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Applies the Win32k disable mitigation (PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY) to the child process at spawn time, alongside the existing SECURITY_CAPABILITIES and (when LPAC) ALL_APPLICATION_PACKAGES_POLICY attributes.
  • Spawns the child CREATE_SUSPENDED, assigns it to a UI-restriction UiJobObject, then resumes — so UI restrictions apply before any code runs in the child.
  • Adds two log lines confirming each step took effect (Win32k mitigation applied to child process, UI Job Object assigned to child process), aiding post-hoc diagnostics.

Test plan

  • cargo check -p wxc -p wxc_common --tests clean on Windows
  • cargo test -p wxc_common passes
  • Manual: run a sandbox under the AppContainer runner with ui_disable=true and confirm child cannot call user32::FindWindowW / cannot open keyboard or window handles in other sessions
  • Manual: verify the two new log lines appear in the diagnostic log when a child spawns successfully

Context

First commit in the BaseContainer-downlevel fallback chain.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 14, 2026 14:42

Copilot AI 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.

Pull request overview

Integrates stronger UI containment into the Windows AppContainer runner by applying Win32k syscall-disable mitigation at process creation time and enforcing UI restrictions via a Windows Job Object before the child begins executing.

Changes:

  • Adds PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY (Win32k disable) to the CreateProcessW attribute list when policy.ui.disable is enabled.
  • Switches child creation to CREATE_SUSPENDED, assigns it to a UiJobObject with resolved UI limits, then resumes the primary thread.
  • Adds a small helper (compute_attr_count) plus unit tests to correctly size the proc-thread attribute list.
Show a summary per file
File Description
src/wxc_common/src/appcontainer_runner.rs Applies Win32k mitigation via startup attributes and enforces UI limits via a Job Object prior to resuming the suspended child process.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread src/wxc_common/src/appcontainer_runner.rs Outdated
Comment thread src/wxc_common/src/appcontainer_runner.rs Outdated
@MGudgin
MGudgin force-pushed the user/gudge/downlevel_phase1_integrate branch from c2d1bb8 to b499fc7 Compare May 14, 2026 15:05
@bbonaby bbonaby mentioned this pull request May 14, 2026
7 tasks
@MGudgin
MGudgin force-pushed the user/gudge/downlevel_phase1_integrate branch from b499fc7 to 1cc2ced Compare May 14, 2026 15:48
…runner

Wires two pre-existing pieces of UI-restriction plumbing into the
AppContainer process-creation path, so downlevel sandboxes (where the
BaseContainer API is unavailable) get the same defenses the
BaseContainer backend already enforces via its SandboxSpec:

- Win32k syscall disable, via PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY
  added to the proc-thread attribute list passed to CreateProcessW.
  Applied when policy.ui.disable is true.
- UI restrictions (clipboard, input injection, IME, global atoms,
  desktop switching, etc.) via JOB_OBJECT_UILIMIT_* on a UiJobObject
  the child is assigned to. Drawn from ui_policy::resolve_ui_restrictions.

Both restrictions must take effect *before* the child runs any code,
otherwise the un-restricted prelude is a window of opportunity. The
runner therefore now creates the child CREATE_SUSPENDED, creates the
job and assigns the process while the child is still parked, and only
then ResumeThreads. The CREATE_SUSPENDED window is treated as
fail-closed: any error between CreateProcess and ResumeThread runs
TerminateProcess on the suspended child so a sandboxed-but-unrestricted
process can never escape into execution.

Two diagnostic log lines confirm each mitigation took effect at runtime
("Win32k mitigation applied to child process", "UI Job Object assigned
to child process"), aiding post-hoc diagnosis on systems where these
APIs may silently degrade.

Adds compute_attr_count() to size the proc-thread attribute list as a
function of which mitigations are active for the current policy, plus
unit tests covering the four (LPAC × ui-disable) combinations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MGudgin
MGudgin force-pushed the user/gudge/downlevel_phase1_integrate branch from 1cc2ced to 8cc6e01 Compare May 14, 2026 19:16
@alexsnitkovskiy alexsnitkovskiy self-assigned this May 14, 2026
@MGudgin
MGudgin merged commit b96b2bb into main May 14, 2026
15 checks passed
@MGudgin
MGudgin deleted the user/gudge/downlevel_phase1_integrate branch May 14, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants