Skip to content
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

Write Chain Target: Validate that signed report metadata matches request metadata #14066

Merged
merged 54 commits into from
Aug 9, 2024

Conversation

DeividasK
Copy link
Collaborator

@@ -82,36 +115,11 @@ func TestWriteTarget(t *testing.T) {
require.NotNil(t, response)
})

t.Run("succeeds with empty report", func(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed because we no longer support a use case in which an empty report is passed to the target capability.

@DeividasK DeividasK marked this pull request as ready for review August 8, 2024 06:17
@DeividasK DeividasK requested a review from a team as a code owner August 8, 2024 06:17
Base automatically changed from dk-fix-write-target-nil-dereference to develop August 8, 2024 14:43
…t-metadata

# Conflicts:
#	core/capabilities/targets/write_target.go
#	core/capabilities/targets/write_target_test.go
if len(data) < metadata.Length() {
return metadata, fmt.Errorf("data too short: %d bytes", len(data))
}
return metadata, binary.Read(bytes.NewReader(data[:metadata.Length()]), binary.BigEndian, &metadata)
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't know that binary.Read() makes is so easy, TIL :)

Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to use something similar in cap encoder too

return buf.Bytes(), nil
}

func (rm ReportV1Metadata) Length() int {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Feels a bit wasteful, could be a const... likely doesn't matter.

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.

3 participants