mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Register Windows desktop uninstall ownership before sandbox setup (#45224)
## Why Desktop uninstall cleanup needs an installation owner even when the user has not signed in or configured the Windows sandbox. Recording ownership only during provisioning leaves those installations unregistered. ## What changed - Add an authenticated installation registration request and attempt it during Windows desktop stdio initialization, with a five-second timeout before the initialization response. - Persist ownership independently of provisioning, preserve existing desktop ownership, and prevent another user or home from replacing the registered owner. - Validate write authority and retain directory handles and guards to protect the registered home against junction conversion through privileged cleanup. - Preserve existing CLI homes during desktop uninstall while removing their `CodexSandboxUsers` ACL entries. Report ACL revocation errors and avoid propagating unchanged ACLs. - Grant the owner `WRITE_DAC` on `.sandbox-bin` and allow elevated-helper fallback when older permissions need repair or the service cannot establish an uninstall watcher. ## Testing Add tests for installation registration without sandbox settings and for preserving a child's null DACL when revoking an absent SID from its parent. GitOrigin-RevId: fb48923e9d76758d1bf5b50c7305aa60f91629db
This commit is contained in:
1 parent
1715e55076
commit
36f0dbe796
20 files changed
+446
-146
No files matched your search
@@ -174,6 +174,22 @@ impl InitializeRequestProcessor {
|
||||
*suffix = Some(user_agent_suffix);
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
if matches!(session.origin, ConnectionOrigin::Stdio) && name == "Codex Desktop" {
|
||||
// Uninstall ownership must not depend on account sign-in or sandbox setup.
|
||||
// Keep this bounded attempt ahead of the response; background registration can race uninstall.
|
||||
let home = codex_home.clone();
|
||||
if !matches!(
|
||||
tokio::task::spawn_blocking(move || {
|
||||
codex_windows_sandbox::register_desktop_installation(&home)
|
||||
})
|
||||
.await,
|
||||
Ok(Ok(()))
|
||||
) {
|
||||
tracing::warn!("could not register desktop uninstall ownership");
|
||||
}
|
||||
}
|
||||
|
||||
let user_agent = get_codex_user_agent();
|
||||
let response = InitializeResponse {
|
||||
user_agent,
|
||||
|
||||
Reference in new issue
Block a user