verifier: prevent panic in format_rfc3339#1420
Open
hyjiang wants to merge 1 commit into
Open
Conversation
Signed-off-by: Jiang, Hongyan <hongyan.jiang@intel.com>
Xynnn007
reviewed
Jun 12, 2026
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() | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
do you think it's worth an error handling, than using 1970-01-01T00:00:00Z?
cc @mythi
Author
There was a problem hiding this comment.
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.
Member
There was a problem hiding this comment.
btw, you might need to pay attestation to sign-off for commit - which is required from us
89e72cb to
6b8b891
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.