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
+63 -4
View File
@@ -22,6 +22,7 @@ const MAX_BYTES: usize = 8192;
pub enum Role {
Agent,
SystemHelper,
Updater,
}
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
@@ -38,6 +39,8 @@ pub struct Context {
pub role: Role,
pub helper_image_sha256: Option<String>,
pub binding_schema: u32,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub updater_image_sha256: Option<String>,
}
impl Context {
pub fn validate(&self) -> Result<()> {
@@ -56,18 +59,30 @@ impl Context {
ensure!(
self.enrollment_generation > 0
&& self.assignment_generation > 0
&& self.connection_generation > 0
&& self.binding_schema == 1,
&& self.connection_generation > 0,
"TIME_CONTEXT_GENERATION"
);
match self.role {
Role::Agent => ensure!(
self.helper_image_sha256.is_none(),
self.binding_schema == 1
&& self.helper_image_sha256.is_none()
&& self.updater_image_sha256.is_none(),
"TIME_AGENT_HELPER_IMAGE"
),
Role::SystemHelper => {
ensure!(
self.binding_schema == 1 && self.updater_image_sha256.is_none(),
"TIME_HELPER_UPDATER_IMAGE"
);
exact_hex(self.helper_image_sha256.as_deref().unwrap_or(""), 32)?;
}
Role::Updater => {
ensure!(
self.binding_schema == 2 && self.helper_image_sha256.is_none(),
"TIME_UPDATER_OWN_BINDING"
);
exact_hex(self.updater_image_sha256.as_deref().unwrap_or(""), 32)?;
}
}
Ok(())
}
@@ -482,7 +497,8 @@ mod tests {
verifier_incarnation: Uuid::new_v4(),
role,
helper_image_sha256: (role == Role::SystemHelper).then(|| "ab".repeat(32)),
binding_schema: 1,
binding_schema: if role == Role::Updater { 2 } else { 1 },
updater_image_sha256: (role == Role::Updater).then(|| "cd".repeat(32)),
}
}
fn fixture(context: Context) -> (Verifier, SigningKey, Uuid) {
@@ -528,6 +544,49 @@ mod tests {
assert!(!result.allows_start(T + 11_000_000, T + 114_000_000));
}
#[test]
fn updater_uses_own_role_image_nonce_and_preserves_legacy_context_bytes() {
let old = context(Role::Agent);
let encoded = serde_json::to_value(&old).unwrap();
assert!(encoded.get("updater_image_sha256").is_none());
let (mut verifier, key, server) = fixture(context(Role::Updater));
let challenge = verifier.begin(sample(0)).unwrap();
assert_eq!(challenge.request().context.binding_schema, 2);
assert!(challenge.request().context.helper_image_sha256.is_none());
let signed = reply(&challenge, &key, server);
verifier
.finish(challenge, &signed, sample(70_000_000), || {
Ok(sample(80_000_000))
})
.unwrap();
for mutation in [0, 1, 2] {
let mut context = context(Role::Updater);
match mutation {
0 => context.binding_schema = 1,
1 => context.helper_image_sha256 = Some("cd".repeat(32)),
_ => context.updater_image_sha256 = None,
}
assert!(context.validate().is_err());
}
let (mut updater, key, server) = fixture(context(Role::Updater));
let challenge = updater.begin(sample(0)).unwrap();
let mut helper_request = challenge.request().clone();
helper_request.context.role = Role::SystemHelper;
helper_request.context.binding_schema = 1;
helper_request.context.helper_image_sha256 = Some("cd".repeat(32));
helper_request.context.updater_image_sha256 = None;
let mut wrong: Payload =
serde_json::from_str(&reply(&challenge, &key, server).payload).unwrap();
wrong.request_sha256 = helper_request.sha256().unwrap();
let wrong = sign(&wrong, &key).unwrap();
assert!(
updater
.finish(challenge, &wrong, sample(70_000_000), || Ok(sample(
80_000_000
)))
.is_err()
);
}
#[test]
fn tampering_wrong_role_nonce_key_and_delays_never_open() {
for mutation in 0..7 {
let (mut v, key, server) = fixture(context(Role::Agent));