Skip to content

_cli: add plumbing update-trust-root #1174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 16, 2024
Merged

_cli: add plumbing update-trust-root #1174

merged 4 commits into from
Oct 16, 2024

Conversation

woodruffw
Copy link
Member

This adds a new plumbing-level command: update-trust-root. When run, sigstore plumbing update-trust-root will perform a TUF update for the appropriate production or staging trust root, depending on whether the top-level --staging flag is used.

Closes #1172.

CC @mgorny if you can, it'd be great to have you trial this locally to confirm it meets your needs! In particular it'd be useful to know if you'd prefer it to be "louder" in terms of outputs, i.e. print something on stdout/stderr.

Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw added the component:cli CLI components label Oct 15, 2024
@woodruffw woodruffw self-assigned this Oct 15, 2024
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw requested a review from jku October 15, 2024 16:56
@mgorny
Copy link

mgorny commented Oct 15, 2024

Yeah, seems to work fine. My personal weak preference is for more verbose output, particularly if it could help us debug issues in the future. Thanks!

@woodruffw
Copy link
Member Author

Yeah, seems to work fine. My personal weak preference is for more verbose output, particularly if it could help us debug issues in the future. Thanks!

No problem! And makes sense -- I'll mess around with potential outputs here.

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Comment on lines +1245 to +1247
_console.print(
f"Trust root updated: {len(trusted_root.get_fulcio_certs())} Fulcio certificates"
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the best/most useful output, but it should be a visually obvious sign that the step hasn't quietly failed.

Another option here is to dump the trust root as JSON. Not sure how I feel about that, since I don't want people to assume a stable interface on this subcommand quite yet 😅

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be excessive verbose and/or might confuse people as to whether it was written to the file or whether the user needs to redirect the output. Perhaps it could print cache path too, like written to ....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let me see if I can get it to do that. That's somewhere in the guts of the TUF updater itself (which is in python-tuf, not here).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm maybe not following which file you are talking about but I think exposing trusted_root.json location is the only thing that makes sense (as users can't do much with TUF files): that is easily available in all TrustedRoot constructors so you could store the path in TrustedRoot for potential console output later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was thinking trusted_root.json.

Copy link
Member

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok for a first iteration of a "plumbing" command. The fulcio cert count seems a bit useless so that could be the trusted root location instead

I suppose one option would be to add a file hash to the output: it's not friendly to humans but would be a little more auditable

@woodruffw woodruffw merged commit 2ada6d4 into main Oct 16, 2024
25 checks passed
@woodruffw woodruffw deleted the ww/plumbing-update-tr branch October 16, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:cli CLI components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a command to update trusted_root.json without verifying anything
3 participants