Skip to content

Downlevel Phase 5 - integration#410

Merged
MGudgin merged 1 commit into
mainfrom
user/gudge/downlevel_phase5
May 26, 2026
Merged

Downlevel Phase 5 - integration#410
MGudgin merged 1 commit into
mainfrom
user/gudge/downlevel_phase5

Conversation

@MGudgin

@MGudgin MGudgin commented May 26, 2026

Copy link
Copy Markdown
Member

This PR integrates the downlevel work done in previous phases such that the
feature works end-to-end. Currently only T3 is supported downlevel. There is a
compile-time tier2_bfs feature that keeps T2 unreachable in production
builds on hosts where bfscfg.exe hangs the OS (Windows 11 25H2).
Crash-safe host-DACL augmentation backs T3.

Details:

  • New tier2_bfs Cargo feature; off by default; gates both probe-time
    discovery and runtime spawn of bfscfg.exe.
  • DaclManager with per-process state files under
    %LOCALAPPDATA%\Microsoft\MXC\dacl-restore, surgical canonical-order
    DACL rewrite, and orphan reaping on next wxc-exec --probe.
  • wxc-exec --probe exposes tier decision + warnings; SDK
    getPlatformSupport() surfaces them as isolationTier /
    isolationWarnings.
  • New wxc_ui_probe binary for in-sandbox JOB_OBJECT_UILIMIT and
    Win32k-mitigation telemetry.

Test:

  • Win25H2Safe-Tests.ps1 harness: 78/81 (3 known UI-policy gaps).
  • T3-Workloads.ps1 smoke suite: 7/10 (3 known AC NUL-device denials).
  • wxc_common cargo test: 388/388 feature-off, 396/396 feature-on.
  • SDK npm test: 151 pass.
  • CI matrix now exercises --features tier2_bfs on x64 + arm64.
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings May 26, 2026 15:07

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

This PR completes “downlevel phase 5” end-to-end integration by (1) compile-time gating Tier 2 BFS (bfscfg.exe) behind a tier2_bfs feature, (2) adding a read-only wxc-exec --probe JSON surface that the TypeScript SDK consumes via getPlatformSupport(), and (3) hardening Tier 3 (AppContainer + DACL) behavior via crash-safe DACL state management and new validation harnesses.

Changes:

  • Add wxc-exec --probe + wxc_common::probe and wire it into the SDK’s getPlatformSupport() as isolationTier / isolationWarnings.
  • Introduce tier2_bfs feature gating for BFS discovery + invocation, plus related dispatcher/detector logic updates.
  • Add wxc-ui-probe (in-sandbox UI restriction telemetry) and new PowerShell harness scripts; update CI to test --features tier2_bfs.
Show a summary per file
File Description
test_scripts/Win25H2Safe-Tests.ps1 New safety-focused harness validating Tier 3 + DACL recovery behavior on 25H2 without invoking bfscfg.exe.
test_scripts/T3-Workloads.ps1 New workload-oriented script exploring what can run under Tier 3 (AppContainer + DACL) on 25H2.
src/wxc/src/main.rs Adds --probe and introduces Ctrl-handler-driven DACL cleanup via a global parked DaclManager.
src/wxc/Cargo.toml Forwards the tier2_bfs feature to wxc_common.
src/wxc_ui_probe/src/main.rs New Windows UI-mitigation probe binary (JOB_OBJECT_UILIMIT + Win32k mitigation).
src/wxc_ui_probe/Cargo.toml Declares the wxc-ui-probe binary crate.
src/wxc_common/src/test_env.rs Feature-gates MXC_BFSCFG_PATH test seam guard behind tier2_bfs.
src/wxc_common/src/probe.rs New serde-friendly probe surface (ProbeOutput) used by wxc-exec --probe.
src/wxc_common/src/lib.rs Exposes the new probe module on Windows.
src/wxc_common/src/filesystem_dacl.rs Improves DACL state-file robustness, adds canonical DACL rebuild path + effective-access computation + tests.
src/wxc_common/src/filesystem_bfs.rs Adds defense-in-depth gating so bfscfg.exe cannot be invoked without tier2_bfs.
src/wxc_common/src/fallback_detector.rs Adds tier2_bfs gating for bfscfg discovery and refines WRITE_DAC checks via effective-access inspection.
src/wxc_common/src/dispatcher.rs Makes Dispatched extraction safer (private fields + into_runner_and_guard), adds grant-filtering, improves DACL error shape.
src/wxc_common/Cargo.toml Introduces the tier2_bfs feature (off by default).
src/Cargo.toml Adds wxc_ui_probe to the Rust workspace members.
src/Cargo.lock Adds wxc_ui_probe package entry.
sdk/tests/unit/platform.test.ts New unit tests for getPlatformSupport() probe integration + findWxcExecutable() failure modes.
sdk/src/types.ts Adds IsolationTier type and extends PlatformSupport with isolation fields.
sdk/src/platform.ts Adds cached getPlatformSupport() and a wxc-exec --probe integration path with test injection seam.
sdk/src/index.ts Re-exports IsolationTier.
sdk/package.json Includes the new platform.test.js in the unit test suite.
.gitignore Ignores .copilot/ and .claude/ directories.
.github/workflows/build.yml Adds CI coverage for cargo test -p wxc_common --features tier2_bfs.

Copilot's findings

  • Files reviewed: 21/23 changed files
  • Comments generated: 4

