Skip to content

verifier: prevent panic in format_rfc3339#1420

Open
hyjiang wants to merge 1 commit into
confidential-containers:mainfrom
hyjiang:dcap-panic-fix
Open

verifier: prevent panic in format_rfc3339#1420
hyjiang wants to merge 1 commit into
confidential-containers:mainfrom
hyjiang:dcap-panic-fix

Conversation

@hyjiang

@hyjiang hyjiang commented Jun 12, 2026

Copy link
Copy Markdown

This PR refactors format_rfc3339 in the Intel DCAP claims helper to gracefully support unexpected or invalid/out-of-range unix timestamps by returning fallback defaults and logging a warning instead of inducing a thread panic.

Signed-off-by: Jiang, Hongyan <hongyan.jiang@intel.com>
@hyjiang hyjiang requested a review from a team as a code owner June 12, 2026 09:00
Comment thread deps/verifier/src/intel_dcap/claims.rs Outdated
Comment on lines +133 to +147
match OffsetDateTime::from_unix_timestamp(timestamp) {
Ok(odt) => match odt.format(&Rfc3339) {
Ok(formatted) => formatted,
Err(e) => {
tracing::warn!(
"failed to format OffsetDateTime to RFC3339: {e:?}, timestamp: {timestamp}"
);
"1970-01-01T00:00:00Z".to_string()
}
},
Err(e) => {
tracing::warn!("invalid/unsupported unix timestamp: {e:?}, timestamp: {timestamp}");
"1970-01-01T00:00:00Z".to_string()
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do you think it's worth an error handling, than using 1970-01-01T00:00:00Z?

cc @mythi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point. Since this is a security-sensitive verification context, failing open with a placeholder timestamp like 1970-01-01T00:00:00Z might hide genuine collateral corruption or validation issues.

I will update the PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

btw, you might need to pay attestation to sign-off for commit - which is required from us

@hyjiang hyjiang force-pushed the dcap-panic-fix branch 2 times, most recently from 89e72cb to 6b8b891 Compare June 12, 2026 10:33
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