Skip to content

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

Closed
wants to merge 14 commits into from
Closed

Conversation

hosseinsia
Copy link
Collaborator

@hosseinsia
Copy link
Collaborator Author

Fixtures are generated using this repo:
https://github.com/DataDog/tuf-fixtures

@hosseinsia hosseinsia changed the title Hosseinsia/updatetherootrole Support root rotation Jul 28, 2021
Copy link
Member

@trishankatdatadog trishankatdatadog left a 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,
Copy link
Member

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 {
Copy link
Member

@trishankatdatadog trishankatdatadog Jul 28, 2021

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))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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 {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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)
Copy link
Collaborator

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
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

return verifyErr

@hosseinsia
Copy link
Collaborator Author

This is an abandoned PR. We decided to update the go-tuf upstream now. Please review this instead:
theupdateframework#143

@hosseinsia hosseinsia closed this Aug 24, 2021
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.

4 participants