Implement bounded Windows Event Log jobs and verify contracts on cloud Linux
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-14 10:48:05 +01:00
parent d532ff0ffd
commit 5656431ebf
21 changed files with 2296 additions and 136 deletions
+35
View File
@@ -71,10 +71,45 @@ pub fn supported(job: &JobPayload) -> bool {
interpreter == "powershell" && powershell().is_ok()
}
Action::RefreshInventory { scope } => scope == "windows.base",
Action::QueryLogs { .. } => crate::event_log::for_job(job).is_ok(),
_ => false,
}
}
/// Each prepared operation retains its own typed binding; no non-script action
/// can fall through to inventory or borrow the PowerShell execution profile.
pub enum PreparedAction {
Script(Script),
Inventory,
EventLog(crate::event_log_job::Prepared),
}
impl PreparedAction {
pub fn prepare(
job: &JobPayload,
directory: &Path,
grant: uuid::Uuid,
request: &rmm_agent_core::auth::Request,
boot: uuid::Uuid,
) -> Result<Self> {
ensure!(supported(job), "UNSUPPORTED_CAPABILITY");
match &job.action {
Action::RunScript { .. } => Ok(Self::Script(Script::prepare(job, directory, grant)?)),
Action::RefreshInventory { scope } if scope == "windows.base" => Ok(Self::Inventory),
Action::QueryLogs { .. } => Ok(Self::EventLog(
crate::event_log_job::Prepared::prepare(job, directory, request, grant, boot)?,
)),
_ => anyhow::bail!("UNSUPPORTED_CAPABILITY"),
}
}
pub fn run(self, job: &JobPayload, cancel: &AtomicBool) -> Result<Outcome> {
match self {
Self::Script(script) => script.run(job, cancel),
Self::Inventory => inventory(job),
Self::EventLog(log) => log.run(job, cancel),
}
}
}
pub struct Script {
executable: PathBuf,
path: PathBuf,