Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Refactor package common #226

Merged
merged 5 commits into from
Apr 27, 2023
Merged

Refactor package common #226

merged 5 commits into from
Apr 27, 2023

Conversation

rbehjati
Copy link
Contributor

@rbehjati rbehjati commented Apr 27, 2023

Fixes #220

Splits the package common moving some parts of it to a new package verification and renaming the rest to model.

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to README are included in PR

@rbehjati rbehjati changed the title Refactor Refactor package common Apr 27, 2023
@@ -12,36 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package common provides utility functions for building and verifying released binaries.
package common
// Package provenance provides the internal representation of a provenance

Choose a reason for hiding this comment

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

wrong package name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed.

"github.com/pelletier/go-toml"
)

// ReferenceValues given by the product team to verify provenances against.

Choose a reason for hiding this comment

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

I don't particularly like the "product team" terminology. How about "verifier" or "client"? I don't really like those either, but I think we should keep thinking about a better alternative (after this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't care so much where these values come from, at least in this documentation. Updated the comments.

// ReferenceValues given by the product team to verify provenances against.
type ReferenceValues struct {
// The digests of the binaries whose provenance the product team wants to verify.
BinarySHA256Digests []string `toml:"binary_sha256_digests"`

Choose a reason for hiding this comment

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

Not sure why these are only sha256? Could they not be arbitrary digests, as long as they have the appropriate prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general they could, but we use SHA256. We can relax this restriction in the future if needed.

// If true the product team wants the provenance to have a non-empty build command.
WantBuildCmds bool `toml:"want_build_cmds"`
// The digests of the builder images the product team trusts to build the binary.
BuilderImageSHA256Digests []string `toml:"builder_image_sha256_digests"`

Choose a reason for hiding this comment

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

For slice fields, I assume that means that any of those values is sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Updated the comment to better reflect this.

Copy link
Contributor Author

@rbehjati rbehjati left a comment

Choose a reason for hiding this comment

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

Thanks for the review.

@@ -12,36 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package common provides utility functions for building and verifying released binaries.
package common
// Package provenance provides the internal representation of a provenance
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed.

"github.com/pelletier/go-toml"
)

// ReferenceValues given by the product team to verify provenances against.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't care so much where these values come from, at least in this documentation. Updated the comments.

// ReferenceValues given by the product team to verify provenances against.
type ReferenceValues struct {
// The digests of the binaries whose provenance the product team wants to verify.
BinarySHA256Digests []string `toml:"binary_sha256_digests"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general they could, but we use SHA256. We can relax this restriction in the future if needed.

// If true the product team wants the provenance to have a non-empty build command.
WantBuildCmds bool `toml:"want_build_cmds"`
// The digests of the builder images the product team trusts to build the binary.
BuilderImageSHA256Digests []string `toml:"builder_image_sha256_digests"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Updated the comment to better reflect this.

@rbehjati rbehjati merged commit d8894ae into project-oak:main Apr 27, 2023
@rbehjati rbehjati deleted the refactor branch April 27, 2023 19:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename the "common" package to a more descriptive name
2 participants