-
Notifications
You must be signed in to change notification settings - Fork 547
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
feat: Cosign env should show all possible environment variables. #2236
Comments
This is a great idea! There's two ways to do this:
One wrinkle for both modes: I believe there are some called libraries whose behavior is affected by environment variables: |
Yes! The TUF client pkg exists in sigstore/sigstore, and the behavior there is also affected by env vars. In the future, that will not be the case and all env vars will be at the top level in cosign. I have a TUF client redesign in the works, but it will likely not happen for the next 3 weeks. |
Is this still available? I’d like to try my luck contributing to cosign and this seems like a nice starter. 🙂 |
@xmudrii: 👍 If you need guidance, let me know. My last comment shows a couple ways to get started. |
I created #2322 which combines easy and hard modes with the difference that I didn't create a new CLI command, but used
The PR should have accomplished everything but banning Getenv-related functions. I did some research on banning functions and it doesn't seem possible to ban functions natively with Go. Creating a linter is definitely an option and the workflow would be:
I agree that Getenv in the library code is a smell and should be avoided. I find this as an upgrade of work done in #2322. #2322 would still be useful in terms of keeping track of supported variables. However, how doable is this? This requires some more significant changes to functions and their parameters. Is this something that is possible at this stage? Does cosign provide any backward compatibility promises that might block this work? |
Hey, looks great on first skim @xmudrii! It's a holiday locally so I haven't had a time to really dig into your question; will get back to you soon. |
Perfect, thank you!
I think it might be simpler than that. IIUC forbidigo, built into golanglint, makes this pretty easy. That only applies to our codebase, not upstream (e.g. github.com/sigstore/sigstore) but gets us 90% of the way there. Might even be straightforward to put that in #2322 (if you have a hard time, we won't block merging #2322).
Not necessary to do this for now 😄 I think the above-mentioned work (#2322 + forbidigo) mostly solves this problem for users, and I'd be willing to close this issue after that. There are compatibility guarantees to worry about; there will be a Cosign v2 release at some point, after which things get a lot easier. |
I've looked at the list of linters and haven't seen this one. I guess I didn't pay enough attention. 🙈 I'll update #2322 to integrate |
Description
I'm trying to track down all the possible environment variables as I learn how to use cosign but they're not listed anywhere. It's not uncommon in other tools that use environment variables to have that command show all values set and unset.
So running
cosign env
would show something like:This would make it a lot easier to learn how to use cosign.
The text was updated successfully, but these errors were encountered: