Skip to content

Support root rotation#8

Closed
hosseinsia wants to merge 14 commits intomasterfrom
hosseinsia/updatetherootrole
Closed

Support root rotation#8
hosseinsia wants to merge 14 commits intomasterfrom
hosseinsia/updatetherootrole

Conversation

@hosseinsia
Copy link
Copy Markdown
Collaborator

@hosseinsia
Copy link
Copy Markdown
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
Copy Markdown

@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!

Comment thread client/client.go
local: local,
remote: remote,
MaxDelegations: defaultMaxDelegations,
UpdaterMaxRoots: defaultMaxRoots,
Copy link
Copy Markdown

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?

Comment thread 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
Copy Markdown

@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

Comment thread client/client.go
// 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
Copy Markdown

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))

Comment thread client/client.go

// 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
Copy Markdown

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 {

Comment thread verify/errors.go
}

func (e ErrWrongVersion) Error() string {
return fmt.Sprintf("version %d does not match the extepcted version %d", e.Given, e.Expected)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/extepcted/expected/

Comment thread verify/verify.go
if err := json.Unmarshal(b, s); err != nil {
return err
}
// Note: If verification fails, then we wont attemp to unmarshal
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/attemp/attempt/

Comment thread verify/verify.go
if err := json.Unmarshal(s.Signed, v); err != nil {
return err
}
if verifyErr != nil {
Copy link
Copy Markdown
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
Copy Markdown
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