Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Horiodino
Copy link
Contributor

@patzielinski patzielinski self-requested a review February 19, 2025 19:41
@Horiodino Horiodino marked this pull request as ready for review February 20, 2025 14:25
@Horiodino
Copy link
Contributor Author

I don't see much need for unit tests here, but I added them for code coverage.

Copy link
Collaborator

@patzielinski patzielinski left a 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?

@Horiodino Horiodino force-pushed the Drop_support_for_online_verification branch from aaa28f6 to beae4b1 Compare February 20, 2025 16:54
@Horiodino Horiodino force-pushed the Drop_support_for_online_verification branch from beae4b1 to c938a2e Compare February 20, 2025 18:25
@Horiodino Horiodino requested a review from adityasaky February 25, 2025 12:48
@adityasaky
Copy link
Member

fyi: I'm at a conference, so my review will be slightly delayed, apologies.

@Horiodino Horiodino changed the title fetch trustedRoots from json Drop support for online verification Mar 13, 2025
@Horiodino Horiodino force-pushed the Drop_support_for_online_verification branch 2 times, most recently from 27abe79 to 627e584 Compare March 13, 2025 14:17
@adityasaky
Copy link
Member

adityasaky commented Mar 14, 2025

I'll review this with a private sigstore instance, but eyeballing it, it looks good. :)

s/review/test

func (v *Verifier) getTUFRoot() (root.TrustedMaterial, error) {
rootFilePath := os.Getenv("SIGSTORE_TRUSTED_ROOT")
if rootFilePath == "" {
return nil, tuf.ErrNoTrustedRootFound
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct now ?

@Horiodino Horiodino force-pushed the Drop_support_for_online_verification branch from 23bc49f to 0c2177d Compare March 19, 2025 04:50
// TODO: support custom sigstore TUF root URL

tufClient, err := sigstoretuf.New(sigstoretuf.DefaultOptions())
trustedRootBytes, err := os.ReadFile(rootFilePath)
Copy link
Member

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

Copy link
Member

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.

@Horiodino Horiodino force-pushed the Drop_support_for_online_verification branch from 0c2177d to 5cd2a39 Compare March 22, 2025 06:01
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]>
@Horiodino Horiodino force-pushed the Drop_support_for_online_verification branch from 5cd2a39 to 2775574 Compare March 22, 2025 06:37
opts := &sigstoretuf.Options{
Root: tufRootBytes,
CacheValidity: sigstoretuf.DefaultOptions().CacheValidity,
RepositoryBaseURL: sigstoretuf.DefaultOptions().RepositoryBaseURL,
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

1 similar comment
@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@adityasaky adityasaky mentioned this pull request Apr 23, 2025
@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

7 similar comments
@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

@gittuf-app-beta
Copy link

Base branch main has been updated to fa70e9b, older reviews (if any) do not apply anymore.

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.

Drop support for online verification for sigstore signatures

3 participants