-
Notifications
You must be signed in to change notification settings - Fork 33
Add support for operator in SigningConfig #494
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
Add support for operator in SigningConfig #494
Conversation
sortedVersions := make([]uint32, len(supportedAPIVersions)) | ||
copy(sortedVersions, supportedAPIVersions) | ||
slices.Sort(sortedVersions) | ||
slices.Reverse(sortedVersions) | ||
|
||
// Order services from newest to oldest |
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.
Previously, this would select the first service in the list, rather than the newest. This assumed that signing configs were pre-sorted. In practice (or at least for PGI), they should be, but I've added this explicitly to prevent unexpected selections. These sorts shouldn't be inefficient since the number of services should be limited.
pkg/root/signing_config.go
Outdated
func GetSigningConfig(c *tuf.Client) (*SigningConfig, error) { | ||
jsonBytes, err := c.GetTarget("signing_config.json") | ||
jsonBytes, err := c.GetTarget("signing_config.v0.2.json") |
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.
Could this be a breaking change? The comment says it's for PGI but it looks like this could be used with any TUF mirror?
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.
While it could be used for any TUF mirror, this shouldn't be a breaking change because we intend for this function to only be used with PGI. It should be invisible to users whether the signing config (or trusted root) is coming from a later revision, which is what this function is designed for.
I reverted this change though because it will break if GetSigningConfig
is used against the production TUF repo. Tracking updating this in #495.
cb53720
to
6d1bd46
Compare
The v0.2 signing config includes an Operator field so that clients will select Services from distinct operators. This PR adds support for the Operator field, where multi-service selection will select distinct instances. Later, we'll add support for the Operator field for instances declared in the trusted root, to verify that instances from the same operator do not all count towards meeting a threshold. Since the v0.2 signing config is only distributed via the staging TUF repo, I've left the example as-is for now, since any integrators will need to declare their signing config manually for production. Signed-off-by: Hayden B <[email protected]>
6d1bd46
to
e15139c
Compare
The v0.2 signing config includes an Operator field so that clients will select Services from distinct operators. This PR adds support for the Operator field, where multi-service selection will select distinct instances. Later, we'll add support for the Operator field for instances declared in the trusted root, to verify that instances from the same operator do not all count towards meeting a threshold.
Since the v0.2 signing config is only distributed via the staging TUF repo, I've left the example as-is for now, since any integrators will need to declare their signing config manually for production.