This commit moves GitHub-specific attestations out of developer mode. In
addition, it drops the authorize subcommand of dev, which was deprecated in the
last release.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
This commit fixes how gittuf rsl log loads RSL entries to print.
Earlier, all entries were loaded into memory first and then printed.
This commit switches over to a buffered write approach, meaning the user
starts seeing output right away.
Signed-off-by: Aditya Sirish <aditya@saky.in>
Co-authored-by: Hao Tran <haoanhtran7@gmail.com>
gittuf has a companion app for GitHub that can record attestations for
pull request reviews. Previously, the app was identified by its signing
key. This commit adds initial support for naming the app, with an eye
towards eventually supporting attestations from multiple apps.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit adds support for different types of global rules (i.e., non
threshold constraints). This commit also adds a global rule to block
force pushes to one or more specified refs.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit adds initial support for "global rules" that set baselines
that must be met during verification. Currently, the global rule only
enforces threshold rules. Each rule is enforced by inspecting the set of
principals successfully verified for a change. If a change is not
protected explicitly, then it's verified using all principals in the
policy.
Signed-off-by: Aditya Sirish <aditya@saky.in>
The RSL entry creation flow checks to see if the latest entry for the
reference being pushed has the same target ID as the proposed new entry.
This check should be optional, depending on how the entry is created.
When created using the "gittuf rsl record" command, the check should be
performed by default. But when created using the git-remote-gittuf
transport, the check is superfluous: the push is happening and an extra
entry recording the push happened is better. This also speeds up the RSL
entry creation for a new branch via the transport, as looking for an
existing RSL entry for the branch in question is expensive (the entire
RSL history must be checked).
Signed-off-by: Aditya Sirish <aditya@saky.in>
1. VerifyMergeable was incorrectly returning an error when no verifiers were
found (for an unprotected base branch).
2. Policy's searcher interface was also returning the wrong error when the
latest policy or attestation entry was not found.
3. A verify-mergeable command has been added to simplify debugging.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
This commit allows for using persons in the CLI. In doing so, it updates the
expected flow where add-rule no longer also adds the principals passed in.
Instead, keys / persons must be added explicitly first, and add-rule will fail
if the principal is not found.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
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>
This commit drops support for the legacy / custom securesystemslib key format.
This format was used in two forms:
a) In tests
b) On disk in the policy state for the root keys
To address the removal, tests have been updated to use SSH keys (via the
ssh-keygen signer). This makes up the majority of the diff for this commit, and
includes some additions to the ssh package to more easily load test artifacts.
Additionally, we don't need to store a policy state's root keys on disk for
that ref. This was an error in our initial design, and it actually leads to
complications in ensuring that the policy state's on disk keys match the keys
listed in the state's root metadata. This commit updates it so only the root
metadata's record of the root keys are used, with the keys directory omitted
for future policy states. However, we maintain backwards compatibility for
policy states that include the keys on disk, we just ignore them.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
This vendors go-securesystemslib's dsse package in preparation for
adding support for DSSE signature extensions.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
This commit adds ReconcileLocalRSLWithRemote, which checks the local RSL
against the specified remote and reconciles the local RSL if needed. If
the local RSL doesn't exist or is strictly behind the remote RSL, then
the local RSL is updated to match the remote RSL. If the local RSL is
ahead of the remote RSL, nothing is updated. Finally, if the local and
remote RSLs have diverged, then the local only RSL entries are reapplied
over the latest entries in the remote if the local only RSL entries and
remote only entries are for different Git references.
Signed-off-by: Aditya Sirish <aditya@saky.in>
Add functions `ReorderDelegations` to handle rule reordering at backend
Add a command 'gittuf policy reorder-rules [flags]' to reorder rules
from CLI by passing a space-separated list of the rules with updated
order.
Signed-off-by: Jamal Cao <jamaltheodds@gmail.com>
The old methods are replaced by a simpler CanSign method needed in cmd as a
pre-run check.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>