Lightweight coding agent that runs in your terminal
Rust
[codex] Restore setup helper UAC manifest (#25949)
iceweasel-oaib2344d8fbc2b
diff --git a/codex-rs/windows-sandbox-rs/BUILD.bazel b/codex-rs/windows-sandbox-rs/BUILD.bazelindex 31dbd3d24c..7e0de41ec4 100644--- a/codex-rs/windows-sandbox-rs/BUILD.bazel+++ b/codex-rs/windows-sandbox-rs/BUILD.bazel@@ -3,4 +3,7 @@ load("//:defs.bzl", "codex_rust_crate")codex_rust_crate(name = "windows-sandbox-rs",crate_name = "codex_windows_sandbox",+ build_script_data = [+ "codex-windows-sandbox-setup.manifest",+ ],)diff --git a/codex-rs/windows-sandbox-rs/Cargo.toml b/codex-rs/windows-sandbox-rs/Cargo.tomlindex 53c81f0b03..31df9ad390 100644--- a/codex-rs/windows-sandbox-rs/Cargo.toml+++ b/codex-rs/windows-sandbox-rs/Cargo.toml@@ -1,4 +1,5 @@[package]+build = "build.rs"edition.workspace = truelicense.workspace = truename = "codex-windows-sandbox"diff --git a/codex-rs/windows-sandbox-rs/build.rs b/codex-rs/windows-sandbox-rs/build.rsnew file mode 100644index 0000000000..af5aec78c6--- /dev/null+++ b/codex-rs/windows-sandbox-rs/build.rs@@ -0,0 +1,39 @@+use std::env;+use std::path::PathBuf;++const SETUP_BIN: &str = "codex-windows-sandbox-setup";+const SETUP_MANIFEST: &str = "codex-windows-sandbox-setup.manifest";++fn main() {+ println!("cargo:rerun-if-changed={SETUP_MANIFEST}");++ if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {+ return;+ }++ let manifest_path = PathBuf::from(+ env::var_os("CARGO_MANIFEST_DIR")+ .expect("CARGO_MANIFEST_DIR should be set for build scripts"),+ )+ .join(SETUP_MANIFEST);+ let manifest_path = manifest_path.display();++ // Keep this scoped to the setup helper so Codex binaries that link the+ // library do not inherit any resource metadata from this package.+ match (+ env::var("CARGO_CFG_TARGET_ENV").as_deref(),+ env::var("CARGO_CFG_TARGET_ABI").as_deref(),+ ) {+ (Ok("msvc"), _) => {+ println!("cargo:rustc-link-arg-bin={SETUP_BIN}=/MANIFEST:EMBED");+ println!("cargo:rustc-link-arg-bin={SETUP_BIN}=/MANIFESTINPUT:{manifest_path}");+ }+ (Ok("gnu"), Ok("llvm")) => {+ println!("cargo:rustc-link-arg-bin={SETUP_BIN}=-Wl,-Xlink=/manifest:embed");+ println!(+ "cargo:rustc-link-arg-bin={SETUP_BIN}=-Wl,-Xlink=/manifestinput:{manifest_path}"+ );+ }+ _ => {}+ }+}diff --git a/codex-rs/windows-sandbox-rs/codex-windows-sandbox-setup.manifest b/codex-rs/windows-sandbox-rs/codex-windows-sandbox-setup.manifestnew file mode 100644index 0000000000..14807962f8--- /dev/null+++ b/codex-rs/windows-sandbox-rs/codex-windows-sandbox-setup.manifest@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">+ <security>+ <requestedPrivileges>+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>+ </requestedPrivileges>+ </security>+ </trustInfo>+</assembly>