Skip to content
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

Proposal to move global and command flags to go-witness #509

Open
matglas opened this issue Oct 9, 2024 · 3 comments
Open

Proposal to move global and command flags to go-witness #509

matglas opened this issue Oct 9, 2024 · 3 comments

Comments

@matglas
Copy link
Contributor

matglas commented Oct 9, 2024

Problem

Witness relies as a dependency on go-witness. Some of the commands/attestors that are run are dependent on flags that are set thru global flag on the CLI. This separation makes it hard to introduce new flag or alter existing flags because witness first needs to update its dependency to the latest release of go-witness before it can merge new flags into the repo.

This happens because global flags call on options like WithX on different attestors etc.

Proposal

I believe it would be very helpful to move the registration of global or command flags to the go-witness library. This could be in a internal/cli package that allows us to make clear separation between library and facilitation of the 'companion' cli.

@matglas
Copy link
Contributor Author

matglas commented Oct 9, 2024

With a bit of work on the registry (https://github.com/in-toto/go-witness/tree/main/registry) its possible to add global options too probably. And add them to the context that is passed around.

@mikhailswift
Copy link
Member

One of the primary reasons Witness and go-witness were broken into separate go modules was to keep go-witness's dependencies slim. For instance, a developer using go-witness as a library shouldn't need to have spf13/cobra or logrus as transitive dependencies if they weren't using those CLI/logging libraries. This is the same reason why go-witness uses a logging interface for developers to provide their own logging implementation.

I'm not opposed to reorganizing things to make the development of witness and go-witness simpler when it comes to this, but I do think those goals are important. I'm unclear on how moving global options to go-witness solves the problem of having to update go-witness in Witness when options change/get added, but I could be missing something.

@matglas
Copy link
Contributor Author

matglas commented Oct 14, 2024

I am all for keeping it slim and making it possible to use it as a library. Thats why I would like to use the approach that attestors already have to register flags. The flags that I am thinking of are 'general' flags that set can be used in the AttestationContext. A flag like we use for dirhash but also the new once for environment should be used to configure a object that is set on the AttestationContext so that multiple attestors can use it. It does not produce an attestion itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants