Wire preserved update control, health evidence and record publication
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -32,6 +32,18 @@ impl Original {
|
||||
delegation: UpdateDelegation,
|
||||
clock: &impl SyncClock,
|
||||
budget: &Budget,
|
||||
) -> Result<Self> {
|
||||
let result = Self::verify_retained(binding, start_bytes, record, delegation)?;
|
||||
result.check_current(binding, clock, budget)?;
|
||||
Ok(result)
|
||||
}
|
||||
/// Historical evidence ONLY. Never supplies current boot/time/owner trust,
|
||||
/// health authority, a new lease or permission for any native effect.
|
||||
pub fn verify_retained(
|
||||
binding: &Binding,
|
||||
start_bytes: &[u8],
|
||||
record: &[u8],
|
||||
delegation: UpdateDelegation,
|
||||
) -> Result<Self> {
|
||||
ensure!(
|
||||
!start_bytes.is_empty()
|
||||
@@ -40,7 +52,6 @@ impl Original {
|
||||
&& record.len() <= rmm_updater_handoff::MAX_RECORD_BYTES,
|
||||
"UPDATE_ORIGINAL_LIMIT"
|
||||
);
|
||||
budget.check()?;
|
||||
let handoff: Handoff = serde_json::from_slice(record)?;
|
||||
handoff.validate()?;
|
||||
ensure!(
|
||||
@@ -72,12 +83,8 @@ impl Original {
|
||||
&request,
|
||||
handoff.boot_id,
|
||||
delegation.prepared_at
|
||||
)? == start_bytes
|
||||
&& std::fs::read_to_string("/proc/sys/kernel/random/boot_id")?
|
||||
.trim()
|
||||
.parse::<uuid::Uuid>()?
|
||||
== handoff.boot_id,
|
||||
"UPDATE_ORIGINAL_START_OR_BOOT_CHANGED"
|
||||
)? == start_bytes,
|
||||
"UPDATE_ORIGINAL_START_CHANGED"
|
||||
);
|
||||
ensure!(
|
||||
job.execution_identity == "root"
|
||||
@@ -144,7 +151,6 @@ impl Original {
|
||||
delegation,
|
||||
start_bytes: start_bytes.to_vec(),
|
||||
};
|
||||
result.check_current(binding, clock, budget)?;
|
||||
Ok(result)
|
||||
}
|
||||
pub fn check_current(
|
||||
@@ -154,6 +160,13 @@ impl Original {
|
||||
budget: &Budget,
|
||||
) -> Result<()> {
|
||||
budget.check()?;
|
||||
ensure!(
|
||||
std::fs::read_to_string("/proc/sys/kernel/random/boot_id")?
|
||||
.trim()
|
||||
.parse::<uuid::Uuid>()?
|
||||
== self.handoff.boot_id,
|
||||
"UPDATE_ORIGINAL_BOOT_CHANGED"
|
||||
);
|
||||
let now = clock.now()?;
|
||||
ensure!(
|
||||
now >= self.delegation.prepared_at
|
||||
|
||||
Reference in New Issue
Block a user