-
Notifications
You must be signed in to change notification settings - Fork 75
Drop support for online verification #840
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
base: main
Are you sure you want to change the base?
Drop support for online verification #840
Conversation
|
I don't see much need for unit tests here, but I added them for code coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Horiodino could you rebase and update (go mod tidy) go.mod and go.sum as needed to allow CI to run?
aaa28f6 to
beae4b1
Compare
beae4b1 to
c938a2e
Compare
|
fyi: I'm at a conference, so my review will be slightly delayed, apologies. |
27abe79 to
627e584
Compare
|
I'll review this with a private sigstore instance, but eyeballing it, it looks good. :) s/review/test |
eb468f6 to
23bc49f
Compare
| func (v *Verifier) getTUFRoot() (root.TrustedMaterial, error) { | ||
| rootFilePath := os.Getenv("SIGSTORE_TRUSTED_ROOT") | ||
| if rootFilePath == "" { | ||
| return nil, tuf.ErrNoTrustedRootFound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should default to the public good instance in this case, since the private sigstore root isn't declared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also use https://github.com/sigstore/sigstore-go/blob/main/pkg/tuf/options.go#L85-L88 so we're still using tuf semantics to bootstrap trust for the root file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's necessary—the DefaultOptions already takes care of that. [Reference]
I would also use https://github.com/sigstore/sigstore-go/blob/main/pkg/tuf/options.go#L85-L88 so we're still using tuf semantics to bootstrap trust for the root file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but you return an error before the client is hit, no? In the public good case, we don't need the env var set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it correct now ?
23bc49f to
0c2177d
Compare
| // TODO: support custom sigstore TUF root URL | ||
|
|
||
| tufClient, err := sigstoretuf.New(sigstoretuf.DefaultOptions()) | ||
| trustedRootBytes, err := os.ReadFile(rootFilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit off. Unfortunately, "root" is a bit overloaded here. We want to load the root.json bytes for the TUF repository, that's what's embedded in the sigstore-go library as well for the public good instance. Then, using that TUF root and the TUF client, we want to separately fetch trusted_root.json which is not the same as the TUF root.
TUF root -> https://github.com/sigstore/sigstore-go/blob/main/pkg/tuf/repository/root.json
trusted_root.json -> https://tuf-repo-cdn.sigstore.dev/targets/f44a1b88128e55ebfb62189becbc0fa48d4ec9915c65ac54ba0e46a008b12d5b.trusted_root.json on the public good instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you load the TUF root from the env var if it's set. Then override the tuf client's options to set the bytes you loaded instead of the default, embedded tuf root file.
0c2177d to
5cd2a39
Compare
Signed-off-by: Horiodino <[email protected]> use default client opts Signed-off-by: Horiodino <[email protected]> remove unused var Signed-off-by: Horiodino <[email protected]> updated go.mod Signed-off-by: Horiodino <[email protected]> fetch trustedroot.json from env Signed-off-by: Horiodino <[email protected]> use public good instance if SIGSTORE_TRUSTED_ROOT is nil Signed-off-by: Horiodino <[email protected]> updated test case Signed-off-by: Horiodino <[email protected]> updated test case Signed-off-by: Horiodino <[email protected]>
5cd2a39 to
2775574
Compare
| opts := &sigstoretuf.Options{ | ||
| Root: tufRootBytes, | ||
| CacheValidity: sigstoretuf.DefaultOptions().CacheValidity, | ||
| RepositoryBaseURL: sigstoretuf.DefaultOptions().RepositoryBaseURL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬 we need to establish this too, let me see if sigstore-go / initialization puts it someplace we can use in ~/.sigstore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RepositoryBaseURL ? Yes cant be used try running without that cause errs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in a private instance, the repository URL will differ. Let me see if the sigstore-go folks have an idea.
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
1 similar comment
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
7 similar comments
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
|
Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore. |
fixes: #792 (comment)