Commit graph

46 commits

Author SHA1 Message Date
Yongjae Chung
09395b18d8 Add remove-principal
Signed-off-by: Yongjae Chung <yongjae354@berkeley.edu>
2025-02-04 13:57:21 -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
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
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
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
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
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
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
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 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
Aditya Sirish
313509d3d9
cmd: Move apply to trust / policy cmds
For consistency, this makes apply a subcommand of both trust and policy
commands.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-05-07 16:08:15 -04: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
2e06fec82e
cmd: Fix flag name for consistency
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-04-26 12:30:34 -04:00
neilnaveen
c9a2d19d5f
Change listrules flag
Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2024-04-26 10:16:57 -04:00
neilnaveen
62be4b8360
Introduce Basic Staging Capabilities Utilizing the Policy Staging Ref
Fixed Docs and Lint Errors

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2024-04-26 10:16:57 -04:00
Aditya Sirish
fb95fdbd2c
cmd: Display threshold in list-rules
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-04-17 14:25:39 -07:00
Aditya Sirish
ed943e1b19
*: Update to split add / update policy workflows
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-02-28 13:50:27 -05:00
Aditya Sirish
e8e3fcc01d
cmd: Initial support for thresholds
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-02-28 13:42:23 -05:00
Aditya Sirish
b12c2c2550
*: Split up add and update rule flows
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-02-13 16:00:05 -05:00
Aditya Sirish
4e1e8f8198
cmd: Clarify help message for policy file flags
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-16 15:43:14 -05:00
Aditya Sirish
c6df61360d
cmd: Add gittuf policy sign
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-16 14:14:29 -05: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
0ee820ba37
*: Use tuf.Key for public keys
Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-14 23:47:27 -05:00
Billy Lynch
0eb7030d71
Generate CLI docs.
Adds `DisableAutoGenTag: true` to disable timestamp in generated docs.

Signed-off-by: Billy Lynch <billy@chainguard.dev>
2024-01-12 11:50:27 -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
11acaeac4a
*: Several nits on ListRules
1. This commit filters all AllowRules in the policy package, making the
   check in the cmd package unnecessary.
2. This commit also refactors how delegation rules are tracked so as to
   preserve their order.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2024-01-03 15:50:15 -05:00
neilnaveen
769f619bb0 Fixed docstring and other problems
Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2024-01-03 12:50:41 -06:00
neilnaveen
405c32a126 Added list-rules to cmd
- Added the list-rules command, which list all current rules for the
  latest policy state.
- Fixes issue #191

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2024-01-02 15:24:02 -06:00
Aditya Sirish
21147a0ac6
Merge pull request #186 from spectre10/spectre10/fix-persistent-signingkey
fix: signing-key required on policy remote sub-commands.
2023-11-13 16:42:34 -05:00
spectre10
85d5f5195a
fix: signing-key required for remote subcommands.
Signed-off-by: spectre10 <shyamthakkar001@gmail.com>
2023-11-14 02:56:55 +05:30
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
Aditya Sirish
c323a6a108
cmd: Add remote push for trust and policy
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-10-17 11:37:08 -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
b19fe06c46
*: Add gittuf policy add-key
This allows users to simply add a public key to the specified policy
file without using it in a delegation. This supports signature
verification only scenarios.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-19 16:23:06 -04:00
Aditya Sirish
3f89457c31
cmd: Use cmd.Context instead of context.Background
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-09-12 17:40:31 -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
1fa0cfc845
cmd: Update documentation to highlight GPG support
Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-06-20 16:24:28 -07: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
Aditya Sirish
31035b843c
cmd: Refactor entirely
This is a full fledged refactor of the cmd package based on this comment:
https://github.com/adityasaky/gittuf/pull/41#discussion_r1198995982.

First, the dev subcommand is retired as it was necessary to test certain
RSL functions which have now been built. The subcommand also printed out
the git config, again something we no longer need. To that end,
GetConfig() in gitinterface has been made private.

Second, the trust and policy subcommands have been reimplemented using
the recommended structure with specific packages that construct them
with their options.

Finally, the cmd package has been moved to the internal namespace.

Signed-off-by: Aditya Sirish <aditya@saky.in>
2023-05-20 15:17:11 -04:00