-
Notifications
You must be signed in to change notification settings - Fork 0
Support root rotation #8
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
Conversation
…o make it re-usable for others.
…o make it re-usable for others.
Fixtures are generated using this repo: |
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.
Will send more comments later, but this is really getting into shape, thanks!
local: local, | ||
remote: remote, | ||
MaxDelegations: defaultMaxDelegations, | ||
UpdaterMaxRoots: defaultMaxRoots, |
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.
How about a more descriptive name like MaxRootRotations
?
client/client.go
Outdated
// 5.3.4 Check for an arbitrary software attack. | ||
nPlusOnethRootMetadataSigned := &data.Root{} | ||
// 5.3.4.1 Check that N signed N+1 | ||
if err := c.db.Unmarshal(nPlusOneRootMetadata, nPlusOnethRootMetadataSigned, "root", c.rootVer); err != nil { |
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.
Not clear whether calling this function from c.db
has any side effects... just needs documentation
// Prepare for 5.3.11: If the timestamp and / or snapshot keys have been rotated, | ||
// then delete the trusted timestamp and snapshot metadata files. | ||
getKeyIDs := func(role string) []string { | ||
keyIDs := make([]string, 0, len(c.db.GetRole("timestamp").KeyIDs)) |
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.
keyIDs := make([]string, 0, len(c.db.GetRole("timestamp").KeyIDs)) | |
keyIDs := make([]string, 0, len(c.db.GetRole(role).KeyIDs)) |
|
||
// Prepare for 5.3.11: If the timestamp and / or snapshot keys have been rotated, | ||
// then delete the trusted timestamp and snapshot metadata files. | ||
getKeyIDs := func(role string) []string { |
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.
getKeyIDs := func(role string) []string { | |
getKeyIDs := func(rolename string) []string { |
} | ||
|
||
func (e ErrWrongVersion) Error() string { | ||
return fmt.Sprintf("version %d does not match the extepcted version %d", e.Given, e.Expected) |
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.
s/extepcted/expected/
if err := json.Unmarshal(b, s); err != nil { | ||
return err | ||
} | ||
// Note: If verification fails, then we wont attemp to unmarshal |
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.
s/attemp/attempt/
if err := json.Unmarshal(s.Signed, v); err != nil { | ||
return err | ||
} | ||
if verifyErr != nil { |
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.
return verifyErr
This is an abandoned PR. We decided to update the go-tuf upstream now. Please review this instead: |
Update the root according to
https://theupdateframework.github.io/specification/v1.0.19/index.html#load-trusted-root