Clean up Windows sandbox resources on app uninstall (#42375)

## What changed

- Record the authenticated sandbox owner and observe package uninstall events across service restarts and session changes.
- During uninstall, serialize setup and cleanup, disable sandbox accounts, stop their processes, and remove sandbox directories, firewall and WFP rules, hidden-user entries, accounts, and the sandbox group.
- Restrict desktop-owned directory cleanup to pinned paths and perform it while impersonating the authenticated owner.
- Detect missing or disabled sandbox accounts after interrupted cleanup and reprovision them before restoring network access.

GitOrigin-RevId: 7d63fff7ddcff3eb01d018653146df12044bd277
This commit is contained in:
chess authored and copyberry committed 2026-09-02 22:19:51 +00:00
1 parent a14ef02e1c
commit 665e5f45ab
25 files changed
+1349 -97

No files matched your search

@@ -22,9 +22,18 @@ codex-cloud-config = { workspace = true }
codex-config = { workspace = true }
codex-core = { workspace = true }
codex-windows-sandbox = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt", "sync", "time"] }
toml = { workspace = true }
[target.'cfg(windows)'.dependencies.windows]
version = "0.58"
features = [
"ApplicationModel",
"Win32_System_WinRT",
]
[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.52"
features = [
@@ -40,6 +49,8 @@ features = [
"Win32_System_IO",
"Win32_System_Memory",
"Win32_System_Pipes",
"Win32_System_Registry",
"Win32_System_RemoteDesktop",
"Win32_System_Services",
"Win32_System_SystemServices",
"Win32_System_Threading",