Comment thread src/wxc/src/main.rs Outdated
Comment thread src/wxc/src/main.rs Outdated
Comment thread test_scripts/Win25H2Safe-Tests.ps1
Comment thread test_scripts/T3-Workloads.ps1
@MGudgin
MGudgin force-pushed the user/gudge/downlevel_phase5 branch from f338488 to f9dcdef Compare May 26, 2026 15:21
This PR integrates the downlevel work done in previous phases such that the
feature works end-to-end. Currently only T3 is supported downlevel. There is a
compile-time `tier2_bfs` feature that keeps T2 unreachable in production
builds on hosts where `bfscfg.exe` hangs the OS (Windows 11 25H2).
Crash-safe host-DACL augmentation backs T3.

Details:
- New `tier2_bfs` Cargo feature; off by default; gates both probe-time
  discovery and runtime spawn of `bfscfg.exe`.
- `DaclManager` with per-process state files under
  `%LOCALAPPDATA%\Microsoft\MXC\dacl-restore`, surgical canonical-order
  DACL rewrite, and orphan reaping on next `wxc-exec --probe`.
- `wxc-exec --probe` exposes tier decision + warnings; SDK
  `getPlatformSupport()` surfaces them as `isolationTier` /
  `isolationWarnings`.
- New `wxc_ui_probe` binary for in-sandbox JOB_OBJECT_UILIMIT and
  Win32k-mitigation telemetry.

Test:
- Win25H2Safe-Tests.ps1 harness: 78/81 (3 known UI-policy gaps).
- T3-Workloads.ps1 smoke suite: 7/10 (3 known AC NUL-device denials).
- wxc_common cargo test: 388/388 feature-off, 396/396 feature-on.
- SDK npm test: 151 pass.
- CI matrix now exercises `--features tier2_bfs` on x64 + arm64.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MGudgin
MGudgin force-pushed the user/gudge/downlevel_phase5 branch from f9dcdef to 97dc095 Compare May 26, 2026 16:03
@MGudgin
MGudgin merged commit 332c71c into main May 26, 2026
18 checks passed
@MGudgin
MGudgin deleted the user/gudge/downlevel_phase5 branch May 26, 2026 17:39
MGudgin added a commit that referenced this pull request May 28, 2026
* ci: stop shipping tier2_bfs in ADO-built release binaries

The `1ES.Build.Rust.Run@1` task defaults to `--all-features` when no
`features:` input is supplied. That was harmless until commit 8c57211
("feat(wxc_common): gate Tier 2 (BFS) behind tier2_bfs Cargo feature")
landed via #410 on 2026-05-26, which introduced `tier2_bfs` with the
explicit constraint that production binaries on Win 11 25H2 must NOT
carry it; otherwise the embedded `bfscfg.exe` invocation risks an OS
hang. The GH Actions workflow already respects this — its build line
in `.github/workflows/build.yml` does not pass `--all-features` — but
the ADO pipeline silently enables every feature including `tier2_bfs`,
and ships that binary via `release-binaries.zip` and the npm SDK.

Confirmed by inspecting the actual `Cargo build (1ES PT)` step log of
build 147990337 (PR #434):

    Running: cargo build --locked --offline
        --target x86_64-pc-windows-msvc --profile release --all-features

Override the task default by setting `allFeatures: false` and listing
the production feature set explicitly. This keeps every runtime backend
that IS intended for production (`hyperlight`, `isolation_session`,
`microvm`, `wslc`) compiled in while dropping `tier2_bfs`.

Lint.Job.yml is intentionally left alone; clippy with `--all-features`
gives broader coverage of conditionally compiled code and does not
produce a shipping binary.

Closes #442

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: probe candidate input names for 1ES Rust features list

PR-build 148026004 confirmed `allFeatures: false` correctly drops the
task's `--all-features` default, but `features: '...'` was silently
ignored — the resulting cargo line had no `--features` at all, so the
binary lost hyperlight/isolation_session/microvm/wslc backends.

Shotgun several candidate input names in one push so the next CI run
narrows down which spelling the task actually consumes. Unknown inputs
are silently ignored by the 1ES PT task layer (already proven), so this
is safe. Once we identify the canonical name we will collapse to a
single key.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: use `activatedFeatures` (correct 1ES Rust task input name)

Per the 1ES Rust virtual task schema (eng.ms doc), the inputs at
`1ES.Build.Rust.Run@1` level are:

    allFeatures: boolean          # default: true
    activatedFeatures: string[]

Build 148028047 confirmed `allFeatures: false` correctly drops
`--all-features` from the cargo line, but the previous commit's
`features: '...'` (and four other guessed names) were silently ignored,
so the binary lost hyperlight/isolation_session/microvm/wslc backends.

Replace the shotgun with the documented `activatedFeatures` YAML array
spelling. This should produce a cargo line of the form:

    cargo build --locked --offline --target ... --profile release \\
        --features hyperlight,isolation_session,microvm,wslc

Schema: https://eng.ms/docs/coreai/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/buildworkflows/rust-virtual-task

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: pass activatedFeatures as whitespace-separated string

Build 148041192 rejected the previous commit at YAML validation:

    /.azure-pipelines/templates/Rust.Build.Job.yml (Line: 136, Col: 13):
        A sequence was not expected

Even though the 1ES Rust virtual task documents `activatedFeatures:
string[]`, AzDO task `inputs:` only accept scalar values at the YAML
schema layer; the 1ES task itself splits the scalar internally. Use a
whitespace-separated string instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: scope activatedFeatures by OS (WXC vs LXC)

Build 148041225's WXC jobs got the correct cargo line:

    cargo build ... --features hyperlight isolation_session microvm wslc

But the LXC jobs failed because `lxc/Cargo.toml` only defines the
`hyperlight` feature (no microvm/isolation_session/wslc). Previously
this was hidden because `--all-features` enables only the features
defined on the package being built, and lxc only has `hyperlight`.

Split activatedFeatures by `item.os`:
  - windows (WXC) -> hyperlight isolation_session microvm wslc
  - linux   (LXC) -> hyperlight

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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