Deploy reviewed Windows sync alignment with schema 20 server
Rust development slice / linux (push) Failing after 7s

Bind the administrative connection-205 review to original signed history and preserve closed readiness. Include the qualified server dependency closure, UI review, native ARM64 build provenance, and guarded deployment evidence. Migration, API/gateway replacement and TLS checks passed with unchanged job authority, protected mounts and time/database services; native Windows receipt application remains separate.
This commit is contained in:
2026-11-16 13:30:31 +01:00
parent 7b320b932e
commit cafd13bca9
34 changed files with 3865 additions and 43 deletions
+68 -3
View File
@@ -45,6 +45,13 @@ struct SystemScope {
deserialize_with = "rmm_domain::jobs::deserialize_script_profiles"
)]
allowed_script_profiles: Option<Vec<rmm_domain::jobs::PrivilegedScriptProfile>>,
#[serde(default, deserialize_with = "strict_optional_reboot")]
allow_reboot: Option<bool>,
}
fn strict_optional_reboot<'de, D: serde::Deserializer<'de>>(
d: D,
) -> Result<Option<bool>, D::Error> {
bool::deserialize(d).map(Some)
}
fn strict_optional_hashes<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
where
@@ -124,6 +131,7 @@ impl SystemScope {
capabilities: &[String],
allow_msi: bool,
allow_scripts: bool,
allow_reboot: bool,
) -> bool {
let has = |cap: &str| capabilities.iter().any(|c| c == cap);
self.valid()
@@ -149,6 +157,12 @@ impl SystemScope {
&& (1..=self.max_runtime_seconds).contains(&job.max_runtime_seconds)
&& (1..=65536).contains(&job.max_output_bytes)
&& match &job.action {
Action::Reboot { .. } => {
allow_reboot
&& self.allow_reboot == Some(true)
&& rmm_domain::windows_reboot::supported(job)
&& job.action.available_for("system", capabilities)
}
Action::SetServiceState { unit, state } => {
self.allowed_services.contains(unit)
&& matches!(state.as_str(), "running" | "stopped")
@@ -188,17 +202,19 @@ impl SystemScope {
}
impl SystemPolicy {
fn valid(&self, now: DateTime<Utc>) -> bool {
matches!(self.schema_version, 1..=3)
matches!(self.schema_version, 1..=4)
&& (self.schema_version >= 2
|| self
.scopes
.iter()
.all(|scope| scope.allowed_msi_recipe_sha256.is_none()))
&& (self.schema_version == 3
&& (self.schema_version >= 3
|| self
.scopes
.iter()
.all(|scope| scope.allowed_script_profiles.is_none()))
&& (self.schema_version == 4
|| self.scopes.iter().all(|scope| scope.allow_reboot.is_none()))
&& self.profile == "development"
&& self.expires_at > now
&& !self.scopes.is_empty()
@@ -219,7 +235,8 @@ impl SystemPolicy {
job,
capabilities,
self.schema_version >= 2,
self.schema_version == 3,
self.schema_version >= 3,
self.schema_version == 4,
)
})
}
@@ -363,6 +380,54 @@ pub async fn authorize(
mod tests {
use super::*;
use serde_json::json;
#[test]
fn reboot_needs_v4_independent_opt_in_capabilities_and_exact_fixed_window() {
let (mut p, mut job, mut caps) = fixture();
job.action = Action::Reboot {
reason: "Einzelne Windows-MVP-Abnahme".into(),
dependency_group: "windows-mvp".into(),
reconnect_timeout_seconds: 180,
};
job.max_runtime_seconds = 60;
p.scopes[0].max_runtime_seconds = 120;
caps.extend(
[
"reboot",
"system:reboot",
rmm_domain::windows_reboot::CAPABILITY,
]
.map(str::to_string),
);
for version in 1..=4 {
p.schema_version = version;
assert!(!p.permits("selected", &job, &caps, Utc::now()));
}
p.scopes[0].allow_reboot = Some(true);
for version in 1..=3 {
p.schema_version = version;
assert!(!p.permits("selected", &job, &caps, Utc::now()));
}
p.schema_version = 4;
assert!(p.permits("selected", &job, &caps, Utc::now()));
assert!(!p.permits("foreign", &job, &caps, Utc::now()));
let complete = caps.clone();
caps.retain(|c| c != "system:reboot");
assert!(!p.permits("selected", &job, &caps, Utc::now()));
caps = complete;
job.execution_identity = "agent_service".into();
assert!(!p.permits("selected", &job, &caps, Utc::now()));
job.execution_identity = "system".into();
if let Action::Reboot {
reconnect_timeout_seconds,
..
} = &mut job.action
{
*reconnect_timeout_seconds = 181;
}
assert!(!p.permits("selected", &job, &caps, Utc::now()));
let invalid = json!({"schema_version":4,"profile":"development","expires_at":Utc::now(),"scopes":[{"allow_reboot":null}]});
assert!(serde_json::from_value::<SystemPolicy>(invalid).is_err());
}
fn fixture() -> (SystemPolicy, JobPayload, Vec<String>) {
let id = Uuid::new_v4();
let now = Utc::now();