This is a massive commit that isn't easy to split up, my apologies to
reviewers. Here's everything that's happening.
First, the base tuf package now includes interfaces for RootMetadata,
TargetsMetadata, Rule, and Principal. The first two are self-explanatory. Rule
represents some protection rule, currently matched by the Delegation schema,
while Principal defines a new take on who a trusted party is. Existing schemas
have been moved into a v01 subpackage. v01 also includes a Key type based on
signerverifier.SSLibKey which implements the Principal interface. This means
that expectations elsewhere (such as in repository and policy) re a principal
can be met by existing policy metadata.
Second, with most of the policy metadata manipulations having moved to the tuf
package, this commit drops them from the policy package as they were thin
wrappers. While we originally kept them around for the purposes of migrating
versions when a repository must move from the old metadata schema to a newer
one, it doesn't make sense to implement this in every individual manipulation
function.
Finally, the rest of the packages that handle keys (for adding to metadata or
for signing / verifying) have been updated to use either
signerverifier.SSLibKey directly or the new Principal interface, depending on
what the purpose is. For now, the idea is to continue using the
signerverifier.SSLibKey representation of a key itself for the signature
verification flows, though we may eventually move that into gittuf rather than
rely on go-securesystemslib. Note that some of the transitions have been
included in this commit for compatibility reasons, and subsequent PRs will
update that. For example, the GitHub app pull request approval attestation must
be updated to not use tufv01.Key objects to represent approvers.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
Also updates error chaining in signature verification to preserve error
context, making debugging easier.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This allows us to perform additional checks in future such as whether an
object is replaced by a replace ref. It also makes it easier to switch
between go-git and another mechanism to invoke Git, such as directly
using the binary.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This removes the sub-go.mod in favor of updating all references to the
third_party/go-git package.
This lets users `go install` from outside of the module.
Signed-off-by: Billy Lynch <billy@chainguard.dev>
This fixes a previously unnoticed bug in setting the test config where
the user's name and email were actually left blank. This is an issue
with how go-git parses the raw parts of the config vs the defined
structs. This was primarily noticed because of mismatched hashes on
GitHub actions in the tag, the expected values have changed in some
existing tests as well.
Signed-off-by: Aditya Sirish <aditya@saky.in>