Repository navigation
fix: only show public-instance privacy statement for the default Rekor URL - #5042
Conversation
…r URL Motivation: When uploading to a transparency log, cosign always printed the "hosted by sigstore a Series of LF Projects, LLC" privacy statement and confirmation prompt, even when the user pointed --rekor-url at their own local or self-hosted Rekor instance. The upload itself correctly went to the custom instance, but the displayed text described the public sigstore.dev data-retention/Terms of Use policy, which is misleading and confusing for anyone running their own Rekor server (e.g. via the rekor docker-compose setup). This is a UX/cosmetic issue only: no upload destination or signing behavior changes, only the confirmation text shown to the user. Approach: In ShouldUploadToTlog (cmd/cosign/cli/signcommon/common.go), only show the public-instance privacy statement when the configured Rekor URL is empty (unset) or equal to options.DefaultRekorURL (https://rekor.sigstore.dev). A custom --rekor-url no longer triggers the public-instance notice. Validation: - go build ./... - go test $(go list ./... | grep -v third_party/) (equivalent to `make test`) — all packages pass - make lint — 0 issues - Added TestShouldUploadToTlog_CustomRekorURLSkipsPublicInstanceStatement in cmd/cosign/cli/signcommon/common_test.go, which calls ShouldUploadToTlog with a custom RekorURL and asserts the public-instance statement is not printed. Manually reverted the guard and reran the test to confirm it fails without the fix and passes with it restored. Report: #4400 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5042 +/- ##
==========================================
- Coverage 40.10% 39.47% -0.63%
==========================================
Files 155 207 +52
Lines 10044 13032 +2988
==========================================
+ Hits 4028 5145 +1117
- Misses 5530 7156 +1626
- Partials 486 731 +245 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| if upload { | ||
| // Only warn about the public good instance's data retention policy when | ||
| // actually uploading to it; a custom --rekor-url points elsewhere. | ||
| if upload && (ko.RekorURL == "" || ko.RekorURL == options.DefaultRekorURL) { |
There was a problem hiding this comment.
im not sure this is sufficient; it would be better to match against logs listed in the TUF root that maps back to the pgi (urls will change over time); @Hayden-IO wdyt?
There was a problem hiding this comment.
Yea, we can't use the static Rekor URL, we already have another set of region-specific and year-specific URLs for newer Rekor instances. The other problem is that the TUF repo isn't sufficient as a signal, because a user could also provide their own configuration file that uses the public instance.
I'd be OK with baking in *.sigstage.dev and *.sigstore.dev though.
|
Good point — comparing against the literal default URL string is fragile since Rekor URLs can change over time, so this wouldn't reliably track "is this actually the public-good instance" going forward. Matching against the transparency logs listed in the TUF trusted root sounds like the more durable approach, but I don't want to guess at that implementation without being sure I'm using the right trust-root API correctly. I'll hold off on further changes here pending @Hayden-IO's input on the preferred approach — happy to implement once there's agreement on direction. |
…ffix Per review feedback, an exact-string match against the default Rekor URL doesn't account for region- and year-specific public-good hostnames. Only suppress/show the privacy statement based on whether the configured Rekor URL's hostname is sigstore.dev/sigstage.dev or a subdomain of either. Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
|
Thanks @Hayden-IO — that's a good, concrete signal to key off of. I've updated the check to match the Rekor URL's hostname against |
| // instance. | ||
| func isPublicGoodRekorURL(rekorURL string) bool { | ||
| if rekorURL == "" { | ||
| return true |
There was a problem hiding this comment.
should this be false, or just remove and let url.Parse handle the empty string? I assume this is irrelevant though because if upload == true, there must be a valid log URL.
There was a problem hiding this comment.
Should we change this to false?
| } | ||
| } | ||
|
|
||
| func TestShouldUploadToTlog_CustomRekorURLSkipsPublicInstanceStatement(t *testing.T) { |
There was a problem hiding this comment.
can these tests be grouped together using table driven testing?
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
An empty ko.RekorURL means NewSigningConfigFromKeyOpts configures no Rekor service at all, so nothing is uploaded to the public-good instance in that case; the privacy statement should not be shown. Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
|
@Hayden-IO good catch — done. |
Motivation:
When uploading to a transparency log, cosign always printed the
"hosted by sigstore a Series of LF Projects, LLC" privacy statement
and confirmation prompt, even when the user pointed --rekor-url at
their own local or self-hosted Rekor instance. The upload itself
correctly went to the custom instance, but the displayed text
described the public sigstore.dev data-retention/Terms of Use policy,
which is misleading and confusing for anyone running their own Rekor
server (e.g. via the rekor docker-compose setup).
This is a UX/cosmetic issue only: no upload destination or signing
behavior changes, only the confirmation text shown to the user.
Approach:
In ShouldUploadToTlog (cmd/cosign/cli/signcommon/common.go), only show
the public-instance privacy statement when the configured Rekor URL is
empty (unset) or equal to options.DefaultRekorURL
(https://rekor.sigstore.dev). A custom --rekor-url no longer triggers
the public-instance notice.
Validation:
make test) — all packages passin cmd/cosign/cli/signcommon/common_test.go, which calls
ShouldUploadToTlog with a custom RekorURL and asserts the public-instance
statement is not printed. Manually reverted the guard and reran the test
to confirm it fails without the fix and passes with it restored.
Report: #4400
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
Fixes #4400