Repository navigation
Container Policy Discussion Document - #9
Closed
Gudge (MGudgin) wants to merge 16 commits into
Closed
Gudge (MGudgin) wants to merge 16 commits into
Gudge (MGudgin) wants to merge 16 commits into
Conversation
Collaborator
|
Chromium also uses DisallowWin32kSystemCalls mitigation for some of their processes (I think storage and render). It uses Job with UILimits (on top of just using Job for resourcing management) to prevent certain UI operations when it cannot employ DisallowWin32kSystemCalls |
Gudge (MGudgin)
force-pushed
the
user/gudge/container_policy_copilot
branch
from
April 14, 2026 17:59
b636254 to
7123327
Compare
Captures cross-platform sandbox policy research covering Linux BubbleWrap, macOS Seatbelt, Landlock, seccomp-BPF, and Windows AppContainer. Proposes a unified JSONC-based policy language compiled to FlatBuffers for efficient runtime consumption. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Add new section 11 covering the seven policy layers that contribute to the final effective sandbox policy. This introduces an orthogonal axis to the existing per-mechanism analysis: Policy inputs (normative, intersected): 1. Code Requirements - abstract resource type declarations 2. Instance Binding - concrete paths, ports, hosts 3. User Consent - runtime permission grants 4. IT Admin Policy - organizational constraints (GPO/MDM) 5. System Policy - OS-level security invariants Realization (descriptive, checked against declared policy): 6. System Security Promises - what guarantees the platform can deliver 7. Container Enforcement Capabilities - what the backend can enforce Includes evaluation pipeline, failure mode analysis, and mapping of layers to artifacts. Adds cross-references from sections 5 and 7. Co-authored-by: Copilot <[email protected]>
Remove the JSONC-vs-YAML rationale and parser landscape sections as they are out of scope. Renumber Policy Layers from section 11 to 9 and update all internal cross-references. Co-authored-by: Copilot <[email protected]>
Add new section 4 covering SELinux as a mandatory access control framework: label-based security contexts, type enforcement rules, domain transitions, operating modes, policy types, practical workflow, and comparison with AppArmor/Landlock/seccomp. Renumber subsequent sections (4-9 become 5-10) and update all cross-references. Co-authored-by: Copilot <[email protected]>
Add comprehensive section covering the formal syntax for describing and composing sandboxing backend capabilities: - Primitive profiles as the fundamental unit, structurally parallel to the policy schema for machine evaluation - Isolation models (different-universe, guarded-doors, reduced-credentials, kernel-filter) with strength ordering - Example primitives for Linux (mount-ns, seccomp, net-ns, iptables, Landlock, SELinux) and Windows (AppContainer, Job Object, restricted token, integrity level) - Composition semantics: union of capabilities, max of models, conflict detection via exclusive_with - Named backend shorthands that expand to primitive lists - Compiler pipeline: expand → load → compose → evaluate - Policy evaluation algorithm with per-rule structural matching - Structured evaluation result format with diagnostics - Assurance requirements for minimum isolation model enforcement - Backend auto-selection via set-cover over available primitives Co-authored-by: Copilot <[email protected]>
Add new section covering the separation of container lifecycle from workload lifecycle to amortize expensive setup costs (VM boot, OS init, runtime loading) across multiple workload executions: - Two-lifecycle model: container (expensive, once) vs workload (cheap, repeated) - Two-tier policy: base policy (fixed at creation) vs workload policy (per-execution, must be subset of base) - State reset semantics between workloads (filesystem, memory, network, IPC, flow labels) - Lifecycle metadata for backend primitive profiles (setup cost, per-workload cost, reset mechanism, warm reuse support) - Warm pool design for latency-sensitive concurrent workloads - Complete container state machine (Creating through Stopped with Ready/Binding/Executing/Resetting workload cycle) - Integration with policy evaluation pipeline from §11 Co-authored-by: Copilot <[email protected]>
Map the MXC codebase (13 Rust crates + TypeScript SDK) against the design concepts in ContainerPolicyThoughts.md: - 6 containment backends (AppContainer, Windows Sandbox, BaseContainer, LXC, NanVix MicroVM, WSL Container SDK) mapped to isolation models - Policy dimension coverage: filesystem (BFS/mounts), network (firewall/iptables), process, with gaps in syscalls, resources, devices - JSON config schema compared field-by-field against proposed §8 - Existing FlatBuffer usage (BaseContainer spec) mapped to §9 - Policy layer coverage (primarily L2 instance binding) - Backend capability analysis showing what each runner can enforce - Windows Sandbox daemon/guest as existing warm-container implementation - Bidirectional gap analysis: what MXC lacks vs the document, and what the document lacks vs MXC (proxy integration, learning mode, enforcement mode selection, CreateProcessInSandbox API) Co-authored-by: Copilot <[email protected]>
Add new section defining the Layer 1 intent manifest — the format code authors write, expressing abstract requirements that are portable across platforms: - requires/constraints/claims three-way split with distinct trust models (validated/enforced/informational) - Storage classes as logical data domains (workspace, input_data, output_data, temp, cache, config, secrets, app_code, user_selected) — no platform-specific paths - Named network service references resolved through environment- specific service catalogs — no hardcoded hosts - Generic network capabilities (dns, ntp, localhost) - Credential injection declarations - Binding step algorithm: manifest + platform + services + consent + admin policy → bound policy (§8) + bind report - Bind failure modes with actionable diagnostics - Complete worked example: intent manifest → binder → bound policy Update §8 note to explicitly position it as Layer 2 (bound deployment policy) and show the full pipeline: §13 → bind → §8 → compile → §9. Co-authored-by: Copilot <[email protected]>
…t_storage mapping - Add /run/secrets/LLM_API_KEY filesystem rule (read-only, ephemeral tmpfs mount) and LLM_API_KEY_FILE env var for credential injection - Mark /workspace as ephemeral to satisfy persistent_storage: forbidden - Add constraint mapping table showing how each intent constraint manifests in the bound policy Co-authored-by: Copilot <[email protected]>
Add a Windows-bound version of the summarizer example showing how the same intent manifest produces different bound policies per platform: - BFS (Brokered File System) maps host paths into the container with read-only or read-write access; unlisted paths are invisible - Ephemeral overlays for workspace and temp via BFS - Credential injection via ephemeral BFS-mapped file - Path masking for sensitive host directories (Users, .ssh, .aws) - AppContainer capability (internetClient) for network egress - Clean environment with Windows-specific paths (TEMP, TMP, PATH) - Cross-platform comparison table showing Linux vs Windows bindings for each intent requirement Co-authored-by: Copilot <[email protected]>
Expand the Intent Manifest section with three new subsections and
updates to the binding step:
Layer 2 Is Never Hand-Authored:
- Bound policy (§8) is always binder output, never directly written
- One policy authoring format (intent), no shortcuts or annotations
- Authority checks operate on intent, not platform-specific config
Agents as Policy Authors:
- LLM agent loops emit intent, not config, for three reasons:
agents lack full platform knowledge, shouldn't hardcode
infrastructure decisions, and may dispatch cross-platform
- The binding overhead is minimal; correctness benefits are significant
Base Policies (Runtime Profiles):
- System-provided policy fragments capturing runtime filesystem
requirements (Python stdlib paths, dynamic libraries, certificates)
- Versioned and platform-specific (python3.11-linux-x64 vs
python3.11-windows-x64)
- Composable — multiple profiles merged for multi-tool workloads
- Connected to §12 lifecycle: base policy drives warm container
initialization; workload policy only resolves additional needs
Policy Discovery (Learning Mode):
- Two-pass workflow: observe access events → generate Layer 2 →
uplift to Layer 1 via heuristics
- Per-category automation quality assessment (runtime detection
high, storage classification medium, claims impossible)
- Draft output with confidence annotations (CONFIDENT, REVIEW,
ESTIMATED, EMPTY) for author review
- ~60-70% automatable, remainder requires author knowledge
Binding step updated to include base policy resolution and tool
profile merging as explicit steps in the algorithm.
Co-authored-by: Copilot <[email protected]>
Add example intent manifests demonstrating the §13 schema across different runtimes, tool requirements, and network profiles: 01 Python data analysis — offline, pandas/numpy, deterministic 02 Node.js API aggregator — two external services, credentials 03 Rust snippet runner — cargo/rustc toolchain, crate downloads, build cache, high process/memory needs 04 LLM research tool — agent tool with LLM API + public web access, HTTP cache, multi-process 05 .NET image processor — offline batch processing, high memory, app_code + config storage classes 06 Bash infra health check — shell tools (curl, openssl, psql, jq), internal services, database credential Co-authored-by: Copilot <[email protected]>
…ifests
Generate bound policy versions of each intent manifest, showing how
the binder resolves abstract requirements to platform-specific config:
Linux (x86_64):
01 Python → /usr/bin/python3.10, /usr/lib/python3.10, tmpfs, overlays
02 Node.js → /usr/bin/node, service catalog → weatherapi + opencagedata
03 Rust → cargo/rustc/cc/ld, crates.io + GitHub hosts, cache dirs
04 LLM research → Python + public-web (*:443) + anthropic API, HTTP cache
05 .NET → /usr/share/dotnet, offline, app_code at /app
06 Bash → curl/openssl/psql/jq, internal services + PostgreSQL:5432
Windows (x64):
01 Python → C:\\Python310, BFS, AppContainer (no network caps)
02 Node.js → C:\\Program Files\\nodejs, BFS, internetClient cap
03 Rust → C:\\Rust toolchain + MSVC Build Tools, BFS, internetClient
04 LLM research → C:\\Python311, BFS, internetClient, secrets in C:\\Sandbox
05 .NET → C:\\Program Files\\dotnet, BFS, offline (no network caps)
06 Bash → Git for Windows bash/curl/openssl + PostgreSQL psql, BFS
Each pair demonstrates:
- Runtime paths resolved per platform (base policy knowledge)
- Storage classes mapped to /workspace, /input, /output (Linux) vs
C:\\Sandbox\\Workspace, Input, Output (Windows)
- Credentials mounted as ephemeral files with _FILE env var convention
- Network services resolved to concrete hosts from service catalog
- Windows: AppContainer capabilities, BFS enabled, path masking
- Linux: synthetic /dev, /proc, /tmp mounts
Co-authored-by: Copilot <[email protected]>
Add namespace configuration (user, mount, pid, net, ipc, uts, cgroup) to match the platform section pattern used in the Windows examples (appcontainer capabilities + BFS config). Co-authored-by: Copilot <[email protected]>
…mples Significantly expand the Layer 5 section in §10 with concrete system policy design: - System policy operates on the bound policy (§8), not the intent manifest — only resolved, platform-specific paths can be checked - Deny-overlay schema: deny rules that are never overridable, with filesystem paths, registry keys (Windows), Mach services (macOS), network port ranges, and process capabilities - Full examples for Windows (System32, SysWOW64, Boot, registry hives, auto-start keys, dangerous privileges), Linux (/usr/bin, /boot, /etc/shadow, /proc/sysrq-trigger, privileged ports, CAP_SYS_ADMIN), and macOS (/System, /usr/bin, /Library/Keychains, SIP-protected paths, auth trampoline Mach service) - System policy dimensions are a superset of bound policy dimensions (registry and Mach services have no bound policy equivalent) - Two-point evaluation: compile-time (catches explicit grants) and runtime (catches implicit grants from enforcement mechanisms like AppContainer capabilities) - Redundancy with OS enforcement is intentional: explicit documentation, early diagnostics, defense-in-depth Co-authored-by: Copilot <[email protected]>
Gudge (MGudgin)
force-pushed
the
user/gudge/container_policy_copilot
branch
from
May 1, 2026 16:55
1bdb037 to
66639cb
Compare
Member
Author
|
Superseded |
Lily Barkley (lilybarkley-msft)
added a commit
that referenced
this pull request
Jul 7, 2026
Addresses MGudgin / Copilot review feedback on PR #584: #2 --audit lifecycle chatter (spawn banner, non-zero-exit / spawn-fail lines, capability-injection warning) now writes only to the log buffer by default; add --audit-verbose to also surface them on stderr for pipeline-debugging. #3 Replace the encode_utf16+PCWSTR mutex-name literal with the windows::core::w!() macro in both wxc-exec (Global\\Mxc_Plm_Audit) and plm.exe. #4 Scope chrono to default-features = false, features = std+clock so it stops dragging js-sys / wasm-bindgen / iana-time-zone into the dep tree. #5 Clarify the "PLM runs as administrator" comment — the elevation lives in "launched --audit from an elevated context" (needed for WPR kernel session), not a PLM-internal auto-elevate. #6 Drop stale build.rs comment referencing the pre-embedded WPR profile staging. #8 run_plm_command doc no longer claims plm failures never abort; documents that --audit's "plm start" caller does abort while "plm stop" falls through to wpr -cancel cleanup. #9 --audit's "is capability already present?" check is now case- sensitive (matching the downstream AppContainer runner) so an operator's mis-cased spelling doesn't silently disable the injection. #10 Move mark_plm_trace_active() out of plm's main.rs into a callback that log::run fires only AFTER wpr -start engages. Prevents a Ctrl+C during stdin-prompt or spawn-fail from issuing wpr -cancel against an unrelated host WPR session. #11 WprExeStopper::stop no longer builds wpr_command() twice — reuse the single builder instead of constructing a throwaway just to read get_program(). #13 Remove the extra "// " in dacl_ctrl_handler's comment header. Co-authored-by: Copilot <[email protected]>
Lily Barkley (lilybarkley-msft)
added a commit
that referenced
this pull request
Jul 8, 2026
* PLM split PR1: audit-mode plumbing and trace lifecycle Wide-spread plumbing + Windows-only plm crate skeleton: - wxc-exec --audit flag, console-control handler, named-mutex singleton - AppContainer release-build gate rejecting permissiveLearningMode - �udit field in wire model and config parser - plm crate: clap dispatch for start/stop/log, WPR start/stop, embedded WPR profile materializer, singleton coordination, wpr.exe path resolution - CI/build infra (Azure Pipelines + GitHub Actions) to build plm.exe and stage it next to wxc-exec.exe via build.bat Event parsing, capability extraction, filesystem/UI merging, and the adjusted-config writer arrive in subsequent PRs. Builds + tests pass: cargo fmt --check, cargo clippy -p plm, cargo test -p plm (25 tests). Co-authored-by: Copilot <[email protected]> * Remove round-N review markers from CI workflow comments * PLM CI: restrict integration tests to filesystem fixtures (headless) * PLM PR1 fix #1: build plm cross-platform via no-op stub main Replace the workspace's bespoke default-members = members - plm list with the implicit default (all members), and remove the crate-level #![cfg(target_os = "windows")] on plm's main.rs. The Windows-only body is gated per-item; a tiny non-Windows fn main() prints and exits 1 so the binary still links on Linux/macOS. Drops the special-cased -p plm/--lib steps in the GitHub Actions and Azure DevOps templates that existed solely because plm was excluded from default-members; the regular workspace build now covers it, and the Linux gate keeps a -p plm build/test step so the cross-platform contract is still CI-enforced. Also adds core/mxc-sdk to the implicit default (Copilot review #12). Co-authored-by: Copilot <[email protected]> * PLM PR1 review fixes: quiet --audit, w! macro, chrono scope, WPR race Addresses MGudgin / Copilot review feedback on PR #584: #2 --audit lifecycle chatter (spawn banner, non-zero-exit / spawn-fail lines, capability-injection warning) now writes only to the log buffer by default; add --audit-verbose to also surface them on stderr for pipeline-debugging. #3 Replace the encode_utf16+PCWSTR mutex-name literal with the windows::core::w!() macro in both wxc-exec (Global\\Mxc_Plm_Audit) and plm.exe. #4 Scope chrono to default-features = false, features = std+clock so it stops dragging js-sys / wasm-bindgen / iana-time-zone into the dep tree. #5 Clarify the "PLM runs as administrator" comment — the elevation lives in "launched --audit from an elevated context" (needed for WPR kernel session), not a PLM-internal auto-elevate. #6 Drop stale build.rs comment referencing the pre-embedded WPR profile staging. #8 run_plm_command doc no longer claims plm failures never abort; documents that --audit's "plm start" caller does abort while "plm stop" falls through to wpr -cancel cleanup. #9 --audit's "is capability already present?" check is now case- sensitive (matching the downstream AppContainer runner) so an operator's mis-cased spelling doesn't silently disable the injection. #10 Move mark_plm_trace_active() out of plm's main.rs into a callback that log::run fires only AFTER wpr -start engages. Prevents a Ctrl+C during stdin-prompt or spawn-fail from issuing wpr -cancel against an unrelated host WPR session. #11 WprExeStopper::stop no longer builds wpr_command() twice — reuse the single builder instead of constructing a throwaway just to read get_program(). #13 Remove the extra "// " in dacl_ctrl_handler's comment header. Co-authored-by: Copilot <[email protected]> * PLM PR1 review batch 2 fixes: comment cleanup, MIT headers, workspace deps, extract wxc audit module - Drop future-PR/past-state phrasing from plm module doc-comments - Prepend MIT copyright headers to coordination.rs, profile_gen.rs, wpr_path.rs - Simplify plm log trace filename (drop PID and parse-preview note) - Move serde_json/chrono/roxmltree to workspace [workspace.dependencies] - Use wxc_common::string_util::from_wide in plm::wpr_path - Add plm::coordination::singleton with shared try_acquire/release helpers; both plm::main and wxc::audit now delegate to it - Extract PLM audit lifecycle (~230 lines) from wxc/src/main.rs into wxc/src/audit.rs Co-authored-by: Copilot <[email protected]> * Gate plm_ctrl_handler on target_os = "windows" * Regenerate dev schema to match wire model * Soften README claim about plm stop parsing (not yet wired on this PR) * Move --with-bfs to filesystem PR Per review: --with-bfs / tier2_bfs plumbing belongs with the filesystem extraction PR, not the audit skeleton. * Drop debug_assertions branch on permissiveLearningMode gate Per review: now that --audit is the intended enablement mechanism, the debug-build carve-out is redundant. * Shorten audit-mode README section; link to plm readme Per review: keep the root README short and defer PLM detail to src/core/plm/readme.md. * Byte-verify staged plm.wprp against embedded profile before rename Per review: detect filter drivers, quota clamps, and AV rewrites that would otherwise let a corrupted plm.wprp be adopted on every subsequent run via the early-return existence check. * Verify wpr.exe Authenticode signature before every plm invocation wpr.exe runs elevated (SeSystemProfile for NT Kernel Logger); an attacker-planted binary would execute with full admin rights. Cache the verify result so back-to-back plm log + plm stop only pays the cert-chain walk once. * Remove inline PLM integration test step from Build.Windows.Job The step references run_plm_test.ps1 which does not exist on this branch (arrives in the testing PR). A dedicated PLM integration test job belongs on the branch that ships the script. * Drop serde_json preserve_order feature Removes the runtime feature that reordered every serde_json Map — which was the sole cause of the dev schema on this branch differing from main. The feature was consumed only by a dead type alias in plm/src/config.rs. Regenerated dev schema now matches main byte-for-byte. * Remove Tessera codename from docs Substitute neutral placeholder paths in the plm readme (C:\Tessera\mxc -> C:\src\mxc). * plm: address PR584 review — capture wpr/plm stdio, harden singleton, doc-comment ctrl-handler globals - start.rs / stop.rs: switch wpr.exe spawns from .status() to .output() so successful runs stay silent; replay captured stdout+stderr on non-zero exit via shared start::replay_wpr_output. Fixes the wxc-exec --audit stdio pollution called out in comments r3514558858 / r3514562221 / r3514564478. - wxc/src/audit.rs: capture plm.exe stdio via .output() so the audit-mode background trace never leaks plm chatter into the wrapped workload's console. On failure (and in --verbose) the captured streams are replayed via a shared replay_child_output helper. Fixes r3502009755 / r3502010101 / r3502010465 / r3514551150. - coordination.rs: switch singleton acquire from CreateMutexW(bInitialOwner=true) + ERROR_ALREADY_EXISTS to CreateMutexW + WaitForSingleObject(0) so a previous owner that crashed (WAIT_ABANDONED) no longer blocks the singleton forever and forces a reboot. Addresses r3503721112. - main.rs: expand PLM_TRACE_ACTIVE doc-comment to explain why it's a process-wide static (Windows ctrl-handler callback context has no captured self — must reach state via globals). Expand plm_ctrl_handler doc to explain why polling is used instead of a wait-object (wpr's kernel-session engagement isn't OS-signalled; bounded 40-poll worst case stays well under the ~5s ctrl-handler kill budget). Addresses r3503762141 / r3503729778. - stop.rs: drop redundant _pid<PID> suffix from log-dir stamp; sub-second (%H%M%S%.3f) is already collision-safe. Addresses r3503525035. Co-authored-by: Copilot <[email protected]> * plm: move PLM_TRACE_ACTIVE ownership onto AcquiredSingleton The atomic itself has to stay a process-wide static because the Windows console-control handler (plm_ctrl_handler) is an OS-owned extern "system" callback with no captured self/environment — it can only reach state via process globals. But all non-signal-context mutation now goes through &AcquiredSingleton methods: - mark_trace_active(&self) — was free fn mark_plm_trace_active - clear_trace_active(&self) — was free fn clear_plm_trace_active - cancel_active_trace(&self) — was free fn cancel_active_plm_trace The compile-time invariant is that trace-active can only be flipped while we hold the host-wide Global\\Mxc_Plm_Audit singleton mutex — you can't call these methods without first producing an AcquiredSingleton. The single remaining free-fn escape hatch, cancel_active_plm_trace_from_signal(), is documented as callable only from the ctrl handler (where no &self exists). Also: AcquiredSingleton::drop now cancels any leftover trace before releasing the mutex, so an error mid-flow can't leak the kernel session past exit. The Cmd::Log flow uses the singleton bypass path (when wxc-exec --audit already holds the mutex outer-process) — that branch falls back to touching PLM_TRACE_ACTIVE directly because no local AcquiredSingleton exists in the bypass case. Addresses PR584 review comment r3503762141 more thoroughly than the prior doc-comment-only fix. Co-authored-by: Copilot <[email protected]> * plm: replace WinVerifyTrust with existence check for wpr.exe wpr.exe is catalog-signed, not embedded-signed, so WinVerifyTrust with WINTRUST_ACTION_GENERIC_VERIFY_V2 returns TRUST_E_NOSIGNATURE (0x800B0100) on stock Windows installs. Correctly verifying a catalog-signed binary requires a CryptCATAdmin fallback dance. Since we resolve the path via GetSystemDirectoryW (not env-spoofable) and %SystemDirectory% write access requires TrustedInstaller, path resolution already is the trust boundary. Reduce verify_wpr_signed() to a sanity file-existence check that surfaces a clear message when WPT isn't installed. Co-authored-by: Copilot <[email protected]> * plm: suppress `wpr -stop` progress bar in `plm log` happy path `wpr -stop` streams a `100% [>>>>>>>]` progress bar to stdout as it merges the ETL, which pollutes any wrapping tool's console. `stop::WprExeStopper` already captures via `.output()` and replays via `replay_wpr_output` only on failure; apply the same pattern to `log::stop_wpr_trace`. Co-authored-by: Copilot <[email protected]> * plm: spawn wpr.exe with CREATE_NO_WINDOW to suppress its progress bar wpr.exe renders its `100% [>>>>>>]` merge progress via `WriteConsoleW`, which writes to the console handle directly and bypasses any stdio pipe redirection (`.stdout(Stdio::piped())` / `.output()`). So even though `log.rs` / `stop.rs` / `start.rs` all already capture wpr's stdout+stderr via `.output()`, the progress bar was still leaking onto the wrapping tool's terminal. Add CREATE_NO_WINDOW (0x08000000) as a creation flag on the Command returned by wpr_command(), so every wpr.exe child is spawned without an attached console and its WriteConsoleW calls silently no-op. Normal stdout/stderr traffic still flows through the pipes and is replayed on failure via replay_wpr_output. Co-authored-by: Copilot <[email protected]> * plm(pr1): remove forward-looking future-PR language in module docs Addresses PR#584 reviewer feedback (bbonaby comments r3503498362, r3503511023, r3503528016, r3503563795, r3503578675, r3503583878, r3507611305). Rewrites the pr1 subcommand summary, `Cmd::Stop` doc, `resolve_bin_path` doc, the `Trace captured at` print, the trailing `verbose logging` message, and the pass-through-options comment so they describe what the code does now rather than deferring to `later PRs`. The extract-caps subcommand doc entry is removed because Cmd::ExtractCaps isn't wired in this PR (it lands in the split-out PR#587). Co-authored-by: Copilot <[email protected]> * wxc-exec: auto-elevate --audit via UAC self-relaunch Detects a non-elevated token at startup (before COM init) and, when --audit was requested, re-launches the same argv with ShellExecuteExW + `runas` so the user sees the standard UAC consent dialog. The child's exit code is propagated so the outer invoker sees the normal return contract. UAC decline (ERROR_CANCELLED = 1223) surfaces a clear `--audit requires elevation` message. Addresses PR#584 review thread 3501401682. Co-authored-by: Copilot <[email protected]> * plm: move crate from src/core/plm to src/host/plm Per PR#584 review (MGudgin): PLM's wpr invocations require Administrator, but the wxc-exec invariant is that it never runs elevated. Moving the plm crate into src/host/ (alongside wxc-host-prep) sets up a follow-up commit that adds a small wxc-host-wpr helper with a requireAdministrator manifest, keeping the elevated surface scoped to the wpr command line. No behavior change in this commit \u2014 path move + Cargo path updates only. Co-authored-by: Copilot <[email protected]> * Revert "wxc-exec: auto-elevate --audit via UAC self-relaunch" This reverts commit 2feb58e1b2b5bc5aed23975b2ab6b09924ecf4a2. * plm: elevate via requireAdministrator manifest instead of wxc-exec self-relaunch Restores the invariant that wxc-exec never runs elevated by moving the elevation requirement onto plm.exe itself, following the wxc-host-prep pattern. * Embed a requireAdministrator application manifest on plm.exe (release builds only, via embed-manifest crate in build.rs). * wxc-exec --audit spawns plm.exe via ShellExecuteExW with the "runas" verb (new plm_launch module). The elevated child cannot inherit our unelevated stdio pipes, so we pass per-invocation capture file paths through MXC_PLM_STDOUT_FILE / MXC_PLM_STDERR_FILE env vars; plm.exe redirects its stdio to those files on startup via SetStdHandle and we replay the captured bytes after the child exits. * Disable the empty main.rs test binary for the plm crate so cargo test -p plm --release does not attempt to launch the manifested bin from an unelevated dev shell. Co-authored-by: Copilot <[email protected]> * plm: pass elevated-child handshake via CLI flags ShellExecuteExW + runas does not propagate env vars or stdio handles across the elevation boundary, so the parent-holds-singleton signal and the stdio capture paths now ride on hidden CLI flags on plm's Cli (--wxc-singleton-held-by-parent, --wxc-capture-dir) instead of env vars. redirect_stdio_from_argv scans argv manually before Cli::parse so clap parse errors still surface in the capture files. Co-authored-by: Copilot <[email protected]> * plm: harden elevated-child capture-file path against symlink attack The capture-file handshake previously used a deterministic temp dir (%TEMP%\mxc-plm-<pid>) that any same-user medium-IL attacker could pre-squat, and the elevated child opened stdout.log/stderr.log with plain OpenOptions::create(true) which silently follows reparse points. A racing attacker could plant those filenames as symlinks pointing at an admin-only target and have the elevated (admin-token) plm.exe append attacker-influenceable diagnostic bytes to it — an EoP. Two defenses layered: 1. plm_launch.rs: use tempfile::Builder with a 16-byte random suffix so the dir path isn't guessable, and treat pre-existing dir as fatal (no silent reuse). 2. plm/main.rs redirect_one: switch OpenOptions::create(true) to create_new(true) so CreateFileW returns ERROR_FILE_EXISTS if anything (regular file, symlink, junction) already occupies the path — the elevated child either creates the file itself fresh or gives up on capture; it will never follow an attacker-planted reparse point. Co-authored-by: Copilot <[email protected]> * plm: fix stale doc comment in run_plm_elevated Comment described the elevated child as using 'create(true).append(true) + reparse-point rejection', but the security-fix sibling commit actually switched to create_new(true) precisely because create(true) has no reparse-point rejection and silently follows symlinks. A maintainer trusting the old comment could revert to create(true) and reintroduce the EoP. Also fix two references to tempdir_in (the code calls tempdir). Co-authored-by: Copilot <[email protected]> * plm: document 'wxc-exec never runs elevated' invariant at delegation sites Add module-doc paragraphs at plm_launch.rs and audit.rs making the design invariant explicit at the two files where wxc-exec coordinates PLM elevation: wxc-exec itself is unelevated, and the WPR/ETW work that requires admin is delegated to plm.exe (requireAdministrator manifest) via ShellExecuteExW + runas. Mirrors the existing rationale in src/host/plm/build.rs. Also update the stale 'via env' phrase in plm_launch.rs docs to reflect the CLI-flag handshake introduced in 3d3bee8. Co-authored-by: Copilot <[email protected]> * plm: bound elevated child wait, tidy comments, drop unused windows features * plm_launch.rs: swap WaitForSingleObject INFINITE for a 30 s bound (new PLM_ELEVATED_WAIT_MS const) and add a WAIT_TIMEOUT branch that TerminateProcess'es the orphan child before CloseHandle so it can't finish wpr -start behind our back and leak the kernel logger session. Documented that PLM is intended for a single end-to-end flow / unit test at a time, so 30 s is sufficient for the supported usage. * audit.rs: fix stale comments that implied wxc-exec ran elevated; cancel_active_audit_trace and AUDIT_SINGLETON_HANDLE docs now correctly attribute elevation to plm.exe and name the --wxc-singleton-held-by-parent bypass. * Cargo.toml: drop Win32_Security_WinTrust and Win32_Security_Cryptography from the workspace windows crate features; no code uses them (only stale comments in plm's wpr_path.rs / main.rs which explicitly say we do NOT call WinVerifyTrust). Co-authored-by: Copilot <[email protected]> * sdk tests: allow plm.exe as an optional bundled binary The umbrella build stages plm.exe into sdk/bin/<arch> alongside wxc-exec.exe when the plm crate is part of the workspace build. The SDK 'no unexpected binaries' package test fails because plm.exe wasn't in any allowed list. Add 'plm.exe' to OPTIONAL_BINARIES (mirroring the wslcsdk.dll pattern) so builds with and without plm.exe both pass the integration test, without forcing every build to produce it. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
Dan Legg (danlegg)
pushed a commit
that referenced
this pull request
Aug 7, 2026
Address the code-review findings on the coresident explicit-load change (38dbd88). Runtime binding still activates the MSI IsoSessionApp.dll by absolute path with zero registry mutation; this commit hardens the surrounding load, error, and diagnostic behavior. regfree.rs (#1,#5,#6,#7,#8,#9,#10): - Load the App DLL with LoadLibraryExW using LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 so the runtime directory is the sole search root for its dependencies (search-order hijack hardening). Reject non-absolute MXC_ISOSESSION_RUNTIME_DIR overrides. - Replace the 2-state load cache with a 3-state RuntimeLoad enum (Absent / Loaded / Unloadable). A missing default folder still falls back to inbox activation, but an honored-but-broken explicit override or a present-but-unloadable DLL now surfaces the error instead of silently falling back. - Report real Win32 errors (GetProcAddress) and null-check the returned factory pointer before from_raw. - Gate success-path eprintln! on MXC_DIAG_CONSOLE. - Correct the CoInitializeEx SAFETY comment. - Add unit tests for runtime-dir resolution and app-dll path building. manager.rs (#2): wrap the over-length activate line for rustfmt. oneshot.md (#4,#11): document the two activation paths, the runtime-folder resolution table (MXC_ISOSESSION_RUNTIME_DIR / DEFAULT_RUNTIME_DIR), apartment init, and prerequisites; fix RoInitialize -> CoInitializeEx wording. tests/scripts (#3): accept EITHER inbox (System32 DLL + registry) OR the coresident MSI runtime dir in the prerequisite probe, so the suites no longer skip on an MSI-only host. Co-authored-by: Copilot <[email protected]> Copilot-Session: f5cc2011-5308-43d6-a8ea-2b8ed9b6ceb3
Huzaifa Danish (huzaifa-d)
pushed a commit
that referenced
this pull request
Aug 7, 2026
…on bfscfg.exe - #7 (SohamDas2021): available_backends() pushed hardcoded string literals, and the drift tests only checked that a separate hardcoded list was valid wire names — not that the pushed literals matched. Derive every pushed name from ContainmentBackend::wire_name() so it can't be typo'd, and make the emittable test iterate the enum so it verifies ContainmentBackend::wire_name() agrees with the canonical wire::Containment serde names. - #9 (SohamDas2021): select_tier() reported AppContainerBfs from the tier2_bfs build flag alone, but detect() also requires bfscfg.exe on disk for a policy-carrying request (else it falls to DACL). Add a bfscfg_available() probe and require both the feature and a resolvable bfscfg.exe before naming BFS, so the reported tier ceiling matches what a real request achieves. Co-authored-by: Copilot App <[email protected]>
Huzaifa Danish (huzaifa-d)
added a commit
that referenced
this pull request
Aug 7, 2026
#725) * feat(engine): port TS host detectors (lxc, windows_sandbox) to Rust Port the two TypeScript-only host-availability detectors into Rust and fold their results into mxc_engine::platform::platform_support(), broadening its contract from 'backends mxc-sdk can launch' to 'host-available backends' (Phase 1 of the backend-support-probe plan, PR #717). - Add lxc_common::availability::is_lxc_available() (shallow 'lxc-ls --version' probe). - Add windows_sandbox_lifecycle::availability::is_windows_sandbox_available() (DISM State:Enabled with a 10s timeout, WindowsSandbox.exe fallback when DISM can't run; invokes the absolute System32\dism.exe path). - platform_support(): Linux arm reports lxc and/or bubblewrap; Windows arm adds windows_sandbox alongside processcontainer. Update doc comments to host-capability wording. - Add drift-guard tests tying reported literals to Containment wire names and asserting the live platform_support() output only contains real wire names. - Loosen the locked mxc-sdk platform_support tests for the broadened contract. Co-authored-by: Copilot App <[email protected]> * feat(engine): add available_backends() host-capability probe API Add mxc_engine::probe with the read-only available_backends() API from the backend-support-probe plan (PR #717, Phase 2). Reports only the containment backends the current host can run, each with its effective isolation tier when it has a tier ladder. - AvailableBackend { backend, tier: Option<String> } serializes to camelCase JSON with tier omitted (never null) when the backend has no tier ladder. - available_backends() has per-platform arms reusing the landed detectors: macOS -> seatbelt; Linux -> bubblewrap/lxc; Windows -> processcontainer (with effective tier) + windows_sandbox + wslc (feature-gated). Empty Vec is a normal result, not an error. - select_tier() is a pure precedence fn (base-container -> appcontainer-bfs -> appcontainer-dacl floor), unit-testable without a real host or the tier2_bfs feature. - Re-exported from mxc_engine and the public mxc-sdk. - 8 unit tests: serde shape (tier omitted vs present), host + unconditional wire-name drift guards, canonical-tier drift guard, Windows processcontainer-always-with-tier, tier precedence, non-Windows processcontainer absence. Stacked on the host-detector port (PR #725); the standalone detectors it reuses land there. Co-authored-by: Copilot App <[email protected]> * fix(windows_sandbox): address Copilot review on host detectors - Resolve dism.exe / WindowsSandbox.exe via GetSystemDirectoryW instead of the attacker-controllable %SystemRoot% env var (UAC inherits an unelevated parent's environment, so an env-derived path let a standard user point the probe at a planted binary). Mirrors the src/host/plm/src/wpr_path.rs pattern; falls back to the C:\\Windows\\System32 literal only on an outright Win32 failure. - Pass DISM's /English global option so the parsed 'State : Enabled' tokens are not localized on non-English Windows (previously an enabled Sandbox could be reported unavailable there, since a successful DISM run also skips the exe fallback). - Soften platform_support() docs: available_methods is the currently detected subset, not an exhaustive capability list — backends without a Rust detector yet (notably isolation_session) are omitted even when the host could run them, so absence is not proof a backend cannot run. Co-authored-by: Copilot App <[email protected]> * docs: trim comments; drop DISM from windows_sandbox probe Trim the module-level narratives and over-explained item docs across the host detectors and probe to concise, necessary comments; remove duplicated phrasing (e.g. 'universal floor') within and across files. Also drop the DISM query from the Windows Sandbox probe: dism /online requires elevation and this probe only ever runs unelevated (wxc-exec does not self-elevate), so DISM always failed through to the WindowsSandbox.exe existence check anyway. Detection is now exe-only, which also removes the subprocess-launch attack surface (only a .exists() remains). A short comment records why DISM is skipped. Co-authored-by: Copilot App <[email protected]> * refactor(appcontainer): centralize isolation-tier name strings Address @bbonaby's review note (#717): the tier-name strings were hand-written across the appcontainer fallback code. Make IsolationTier the single source of truth in both directions. - Add IsolationTier::ALL (canonical tier set, strongest-first) and derive a FromStr impl from as_str() via ALL, so the two directions cannot drift and adding a tier is a one-line change to ALL + as_str. - Remove the ad-hoc test-only parse_force_tier(); the production MXC_FORCE_TIER seam now parses via FromStr. - Add typed ForceTierGuard::set_tier(IsolationTier) and migrate all 18 valid force-tier call-sites off raw string literals (the one negative test intentionally keeps a raw invalid value). - Add a round-trip test asserting every ALL tier survives as_str -> FromStr. The available_backends() probe (already merged here) consumes as_str() with its own drift guard; the CI coverage gate for new tiers/backends is tracked in the follow-up issue. Co-authored-by: Copilot App <[email protected]> * feat(engine): add isolation_session host detection (registration-based) Add isolation_session to the host-availability surfaces using @adpa-ms's registration-based approach from #761: availability is whether the in-proc Windows.AI.IsolationSession IsoSessionOps WinRT class is registered on the OS (its activation factory resolves), not a build-number gate. - New isolation_session_common::availability::is_isolation_session_available(): attempts IsoSessionOps activation (CoInitialize MTA, balanced), OnceLock-cached, elevation-free. Pure available_from() split from the COM probe for unit testing (CLASS_E_CLASSNOTAVAILABLE / REGDB_E_CLASSNOTREG and any other activation failure map to unavailable). - Wire it into both Windows host-capability surfaces, gated behind the engine's isolation_session feature: available_backends() (probe) and platform_support(). This closes the previously-documented Rust/TS parity gap where TS reported isolation_session but Rust did not. - Add isolation_session to the probe's EMITTABLE_BACKENDS drift guard and loosen the mxc-sdk Windows platform_support test to allow it. Validated with the feature on and off: fmt clean, clippy -D warnings clean (default, isolation_session, and wslc+tier2_bfs+isolation_session), and tests green. Co-authored-by: Copilot App <[email protected]> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * docs: trim comments in the windows_sandbox + isolation_session probes Keep only comments that explain non-obvious code (why exe-not-DISM, the GetSystemDirectoryW env-spoof rationale, the Win32 buffer-grow retry, and the COM init/uninit balancing); drop the rest. No behavior change. Co-authored-by: Copilot App <[email protected]> * docs: restore platform_support module rationale Restore the 'why this exists' note (in-process host discovery, decoupled from the TypeScript SDK; lives in the engine so the SDK and executor binaries share one impl) that an earlier comment-trim over-aggressively removed. Kept concise. Co-authored-by: Copilot App <[email protected]> * docs: restore pre-existing platform.rs comments simplified by this PR Per review: only prune comments in files/comments this PR introduces. Restore the pre-existing comments an earlier trim pass simplified in platform.rs: - module doc (full 'stop depending on the TypeScript SDK' + 'lives alongside dispatch.rs' rationale), - platform_support() fn doc (the wxc-exec --probe and wslc/feature specifics; dropped only the now-inaccurate 'restricted to backends mxc-sdk can run' clause the broadened contract invalidated, pointing to the field doc instead), - the Linux-arm bwrap / MIN_BWRAP_VERSION note (kept, plus the new lxc line). The two sdk_helpers.rs comments were left corrected rather than reverted: this PR's behavior change made them factually wrong (LXC is now reported; WSLC is no longer the only other Windows backend). Co-authored-by: Copilot App <[email protected]> * refactor(wxc_common): extract shared system_directory() helper Addresses jsidewhite's review on #725: GetSystemDirectoryW + grow-retry was duplicated in windows_sandbox availability.rs and plm/wpr_path.rs. Consolidate into wxc_common::system_dir and route both call-sites through it. Co-authored-by: Copilot App <[email protected]> * fix(engine): address review on host detectors (wslc probe, tier de-drift, COM guard) - probe.rs: report wslc via wslc_common::is_available() (WSL2 + runtime check) instead of WslcSdk::load(), matching platform_support() and the runner preflight (SohamDas). - fallback_detector.rs: generate IsolationTier's enum, ALL, as_str, and FromStr from one macro list so the mapping is exhaustive both ways and cannot drift (SohamDas). - isolation_session/availability.rs: wrap CoInitializeEx/CoUninitialize in an RAII ComApartment guard so a panic in IsoSessionOps::new() still balances COM init (SohamDas). Co-authored-by: Copilot App <[email protected]> * fix(windows_sandbox): route runner preflight through the trusted availability probe check_sandbox_available() used an env-spoofable %SystemRoot% path while capability reporting used GetSystemDirectoryW. Delegate the preflight to is_windows_sandbox_available() so reporting and execution agree and the runner is no longer environment-spoofable (Copilot review). Co-authored-by: Copilot App <[email protected]> * fix(windows_sandbox): launch WindowsSandbox.exe from the trusted system path The daemon launched the sandbox binary by bare name, relying on the executable search order (app dir/CWD) — an attacker-planted binary could run in its place, outside the sandbox. Resolve it under the trusted system_directory() (GetSystemDirectoryW), matching the detection path hardened elsewhere in this PR. Surfaced by adversarial review. Co-authored-by: Copilot App <[email protected]> * fix(engine): keep platform_support() limited to SDK-launchable backends available_backends() (introduced by this PR) is the host-capability probe; it already reports the broad set (lxc, windows_sandbox, isolation_session, wslc). platform_support() must stay limited to the backends mxc_sdk::spawn_sandbox can actually launch (dispatch.rs: seatbelt, bubblewrap, processcontainer, wslc), or a caller picking an advertised method gets a guaranteed UnsupportedContainment error. This PR had wrongly expanded platform_support() to add lxc (Linux) and windows_sandbox + isolation_session (Windows); revert those arms and the field doc to the launchable-only contract (per #717 design 7.1). The new drift tests are kept. Addresses SohamDas2021 / Copilot review. Co-authored-by: Copilot App <[email protected]> * fix(lxc): bound and cache the lxc-ls availability probe is_lxc_available() ran `lxc-ls --version` with a blocking status() and no cache, so a hung lxc-ls would block discovery indefinitely and every call re-spawned it (unlike the isolation_session and windows_sandbox probes). Cache the result in a OnceLock and wait with a bounded deadline, killing and reaping the child on timeout. Addresses SohamDas2021 review. Co-authored-by: Copilot App <[email protected]> * fix(engine): derive probe backend names from the enum; gate BFS tier on bfscfg.exe - #7 (SohamDas2021): available_backends() pushed hardcoded string literals, and the drift tests only checked that a separate hardcoded list was valid wire names — not that the pushed literals matched. Derive every pushed name from ContainmentBackend::wire_name() so it can't be typo'd, and make the emittable test iterate the enum so it verifies ContainmentBackend::wire_name() agrees with the canonical wire::Containment serde names. - #9 (SohamDas2021): select_tier() reported AppContainerBfs from the tier2_bfs build flag alone, but detect() also requires bfscfg.exe on disk for a policy-carrying request (else it falls to DACL). Add a bfscfg_available() probe and require both the feature and a resolvable bfscfg.exe before naming BFS, so the reported tier ceiling matches what a real request achieves. Co-authored-by: Copilot App <[email protected]> * docs(mxc-sdk): add host-backend discovery usage guidance + before/after Documents platform_support() vs available_backends() (which to use when), a usage example, and the tier-ceiling caveat, plus the before/after framing. Addresses jsidewhite review on #725. Co-authored-by: Copilot App <[email protected]> * fix(lxc): drop unread exit code from LxcLsOutcome::ExitedFailure The decision only distinguishes success from every other outcome, so the Option<i32> exit code was never read (dead code under -D warnings). Make ExitedFailure a unit variant. Addresses Copilot review. Co-authored-by: Copilot App <[email protected]> * fix(engine): report BFS tier ceiling from tier2_bfs alone, not bfscfg.exe Reverts the bfscfg.exe gating added earlier in this PR. The probe's tier is a CEILING (strongest reachable for some request), not a per-request value: detect() returns AppContainerBfs for a no-filesystem-policy request without bfscfg.exe, so the ceiling on any tier2_bfs build is BFS regardless of bfscfg. Gating the ceiling on bfscfg under-reported it to appcontainer-dacl on a tier2_bfs host lacking bfscfg. bfscfg only decides whether a policy-carrying request stays at BFS or drops to DACL, which is a request-time dispatch concern. Addresses Copilot review; supersedes the earlier response to the bfscfg comment. Co-authored-by: Copilot App <[email protected]> * test(mxc-sdk): fence platform_support() to the SDK-launchable set The platform_support consistency tests were loosened earlier in the PR when it temporarily advertised lxc / windows_sandbox / isolation_session; after those moved to available_backends() the tests were never re-tightened, so they still permitted the excluded backends and a regression re-advertising one would pass (the Linux loop also passed vacuously on a host with no methods). - Linux: assert available_methods == exactly ["bubblewrap"] (lxc excluded). - Windows: keep processcontainer-first, then assert every method is processcontainer | wslc, explicitly excluding windows_sandbox / isolation_session. Addresses SohamDas2021 review. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Huzaifa Danish <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
5 of 8 tasks
4 of 8 tasks
Dan Legg (danlegg)
pushed a commit
that referenced
this pull request
Sep 1, 2026
Address the code-review findings on the coresident explicit-load change (38dbd88). Runtime binding still activates the MSI IsoSessionApp.dll by absolute path with zero registry mutation; this commit hardens the surrounding load, error, and diagnostic behavior. regfree.rs (#1,#5,#6,#7,#8,#9,#10): - Load the App DLL with LoadLibraryExW using LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 so the runtime directory is the sole search root for its dependencies (search-order hijack hardening). Reject non-absolute MXC_ISOSESSION_RUNTIME_DIR overrides. - Replace the 2-state load cache with a 3-state RuntimeLoad enum (Absent / Loaded / Unloadable). A missing default folder still falls back to inbox activation, but an honored-but-broken explicit override or a present-but-unloadable DLL now surfaces the error instead of silently falling back. - Report real Win32 errors (GetProcAddress) and null-check the returned factory pointer before from_raw. - Gate success-path eprintln! on MXC_DIAG_CONSOLE. - Correct the CoInitializeEx SAFETY comment. - Add unit tests for runtime-dir resolution and app-dll path building. manager.rs (#2): wrap the over-length activate line for rustfmt. oneshot.md (#4,#11): document the two activation paths, the runtime-folder resolution table (MXC_ISOSESSION_RUNTIME_DIR / DEFAULT_RUNTIME_DIR), apartment init, and prerequisites; fix RoInitialize -> CoInitializeEx wording. tests/scripts (#3): accept EITHER inbox (System32 DLL + registry) OR the coresident MSI runtime dir in the prerequisite probe, so the suites no longer skip on an MSI-only host. Co-authored-by: Copilot <[email protected]> Copilot-Session: f5cc2011-5308-43d6-a8ea-2b8ed9b6ceb3
Dan Legg (danlegg)
pushed a commit
that referenced
this pull request
Oct 1, 2026
Address the code-review findings on the coresident explicit-load change (38dbd88). Runtime binding still activates the MSI IsoSessionApp.dll by absolute path with zero registry mutation; this commit hardens the surrounding load, error, and diagnostic behavior. regfree.rs (#1,#5,#6,#7,#8,#9,#10): - Load the App DLL with LoadLibraryExW using LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 so the runtime directory is the sole search root for its dependencies (search-order hijack hardening). Reject non-absolute MXC_ISOSESSION_RUNTIME_DIR overrides. - Replace the 2-state load cache with a 3-state RuntimeLoad enum (Absent / Loaded / Unloadable). A missing default folder still falls back to inbox activation, but an honored-but-broken explicit override or a present-but-unloadable DLL now surfaces the error instead of silently falling back. - Report real Win32 errors (GetProcAddress) and null-check the returned factory pointer before from_raw. - Gate success-path eprintln! on MXC_DIAG_CONSOLE. - Correct the CoInitializeEx SAFETY comment. - Add unit tests for runtime-dir resolution and app-dll path building. manager.rs (#2): wrap the over-length activate line for rustfmt. oneshot.md (#4,#11): document the two activation paths, the runtime-folder resolution table (MXC_ISOSESSION_RUNTIME_DIR / DEFAULT_RUNTIME_DIR), apartment init, and prerequisites; fix RoInitialize -> CoInitializeEx wording. tests/scripts (#3): accept EITHER inbox (System32 DLL + registry) OR the coresident MSI runtime dir in the prerequisite probe, so the suites no longer skip on an MSI-only host. Co-authored-by: Copilot <[email protected]> Copilot-Session: f5cc2011-5308-43d6-a8ea-2b8ed9b6ceb3
Dan Legg (danlegg)
pushed a commit
that referenced
this pull request
Oct 1, 2026
Address the code-review findings on the coresident explicit-load change (38dbd88). Runtime binding still activates the MSI IsoSessionApp.dll by absolute path with zero registry mutation; this commit hardens the surrounding load, error, and diagnostic behavior. regfree.rs (#1,#5,#6,#7,#8,#9,#10): - Load the App DLL with LoadLibraryExW using LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 so the runtime directory is the sole search root for its dependencies (search-order hijack hardening). Reject non-absolute MXC_ISOSESSION_RUNTIME_DIR overrides. - Replace the 2-state load cache with a 3-state RuntimeLoad enum (Absent / Loaded / Unloadable). A missing default folder still falls back to inbox activation, but an honored-but-broken explicit override or a present-but-unloadable DLL now surfaces the error instead of silently falling back. - Report real Win32 errors (GetProcAddress) and null-check the returned factory pointer before from_raw. - Gate success-path eprintln! on MXC_DIAG_CONSOLE. - Correct the CoInitializeEx SAFETY comment. - Add unit tests for runtime-dir resolution and app-dll path building. manager.rs (#2): wrap the over-length activate line for rustfmt. oneshot.md (#4,#11): document the two activation paths, the runtime-folder resolution table (MXC_ISOSESSION_RUNTIME_DIR / DEFAULT_RUNTIME_DIR), apartment init, and prerequisites; fix RoInitialize -> CoInitializeEx wording. tests/scripts (#3): accept EITHER inbox (System32 DLL + registry) OR the coresident MSI runtime dir in the prerequisite probe, so the suites no longer skip on an MSI-only host. Co-authored-by: Copilot <[email protected]> Copilot-Session: f5cc2011-5308-43d6-a8ea-2b8ed9b6ceb3
Dan Legg (danlegg)
pushed a commit
that referenced
this pull request
Oct 6, 2026
Address the code-review findings on the coresident explicit-load change (38dbd88). Runtime binding still activates the MSI IsoSessionApp.dll by absolute path with zero registry mutation; this commit hardens the surrounding load, error, and diagnostic behavior. regfree.rs (#1,#5,#6,#7,#8,#9,#10): - Load the App DLL with LoadLibraryExW using LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 so the runtime directory is the sole search root for its dependencies (search-order hijack hardening). Reject non-absolute MXC_ISOSESSION_RUNTIME_DIR overrides. - Replace the 2-state load cache with a 3-state RuntimeLoad enum (Absent / Loaded / Unloadable). A missing default folder still falls back to inbox activation, but an honored-but-broken explicit override or a present-but-unloadable DLL now surfaces the error instead of silently falling back. - Report real Win32 errors (GetProcAddress) and null-check the returned factory pointer before from_raw. - Gate success-path eprintln! on MXC_DIAG_CONSOLE. - Correct the CoInitializeEx SAFETY comment. - Add unit tests for runtime-dir resolution and app-dll path building. manager.rs (#2): wrap the over-length activate line for rustfmt. oneshot.md (#4,#11): document the two activation paths, the runtime-folder resolution table (MXC_ISOSESSION_RUNTIME_DIR / DEFAULT_RUNTIME_DIR), apartment init, and prerequisites; fix RoInitialize -> CoInitializeEx wording. tests/scripts (#3): accept EITHER inbox (System32 DLL + registry) OR the coresident MSI runtime dir in the prerequisite probe, so the suites no longer skip on an MSI-only host. Co-authored-by: Copilot <[email protected]> Copilot-Session: f5cc2011-5308-43d6-a8ea-2b8ed9b6ceb3
Dan Legg (danlegg)
pushed a commit
that referenced
this pull request
Oct 7, 2026
Address the code-review findings on the coresident explicit-load change (38dbd88). Runtime binding still activates the MSI IsoSessionApp.dll by absolute path with zero registry mutation; this commit hardens the surrounding load, error, and diagnostic behavior. regfree.rs (#1,#5,#6,#7,#8,#9,#10): - Load the App DLL with LoadLibraryExW using LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 so the runtime directory is the sole search root for its dependencies (search-order hijack hardening). Reject non-absolute MXC_ISOSESSION_RUNTIME_DIR overrides. - Replace the 2-state load cache with a 3-state RuntimeLoad enum (Absent / Loaded / Unloadable). A missing default folder still falls back to inbox activation, but an honored-but-broken explicit override or a present-but-unloadable DLL now surfaces the error instead of silently falling back. - Report real Win32 errors (GetProcAddress) and null-check the returned factory pointer before from_raw. - Gate success-path eprintln! on MXC_DIAG_CONSOLE. - Correct the CoInitializeEx SAFETY comment. - Add unit tests for runtime-dir resolution and app-dll path building. manager.rs (#2): wrap the over-length activate line for rustfmt. oneshot.md (#4,#11): document the two activation paths, the runtime-folder resolution table (MXC_ISOSESSION_RUNTIME_DIR / DEFAULT_RUNTIME_DIR), apartment init, and prerequisites; fix RoInitialize -> CoInitializeEx wording. tests/scripts (#3): accept EITHER inbox (System32 DLL + registry) OR the coresident MSI runtime dir in the prerequisite probe, so the suites no longer skip on an MSI-only host. Co-authored-by: Copilot <[email protected]> Copilot-Session: f5cc2011-5308-43d6-a8ea-2b8ed9b6ceb3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This .md is the result of some thinking around container policy for Windows, Linix, macOS and a discussion with GHCP about the same.