-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add SecureBootState to ParseMachineState #139
Conversation
SecureBootState contains enabled, db, dbx, and (post-separator) authority for the time being.
Ran `go generate ./...`.
Add the dbx files from https://uefi.org/revocationlistfile These are the the commonly expected and dbx files.
MachineStateError is a struct that wraps multiple parsing errors when calling ParseMachineState.
This includes the Secure Boot variable (whether enabled), db, dbx, and post-separator Authority. As with PlatformState, ParseMachineState may return a zero value SecureBootState in MachineState if Secure Boot parsing failed. This commit also changes the output of ParseMachineState to return *MachineStateError (implements error) so that dependents can get a detailed view of which parts of the event log fail parsing. As the type implements the Error interface, this is not a breaking change.
GroupedError allows the error that wraps a slice of errors to be reused for Policy evaluation. This adds a helper function as well and fixes an issue with the return value of ParseMachineState. Previously, we always returned a non-nil MachineStateError from ParseMachineState. A zero value MachineStateError evaluate as non-nil in error catching blocks, so we want to instead return either nil or a pointer to a valid MachineStateError.
Often when dealing with GroupedErrors (e.g., parsing a MachineState), there may be a known issue that a user will want to ignore. These functions support filtering through all the errors and looking for a matching substring and also asserting if there is only one match.
The Ubuntu2104NoDbxGCE and Ubuntu2104NoSecureBootGCE event logs fail to parse due to a known issue where go-attestation does not handle SBAT entries: google/go-attestation#222. The Arch Linux event log has a Secure Boot variable with length 0, as opposed to length 1 and data 0. This also causes parsing errors in go-attestation: https://github.com/google/go-attestation/blob/master/attest/secureboot.go#L165-L167 For now, we should expect certain errors and let the test succeed.
Will need to rebase on google#139
DONOTMERGE: Need to rebase against google#139.
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.
Looks good. Some things that we want to address in followup PRs:
We should add more tests to make sure that the parsed out DB/DBX works like we expect
I think we can improve the ergonomics of GroupedError
to work better with the Golang standard Is
and As
methods. But that's fine to do in a followup PR
Regenerate protos and change references.
Also modifies the output of ParseMachineState to return
GroupedError
s to better extract errors in parsing for certain parts of the event log.Add testing on ParseGCENonHostInfo
Fixes #142