Skip to content

Improved logging for debugging offline attestation - #1

Open
hgowda-amd wants to merge 1 commit into
mainfrom
additional-logging-for-offline-attestation-debugging
Open

Improved logging for debugging offline attestation#1
hgowda-amd wants to merge 1 commit into
mainfrom
additional-logging-for-offline-attestation-debugging

Conversation

@hgowda-amd

@hgowda-amd hgowda-amd commented May 28, 2026

Copy link
Copy Markdown
Owner

Added clear logs for when:

  1. we use offline vs KDS certs.
  2. Was the reference value fetched from RVPS
  3. which claims are matched and which failed to match.
  4. Attestation failed vs success
  5. which policy was used for attestation.

Comment thread deps/verifier/src/snp/mod.rs Outdated

if let Ok(vcek_bytes) = result {
debug!("fetched vcek from {:?}", source);
let source_label = match source {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add the Display trait to VCEKSource to avoid having to do this match multiple times:

impl std::fmt::Display for VCEKSource {
   fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      <put the match here>
}

https://doc.rust-lang.org/std/fmt/trait.Display.html

Then in these debugs you can just pass the variable

Comment thread deps/verifier/src/snp/mod.rs Outdated
return Err(anyhow!("FMC version mismatch"));
}

debug!("SNP TCB verification passed");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be more opinion/personal, but I'm not certain the community will be into adding this much debug - especially for the success cases I think it's a bit excessive, based on what the rest of the repo does. I think the extra one for user-passed certs is useful, and enriching with more specific data is useful, but I think maybe evaluate some of these other ones if they are really needed?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. Now that i think of it, success messages might be redundant.

@hgowda-amd
hgowda-amd force-pushed the additional-logging-for-offline-attestation-debugging branch 2 times, most recently from 3d5b96e to b6ce10e Compare June 10, 2026 20:41
@hgowda-amd
hgowda-amd requested a review from amd-aliem June 10, 2026 20:44

@amd-aliem amd-aliem left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small conciseness suggestion, and the CI is failing (I think you need to do a clippy run or something), but looks good!

Comment thread deps/verifier/src/snp/mod.rs Outdated
Comment on lines +156 to +194
@@ -175,10 +180,35 @@ impl Snp {
// default dir should contain the /vcek segment
let path = path.unwrap_or(KDS_OFFLINE_STORE_PATH.to_string());
let hw_id = self.parse_hw_id_from_vcek(att_report, proc_gen.clone());
// Truncate hw_id to first 8 hex chars for log output — sufficient for
// operator correlation without exposing the full hardware identifier.
let hw_id_prefix = &hw_id[..hw_id.len().min(8)];
let vcek_path = format!("{}/vcek/{}/vcek.der", path, hw_id);
let vcek_bytes = std::fs::read(&vcek_path)
.with_context(|| format!("Failed to read VCEK from offline store at {}", vcek_path))?;
Ok(vcek_bytes)

debug!(
"VCEK offline store lookup: hwId={}... store={}",
hw_id_prefix, path
);

match std::fs::read(&vcek_path) {
Ok(vcek_bytes) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this full hw_id is already shown in the logs (when fetching the KDS URL the hwid is in the path, and probably also in the attestation report as well). The comment somewhat implies it's for a security reason, which is why I'm pointing it out?

Also I think this debug that you added in the parent function above already covers the success case:

if let Ok(vcek_bytes) = result {
                debug!("fetched vcek from {:?}", source);
                info!("VCEK fetched successfully from {}", source);
                return Ok(vcek_bytes);
            }

So you can probably just add debug for the failure case here to avoid adding a lot of lines of debug code:

let vcek_path = format!("{}/vcek/{}/vcek.der", path, hw_id);
std::fs::read(&vcek_path)
      .inspect_err(|e| debug!("VCEK offline store miss: {vcek_path}: {e}"))
      .with_context(|| format!("Failed to read VCEK from {vcek_path}"))

@hgowda-amd
hgowda-amd force-pushed the additional-logging-for-offline-attestation-debugging branch 2 times, most recently from 4b24c5c to a7db003 Compare June 15, 2026 05:44
@hgowda-amd
hgowda-amd force-pushed the additional-logging-for-offline-attestation-debugging branch 3 times, most recently from f9c461f to 540908e Compare July 22, 2026 20:30
Signed-off-by: Harshitha Gowda <hgowda@amd.com>
@hgowda-amd
hgowda-amd force-pushed the additional-logging-for-offline-attestation-debugging branch from 540908e to c8de39a Compare July 22, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants