Skip to content

Commit 62ae2f6

Browse files
sarroutbiclaude
authored andcommitted
Ensure UEFI log capabilities are set to false
This change corrects the supports_partial_access and appendable flags for UEFI log evidence to ensure they are always set to false. The agent was previously reporting that the UEFI event log supported partial access and was appendable. This is incorrect because the UEFI log is a complete, immutable record generated at boot time. It cannot be appended to, nor can its entries be fetched partially after the boot process is complete. This change correctly sets these two boolean flags to false, aligning the agent's reported capabilities with the actual behavior of UEFI event logs. Apart from that, added a new unit test, test_uefi_log_capabilities_flags, to verify that these flags are correctly set to false when fetching attestation data. Co-Authored-By: Claude <[email protected]> Signed-off-by: Sergio Arroutbi <[email protected]>
1 parent cbce0e8 commit 62ae2f6

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

keylime-push-model-agent/src/struct_filler.rs

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ impl<'a> FillerFromHardware<'a> {
167167
capabilities: structures::LogCapabilities {
168168
evidence_version: Some(config.uefi_logs_evidence_version().to_string()),
169169
entry_count: uefi_count,
170-
supports_partial_access: true,
171-
appendable: true,
170+
supports_partial_access: false,
171+
appendable: false,
172172
formats: vec!["application/octet-stream".to_string()]
173173
},
174174
},
@@ -724,4 +724,52 @@ mod tests {
724724
assert!(ctx.flush_context().is_ok());
725725
}
726726
}
727+
728+
#[tokio::test]
729+
async fn test_uefi_log_capabilities_flags() {
730+
let _mutex = testing::lock_tests().await;
731+
let context_info_result = context_info::ContextInfo::new_from_str(
732+
context_info::AlgorithmConfigurationString {
733+
tpm_encryption_alg: "rsa".to_string(),
734+
tpm_hash_alg: "sha256".to_string(),
735+
tpm_signing_alg: "rsassa".to_string(),
736+
agent_data_path: "".to_string(),
737+
disabled_signing_algorithms: vec![],
738+
},
739+
);
740+
741+
let mut context_info = match context_info_result {
742+
Ok(ctx) => ctx,
743+
Err(_) => {
744+
println!("Skipping test_uefi_log_capabilities_flags: TPM not available");
745+
return;
746+
}
747+
};
748+
749+
let mut filler = FillerFromHardware::new(&mut context_info);
750+
let request = filler.get_attestation_request();
751+
752+
let uefi_log_evidence = request.data.attributes.evidence_supported.iter().find(|e| {
753+
matches!(e, structures::EvidenceSupported::EvidenceLog { evidence_type, .. } if evidence_type == "uefi_log")
754+
}).expect("uefi_log evidence not found");
755+
756+
if let structures::EvidenceSupported::EvidenceLog {
757+
capabilities,
758+
..
759+
} = uefi_log_evidence
760+
{
761+
assert!(
762+
!capabilities.supports_partial_access,
763+
"UEFI log supports_partial_access should be false"
764+
);
765+
assert!(
766+
!capabilities.appendable,
767+
"UEFI log appendable should be false"
768+
);
769+
} else {
770+
panic!("Expected EvidenceLog for uefi_log"); //#[allow_ci]
771+
}
772+
773+
assert!(context_info.flush_context().is_ok());
774+
}
727775
}

0 commit comments

Comments
 (0)