Retain bounded SYSTEM script failure metadata and verified execution context; keep historical Unknown unchanged
Rust development slice / linux (push) Failing after 10s

This commit is contained in:
2026-11-16 23:59:50 +01:00
parent 24211a1ac0
commit 0733be2736
5 changed files with 109 additions and 21 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
//! Bounded Windows child process trees. No authorization is conferred here.
//! The caller must commit the verified grant/attempt consumption before run.
//! Job and handle lists are applied atomically by CreateProcessW (Windows 10+).
use anyhow::{Result, ensure};
use anyhow::{Context, Result, ensure};
use std::{
ffi::{OsStr, OsString},
mem::{size_of, size_of_val, zeroed},
@@ -316,8 +316,7 @@ pub(crate) fn run_observed(
!cancel.load(Ordering::SeqCst),
"PROCESS_CANCELLED_BEFORE_START"
);
ensure!(
unsafe {
let created = unsafe {
CreateProcessW(
application.as_ptr(),
command.as_mut_ptr(),
@@ -330,9 +329,10 @@ pub(crate) fn run_observed(
&startup.StartupInfo,
&mut process,
)
} != 0,
"PROCESS_CREATION_REFUSED"
);
};
if created == 0 {
return Err(std::io::Error::last_os_error()).context("PROCESS_CREATION_REFUSED");
}
let process_handle = owned(process.hProcess)?;
let _thread = owned(process.hThread)?;
// Handles not explicitly listed (including job, DB and keys) are never inherited.