-
Notifications
You must be signed in to change notification settings - Fork 9
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
cli: embed multiple reference values #752
Conversation
dd5740c
to
2fdb880
Compare
77462e7
to
3948272
Compare
3948272
to
f65e7e1
Compare
CI's failing. |
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.
Ticket said
ReferenceValues section should be a list of the same type
Which isn't reflected in this PR. Will that be done in a follow-up?
@@ -43,11 +43,10 @@ func buildVersionString() string { | |||
fmt.Fprintf(versionsWriter, "\t%s\n", image) | |||
} | |||
} | |||
fmt.Fprint(versionsWriter, "\n") | |||
fmt.Fprintf(versionsWriter, "reference values for %s platform:\n", platforms.AKSCloudHypervisorSNP.String()) | |||
fmt.Fprintf(versionsWriter, "\truntime handler:\tcontrast-cc-%s\n", manifest.TrustedMeasurement[:32]) |
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.
Runtime handler isn't printed anymore.
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.
Because there's no singular valid runtime handler anymore
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.
That was already anticipated, that's why there was a platform-specific section in the output.
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.
So do you want to roll back to how it was before, but showing everything for SNP and TDX?
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'm just saying you shouldn't throw away the work other developers put in there without a thought. Should users construct the runtime name themselves in the future and count the offset of the prefix we are using? Is the length of the offset documented anywhere?
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'm fine with changing it back, but then I'd also suggest we don't print the JSON at all. Are you fine with "reverting" that @burgerdev?
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.
Sounds like we need to discuss the question of runtime handlers vs. reference values first - we want this to be a 1:1 mapping, right? So, should it go into ReferenceValues
fields?
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.
Implicitly, I'd say it's already there due to the presence of TrustedMeasurement
in each of the ReferenceValues
. But I think this is something so adjacent to the general discussion of how we want to handle these that we should discuss it in the sync today.
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.
Let's fix the output in a follow up.
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.
Created a ticket for this
fmt.Fprintf(versionsWriter, "\tlaunch digest:\t%s\n", manifest.TrustedMeasurement) | ||
fmt.Fprintf(versionsWriter, "\tgenpolicy version:\t%s\n", constants.GenpolicyVersion) | ||
if refValues, err := json.MarshalIndent(manifest.EmbeddedReferenceValues(), "\t", " "); err == nil { | ||
fmt.Fprintf(versionsWriter, "embedded reference values:\t%s\n", refValues) |
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 reduced readability of the output a lot. If we want to keep this as json output, we should move it to the end and start the json doc in a separate line so you can cut it and process it with jq if needed.
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'd rather have a --json
for this use case.
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.
That would mean a refactoring of the command structure, as we are currently using the builtin --version flag, not a command, right?
@katexochen With the current design, I don't think this is necessary anymore? Also, we discussed in-person that a structured format makes more sense, and you agreed |
We discussed the embedding of the reference values in a structured format (json). In the manifest, we still target a list of reference value configurations, as discussed in previous meetings and documented in the ticket. This will allow us to add multiple platforms of different configuration (heterogeneous clusters with different types of SNP CPUs, for example), which is something we must support but cannot be enabled by the manifest structure given in this PR. |
@katexochen I think there was a misunderstanding of the tickets on my side. Consider this PR to handle 4459, while a follow-up PR should handle 4299 |
f65e7e1
to
9c0e2e2
Compare
9c0e2e2
to
842d44d
Compare
What's the status on this PR? |
I'd like to merge it, but require a review from @katexochen |
7a0881b
to
1b3d3c0
Compare
This adds support for embedding a more versatile format of reference values (i.e. a structured type) into the Contrast binaries. This will allow us to embed all reference values at build-time from a single source (the Nix build file) rather than having SVNs in Go code and inserting trusted measurements via the go build commandline. It will now embed a JSON file containing the reference values, which is unmarshaled at first default manifest generation.
This puts the Nix builds requiring a non-ext filesystem into a tmpfs. This is a workaround until the upstream bug is reported and resolved to / in fakeroot.
1b3d3c0
to
fda28a4
Compare
This adds support for embedding a more versatile format of reference values (i.e. a structured type) into the Contrast binaries. This will allow us to embed all reference values at build-time from a single source (the Nix build file) rather than having SVNs in Go code and inserting trusted measurements via the go build commandline. It will now embed a JSON file containing the reference values, which is unmarshaled at first default manifest generation.