Commit graph

147 commits

Author SHA1 Message Date
patzielinski
4f3b0cf24b
Merge pull request #841 from yongjae354/list-globalrules
gittuf: add command list-globalrules
2025-03-05 18:57:05 +00:00
Yongjae Chung
dfd67f142a add cmd list-global-rules
Signed-off-by: Yongjae Chung <yongjae354@berkeley.edu>
2025-03-05 13:27:50 -05:00
Aditya Sirish A Yelgundhalli
3e7e688406
gittuf: Update how sync and propagation workflows interact
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-03-05 11:21:29 -05:00
Aditya Sirish A Yelgundhalli
0de2972b48
cmd: Add persistent options for attest
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-20 18:13:32 -05:00
Aditya Sirish A Yelgundhalli
3639e23219
*: Add gittuf sync
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-20 17:56:07 -05:00
Aditya Sirish A Yelgundhalli
2dc047ec98
*: Remove some unnecessary pieces
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-18 10:54:27 -05:00
Aditya Sirish A Yelgundhalli
03e363a527
*: Move attest functionality out of dev
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>
2025-02-18 09:18:57 -05:00
Aditya Sirish A Yelgundhalli
3d9ec638b3
*: Add propagation flow to certain RSL workflows
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-05 15:35:16 -05:00
Aditya Sirish A Yelgundhalli
9c9d735f40
gittuf: Add propagation workflow
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-05 14:38:58 -05:00
Aditya Sirish A Yelgundhalli
00fb1658f4
*: Add and remove propagation workflows from metadata
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-05 10:46:02 -05:00
Yongjae Chung
09395b18d8 Add remove-principal
Signed-off-by: Yongjae Chung <yongjae354@berkeley.edu>
2025-02-04 13:57:21 -05:00
Aditya Sirish A Yelgundhalli
2923704fa0
gitinterface: Support bare clones
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-02-04 11:18:02 -05:00
Horiodino
3d0be301a4
added Discard to clear the changes currently staged
Signed-off-by: Horiodino <holiodin@gmail.com>

updated Docs

Signed-off-by: Horiodino <holiodin@gmail.com>
2025-02-03 14:56:17 +05:30
Aditya Sirish
749b7df97c
*: Add support for coloring log output
Signed-off-by: Aditya Sirish <aditya@saky.in>
2025-02-01 17:58:11 -05:00
Aditya Sirish
c3148721b9
rsl: Fix gittuf rsl log buffering
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>
2025-02-01 17:51:37 -05:00
Aditya Sirish A Yelgundhalli
16d9e1d9ce
*: Move reference authorizations out of dev mode
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-01-31 13:45:23 -05:00
Aditya Sirish A Yelgundhalli
82dfce994c
gittuf,policy: Add VerifyMergeableForCommit
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-01-28 17:53:09 -05:00
Aditya Sirish
d5df401da5
cmd: Fix help message
Signed-off-by: Aditya Sirish <aditya@saky.in>
2025-01-23 14:23:27 -05:00
Aditya Sirish
20780c2d84
*: Initial support for naming for gittuf app
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>
2025-01-23 13:34:42 -05:00
Aditya Sirish
a6c296b92e
Merge pull request #740 from gittuf/root-location
*: Add repositoryLocation to root metadata
2025-01-16 15:21:44 -05:00
Aditya Sirish A Yelgundhalli
72f47b06d0
*: Add repositoryLocation to root metadata
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2025-01-16 15:10:29 -05:00
Horiodino
deb011a9bf *: Add support for removing global rules
Signed-off-by: Horiodino <holiodin@gmail.com>

Update test-cases for global-rules

Signed-off-by: Horiodino <holiodin@gmail.com>

Add cmd for remove-global-rule

Signed-off-by: Horiodino <holiodin@gmail.com>

Handling RemoveGlobalRuleThreshold and RemoveGlobalRuleBlockForcePushes rule

Signed-off-by: Horiodino <holiodin@gmail.com>

Update docs

Signed-off-by: Horiodino <holiodin@gmail.com>

fixed minor bugs

Signed-off-by: Horiodino <holiodin@gmail.com>

Handling RemoveGlobalRuleThreshold and RemoveGlobalRuleBlockForcePushes rule

