Add reviewed Windows scope completion and idle certificate renewal; deploy completion API
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-16 10:25:25 +01:00
parent ebcad08731
commit bb4ffe518d
43 changed files with 5146 additions and 50 deletions
+78
View File
@@ -211,6 +211,15 @@ pub struct LinuxFullTransition {
pub effective_signing_key_id: String,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct WindowsTimeProfileTransition {
pub schema_version: u32,
pub old_time_profile_sha256: String,
pub new_time_profile_sha256: String,
pub agent_qualification_sha256: String,
pub helper_qualification_sha256: String,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
#[serde(tag = "profile", rename_all = "snake_case", deny_unknown_fields)]
pub enum PeerPinTransition {
UnchangedGeneralPinV1 {
@@ -225,8 +234,40 @@ pub enum PeerPinTransition {
new_settings_sha256: String,
old_pin_sha256: String,
new_pin_sha256: String,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "strict_windows_time_profile"
)]
time_profile: Option<WindowsTimeProfileTransition>,
},
}
fn strict_windows_time_profile<'de, D: serde::Deserializer<'de>>(
d: D,
) -> Result<Option<WindowsTimeProfileTransition>, D::Error> {
WindowsTimeProfileTransition::deserialize(d).map(Some)
}
#[cfg(test)]
mod windows_time_transition_tests {
use super::*;
#[test]
fn optional_windows_clock_binding_is_additive_and_null_is_never_missing() {
let old = serde_json::json!({"profile":"windows_code_pair_v1","old_settings_sha256":"11".repeat(32),
"new_settings_sha256":"22".repeat(32),"old_pin_sha256":"33".repeat(32),"new_pin_sha256":"44".repeat(32)});
let decoded: PeerPinTransition = serde_json::from_value(old.clone()).unwrap();
assert_eq!(serde_json::to_value(decoded).unwrap(), old);
let mut invalid = old.clone();
invalid["time_profile"] = serde_json::Value::Null;
assert!(serde_json::from_value::<PeerPinTransition>(invalid).is_err());
let mut current = old;
current["time_profile"] = serde_json::json!({"schema_version":1,
"old_time_profile_sha256":"55".repeat(32),"new_time_profile_sha256":"66".repeat(32),
"agent_qualification_sha256":"77".repeat(32),"helper_qualification_sha256":"88".repeat(32)});
let decoded: PeerPinTransition = serde_json::from_value(current.clone()).unwrap();
assert_eq!(serde_json::to_value(decoded).unwrap(), current);
}
}
impl PeerPinTransition {
fn validate(&self, platform: Platform, predecessor: &Predecessor, target_helper: &str) -> bool {
match self {
@@ -261,6 +302,7 @@ impl PeerPinTransition {
new_settings_sha256,
old_pin_sha256,
new_pin_sha256,
time_profile,
} => {
platform == Platform::WindowsX64
&& [
@@ -273,6 +315,18 @@ impl PeerPinTransition {
.all(|h| digest(h))
&& old_settings_sha256 != new_settings_sha256
&& old_pin_sha256 != new_pin_sha256
&& time_profile.as_ref().is_none_or(|t| {
t.schema_version == 1
&& [
&t.old_time_profile_sha256,
&t.new_time_profile_sha256,
&t.agent_qualification_sha256,
&t.helper_qualification_sha256,
]
.iter()
.all(|h| digest(h))
&& t.old_time_profile_sha256 != t.new_time_profile_sha256
})
}
}
}
@@ -751,6 +805,7 @@ pub fn handoff_matches_job(
new_settings_sha256,
old_pin_sha256,
new_pin_sha256,
time_profile: None,
},
PinTransition::WindowsCodePairV1,
) => {
@@ -762,6 +817,29 @@ pub fn handoff_matches_job(
&& f.new_sha256 == *new_settings_sha256
})
}
(
PeerPinTransition::WindowsCodePairV1 {
old_settings_sha256,
new_settings_sha256,
old_pin_sha256,
new_pin_sha256,
time_profile: Some(time),
},
PinTransition::WindowsCodePairClockV1,
) => {
h.predecessor.pin_sha256 == *old_pin_sha256
&& h.target.pin_sha256 == *new_pin_sha256
&& h.files.get(2).is_some_and(|f| {
f.role == FileRole::WindowsSettings
&& f.old_sha256 == *old_settings_sha256
&& f.new_sha256 == *new_settings_sha256
})
&& h.files.get(4).is_some_and(|f| {
f.role == FileRole::WindowsTimeProfile
&& f.old_sha256 == time.old_time_profile_sha256
&& f.new_sha256 == time.new_time_profile_sha256
})
}
_ => false,
}
}