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

Make predicate a required flag in attest commands #3033

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

lcarva
Copy link
Contributor

@lcarva lcarva commented Jun 2, 2023

Summary

The default value for the predicate parameter for the attest and attest-blob commands is an empty string. However, an empty string is not a valid default value for this parameter resulting in an error.

In #2937, it was suggested that the default value for this parameter should be - (read from stdin). But this results in somewhat odd behavior when stdin is not used.

This commit retains the default value of "", but adds the following guardrails:

  1. Makes the --predicate parameter required.
  2. Performs an early check for empty string, and reports an error accordingly.

I also ported the new behavior to the attest-blob command.

Release Note

  • attest-blob can now read predicate payload from standard input.

Documentation

Updated the CLI docs accordingly.

Fixes sigstore#2937

Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Merging #3033 (f54b680) into main (83c08ce) will increase coverage by 0.62%.
The diff coverage is 37.50%.

@@            Coverage Diff             @@
##             main    #3033      +/-   ##
==========================================
+ Coverage   30.45%   31.07%   +0.62%     
==========================================
  Files         152      155       +3     
  Lines        9586     9732     +146     
==========================================
+ Hits         2919     3024     +105     
- Misses       6210     6247      +37     
- Partials      457      461       +4     
Impacted Files Coverage Δ
cmd/cosign/cli/attest.go 0.00% <0.00%> (ø)
cmd/cosign/cli/attest/attest.go 0.00% <0.00%> (ø)
cmd/cosign/cli/attest_blob.go 0.00% <0.00%> (ø)
cmd/cosign/cli/options/predicate.go 0.00% <0.00%> (ø)
cmd/cosign/cli/attest/attest_blob.go 29.11% <20.00%> (-1.02%) ⬇️
cmd/cosign/cli/attest/common.go 100.00% <100.00%> (ø)

... and 13 files with indirect coverage changes

znewman01
znewman01 previously approved these changes Jun 2, 2023
@znewman01
Copy link
Contributor

lgtm modulo docs

Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
@lcarva
Copy link
Contributor Author

lcarva commented Jun 6, 2023

@znewman01, fixed the docs and a minor issue on the tests 🙏

@znewman01 znewman01 merged commit cd1dbc9 into sigstore:main Jun 7, 2023
@github-actions github-actions bot added this to the v1.14.0 milestone Jun 7, 2023
@lcarva lcarva deleted the require-predicate branch June 20, 2023 20:50
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

Successfully merging this pull request may close these issues.

2 participants