-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dcap-ql: Fix length validation logic for quote signatures #677
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing input data should not be silently ignored.
// `get_quote` C APIs allowing larger than necessary buffer to be | ||
// allocated to hold the quote. | ||
data = data.take_prefix(cmp::min(data.len(), sig_len))?; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably can have a warning log here if data.len() > sig_len
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a better idea, see the new commit.
/// Parses the `Quote` encoded in `quote`, verifies the signature within the | ||
/// quote, and returns the parsed quote along with any trailing data that | ||
/// was not part of the signature. It's up to the caller to decide what to | ||
/// do with the trailing bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This voluntary behavior is not acceptable - the API should such that it's difficult to misuse.
This should fix #676.