Add reviewed Windows scope completion and idle certificate renewal; deploy completion API
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -67,6 +67,7 @@ pub enum PinTransition {
|
||||
UnchangedLinuxGeneralV1,
|
||||
LinuxGeneralFullV1,
|
||||
WindowsCodePairV1,
|
||||
WindowsCodePairClockV1,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -78,6 +79,7 @@ pub enum FileRole {
|
||||
LinuxFullPin,
|
||||
WindowsSettings,
|
||||
WindowsPin,
|
||||
WindowsTimeProfile,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -197,6 +199,13 @@ impl Handoff {
|
||||
FileRole::WindowsSettings,
|
||||
FileRole::WindowsPin,
|
||||
],
|
||||
PinTransition::WindowsCodePairClockV1 => vec![
|
||||
FileRole::AgentBinary,
|
||||
FileRole::HelperBinary,
|
||||
FileRole::WindowsSettings,
|
||||
FileRole::WindowsPin,
|
||||
FileRole::WindowsTimeProfile,
|
||||
],
|
||||
};
|
||||
ensure!(roles == expected_roles, "HANDOFF_FILE_SET");
|
||||
for file in &self.files {
|
||||
@@ -210,7 +219,7 @@ impl Handoff {
|
||||
&& self.files[1].new_sha256 == self.target.helper_sha256,
|
||||
"HANDOFF_FILE_IMAGE_BINDING"
|
||||
);
|
||||
if self.files.len() == 4 {
|
||||
if self.files.len() >= 4 {
|
||||
ensure!(
|
||||
self.files[3].old_sha256 == self.predecessor.pin_sha256
|
||||
&& self.files[3].new_sha256 == self.target.pin_sha256,
|
||||
@@ -250,7 +259,7 @@ impl Handoff {
|
||||
],
|
||||
"HANDOFF_UNSUPPORTED_SERVICE_SET"
|
||||
),
|
||||
PinTransition::WindowsCodePairV1 => ensure!(
|
||||
PinTransition::WindowsCodePairV1 | PinTransition::WindowsCodePairClockV1 => ensure!(
|
||||
self.stop_set == [Service::WindowsAgent, Service::WindowsHelper],
|
||||
"HANDOFF_UNSUPPORTED_SERVICE_SET"
|
||||
),
|
||||
|
||||
@@ -96,6 +96,31 @@ fn handoff() -> Handoff {
|
||||
fn key() -> SigningKey {
|
||||
SigningKey::from_bytes(&[73; 32])
|
||||
}
|
||||
#[test]
|
||||
fn windows_clock_transition_keeps_historical_four_file_shape_and_requires_exact_new_fifth_role() {
|
||||
let mut value = handoff();
|
||||
value.pin_transition = PinTransition::WindowsCodePairV1;
|
||||
value.stop_set = vec![Service::WindowsAgent, Service::WindowsHelper];
|
||||
value.files[2].role = FileRole::WindowsSettings;
|
||||
value.files[3].role = FileRole::WindowsPin;
|
||||
value.validate().unwrap();
|
||||
let old = value.bytes().unwrap();
|
||||
value.pin_transition = PinTransition::WindowsCodePairClockV1;
|
||||
assert!(value.validate().is_err());
|
||||
value.files.push(FileTransition {
|
||||
role: FileRole::WindowsTimeProfile,
|
||||
old_sha256: h(23),
|
||||
new_sha256: h(24),
|
||||
});
|
||||
value.validate().unwrap();
|
||||
value.files[3].new_sha256 = h(25);
|
||||
assert!(value.validate().is_err());
|
||||
value.files[3].new_sha256 = value.target.pin_sha256.clone();
|
||||
value.files.swap(3, 4);
|
||||
assert!(value.validate().is_err());
|
||||
let historical: Handoff = serde_json::from_slice(&old).unwrap();
|
||||
assert_eq!(historical.bytes().unwrap(), old);
|
||||
}
|
||||
fn open(handoff: &Handoff) -> Journal {
|
||||
Journal::open(&handoff.bytes().unwrap(), key().verifying_key().to_bytes()).unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user