Commit graph

30 commits

Author SHA1 Message Date
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
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
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
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 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
Aditya Sirish A Yelgundhalli
fe6d1d343a
*: Drop old gitinterface APIs
This commit also renames ReplacementTreeBuilder to TreeBuilder.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-07-01 10:21:25 -04:00
Aditya Sirish A Yelgundhalli
898e2eb472 cmd: Wire up ssh-keygen support
Drops support for legacy securesystemslib key format in the CLI.

Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-06-17 10:06:08 -04:00
neilnaveen
fbd580098b Add support to check if expected root keys are the actual root keys in clone.go
- Added the expectedRootKeys flag to clone.go
- Added addtional test in sync_test.go for expectedRootKeys

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2024-05-27 13:00:45 -05:00
Pat Zielinski
5286631fb3 cmd: Rework signing-key flag check
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2024-05-03 11:21:37 -04:00
Aditya Sirish
8874a3420b
cmd: Update for new repository APIs
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-15 00:23:47 -05:00
Aditya Sirish
3397ac9bad
*: Vendor go-sslib with new signerverifier flows
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-15 00:22:53 -05:00
Aditya Sirish
0ee820ba37
*: Use tuf.Key for public keys
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-14 23:47:27 -05:00
Aditya Sirish
4cb2856a51
*: Move eval mode check out of cmd
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-10 19:00:43 -05:00
Aditya Sirish
f4ade6f91a
cmd: Add support for PEM encoded keys
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-09 12:44:04 -05:00
Aditya Sirish
a540ccc7f4
*: Switch to tagged go-sslib
Also updates sigstore/sigstore thaqt incorporates the change in
go-sslib.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-12-21 09:50:39 -05:00
Pat Zielinski
d6c45fe479 *: Check if signing viable before running commands
This commit has gittuf check if signing using the user's
signing key (specified in the git configuration) is possible
for commands that require this. This is done by way of a
function in cmd/common/common.go, called in commands' PreRunE.

Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2023-11-13 15:05:30 -05:00
Aditya Sirish
a95ec8df43
*: Fix linter issues
This commit fixes issues flagged by the additional linters enabled in
the parent commit.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-24 16:48:46 -04:00
Pat Zielinski
d0905e7816 Add SPDX License Identifiers to code files
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
2023-10-09 08:09:34 -04:00
Aditya Sirish
464ffa8a04
Merge pull request #112 from gittuf/clean-gpg-handling
Clean up GPG key load from bytes
2023-09-15 12:13:43 -04:00
Aditya Sirish
2602875c93
cmd: Add eval mode, record old commits in RSL
The CLI package checks if gittuf is in eval mode before invoking
functions that are not meant for regular use. This commit also adds the
gated invocation for the first eval function, the ability to record an
RSL entry for non-latest commits in a ref.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-15 11:45:04 -04:00
Aditya Sirish
f7eb00a6d6
*: Clean up GPG key load from bytes
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-13 11:26:19 -04:00
Aditya Sirish
3192cdb861
Rename module to use gittuf org
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-08-30 13:13:54 -04:00
Aditya Sirish
0d4be41b91
Early gitsign support
This commit introduces early, experimental support for gitsign
signatures on git commits. It uses TAP-18 to specify sigstore identity
constraints in delegations.

The feature introduced here depends on unreleased prototype code in
go-securesystemslib and is also insufficiently tested due to some
sigstore library constraints.

See: #73

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-08-07 15:27:37 -04:00
Aditya Sirish
d4d32673a8
cmd: Add PGP key support
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-06-20 16:17:23 -07:00