Signed-off-by: Horiodino <holiodin@gmail.com>
2025-01-16 13:05:30 -05:00
Jamal Cao
7e0a338be5 tui: added a terminal user interface (TUI) for managing gittuf policy
Signed-off-by: Jamal Cao <jamaltheodds@gmail.com>
2025-01-15 11:32:09 -05:00
Aditya Sirish
3e24f4ceaf
*: Support multiple types of global rules
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>
2025-01-09 19:14:29 -05:00
Aditya Sirish
96516300f6
*: Add support for global rules
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>
2025-01-09 17:03:39 -05:00
Aditya Sirish
90a4d1a806
gittuf,cache,policy,cmd: Use persistent cache
This commit adds support for persistent cache searching as well as
explicit populating.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2025-01-08 12:42:13 -05:00
Aditya Sirish
cdacf9cf1a
*: Add control for RSL duplicate check
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>
2024-12-18 11:21:00 -05:00
Aditya Sirish A Yelgundhalli
a601aee55d
*: Various policy fixes
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>
2024-12-06 16:08:32 -05:00
Pat Zielinski
4a7bc7e168 *: Move and update signing key checks
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-11-11 18:05:39 -05:00
Aditya Sirish A Yelgundhalli
5a04f0b614
gittuf: Expose GitHub token as an opt
Also, an error is returned if a token is not provided.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-11-11 11:08:37 -05:00
Aditya Sirish A Yelgundhalli
4ccc102f8e
*: Use person associatedIdentities to verify code review tool approvals
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-11-07 17:21:19 -05:00
Aditya Sirish A Yelgundhalli
9c08c47035
*: Expose persons in CLI
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>
2024-11-07 15:11:52 -05:00
Aditya Sirish A Yelgundhalli
20d37fbd0c
tuf, cmd: Expose a principal's custom metadata
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-11-07 12:48:07 -05:00
Aditya Sirish A Yelgundhalli
8c49dfea3a
policy, cmd: Add list-principals sub command
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-11-07 12:48:06 -05:00
Aditya Sirish A Yelgundhalli
ede40dc5e0
cmd, gittuf: Move key / signer APIs to gittuf
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-23 15:59:25 -04:00
Aditya Sirish A Yelgundhalli
eda8a89e2a
repository -> gittuf: Expose a gittuf Go API
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-23 13:30:35 -04:00
Aditya Sirish A Yelgundhalli
2f0be5c46f
*: Refactor TUF
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>
2024-10-15 12:58:44 -04:00
Aditya Sirish A Yelgundhalli
8a43f4fffd
*: Remove vendored signerverifier library
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-10 13:30:32 -04:00
Aditya Sirish A Yelgundhalli
f1473c53e5
*: Add sigstore signer for metadata
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-09 16:13:01 -04:00
Aditya Sirish A Yelgundhalli
f7dd00b7bd
*: Remove use of signerverifier dispatcher
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-09 12:59:32 -04:00
Aditya Sirish A Yelgundhalli
a5a9ff1e7d
*: Move policy metadata manipulations to tuf package
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-09 12:59:32 -04:00
Aditya Sirish A Yelgundhalli
634b1cd98e
*: Remove legacy key types
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>
2024-10-04 14:58:50 -04:00
Pat Zielinski
3829d966c3 cmd: Drop devmode requirement for root and policy thresholds
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-10-01 11:18:59 -04:00
Pat Zielinski
d571facb8d *: Add copyright notice to code files
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-09-27 15:28:12 -04:00
Aditya Sirish A Yelgundhalli
6093b595d2
third_party: Vendor go-securesystemslib/dsse
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>
2024-09-26 14:29:00 -04:00
Aditya Sirish
fbf9720b29
Merge pull request #546 from gittuf/no-transport-check
Add reconciliation workflow to update local RSL against remote RSL
2024-09-25 14:26:34 -04:00
Aditya Sirish
929e0d162d
*: Automatically reconcile local RSL with remote updates
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>
2024-09-25 14:02:59 -04:00
Jamal Cao
fdce8e76ce Add functions and a command for reorder rules in a policy file
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>
2024-09-10 15:23:39 -04:00
Aditya Sirish
4698cdb86c
Merge pull request #439 from gittuf/github-app-attestation
attestations: Add support for GitHub pull request approval attestation
2024-08-21 15:28:39 -04:00
Aditya Sirish A Yelgundhalli
6474c5284f
*: Replace deprecated methods to identify signing config
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>
2024-08-15 15:42:12 -04:00