Skip to content
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

Disallow v0 entity/node/runtime descriptors #2992

Merged
merged 1 commit into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/2992.breaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disallow v0 entity/node/runtime descriptors
6 changes: 3 additions & 3 deletions go/common/entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
LatestEntityDescriptorVersion = 1

// Minimum and maximum descriptor versions that are allowed.
minEntityDescriptorVersion = 0
minEntityDescriptorVersion = 1
maxEntityDescriptorVersion = LatestEntityDescriptorVersion
)

Expand All @@ -52,11 +52,11 @@ type Entity struct { // nolint: maligned
// Nodes is the vector of node identity keys owned by this entity, that
// will sign the descriptor with the node signing key rather than the
// entity signing key.
Nodes []signature.PublicKey `json:"nodes"`
Nodes []signature.PublicKey `json:"nodes,omitempty"`

// AllowEntitySignedNodes is true iff nodes belonging to this entity
// may be signed with the entity signing key.
AllowEntitySignedNodes bool `json:"allow_entity_signed_nodes"`
AllowEntitySignedNodes bool `json:"allow_entity_signed_nodes,omitempty"`
}

// ValidateBasic performs basic descriptor validity checks.
Expand Down
2 changes: 1 addition & 1 deletion go/common/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
LatestNodeDescriptorVersion = 1

// Minimum and maximum descriptor versions that are allowed.
minNodeDescriptorVersion = 0
minNodeDescriptorVersion = 1
maxNodeDescriptorVersion = LatestNodeDescriptorVersion
)

Expand Down
2 changes: 1 addition & 1 deletion go/registry/api/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const (
LatestRuntimeDescriptorVersion = 1

// Minimum and maximum descriptor versions that are allowed.
minRuntimeDescriptorVersion = 0
minRuntimeDescriptorVersion = 1
maxRuntimeDescriptorVersion = LatestRuntimeDescriptorVersion
)

Expand Down
1 change: 1 addition & 0 deletions go/upgrade/migrations/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (

func init() {
entitySigner = memory.NewTestSigner(testSigningSeed)
TestEntity.DescriptorVersion = entity.LatestEntityDescriptorVersion
TestEntity.ID = entitySigner.Public()
}

Expand Down
4 changes: 2 additions & 2 deletions tests/fixture-data/consim/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
},
"entities": [
{
"untrusted_raw_value": "o2JpZFggTqUyj5Q+9vZtqu10yw6Zw7HEX3Ywe0JQA9vHyzY47TVlbm9kZXP2eBlhbGxvd19lbnRpdHlfc2lnbmVkX25vZGVz9Q==",
"untrusted_raw_value": "o2F2AWJpZFggTqUyj5Q+9vZtqu10yw6Zw7HEX3Ywe0JQA9vHyzY47TV4GWFsbG93X2VudGl0eV9zaWduZWRfbm9kZXP1",
"signature": {
"public_key": "TqUyj5Q+9vZtqu10yw6Zw7HEX3Ywe0JQA9vHyzY47TU=",
"signature": "5CnlsannKM749UmwEadxMJ6WTAQA4tffytgwUm8WLYdpcMEBXv9aK4qwATUrO5O3hJyob0uCRRX3MHk8o/qWDw=="
"signature": "CHTyRfJoYWxIbX6gmXvCrHg10tZHS6pwKuPdyhrw/5zrA5cnlYAzZwuhtL0j9a9le1mA23v9hRbKSai8XjqAAA=="
}
}
]
Expand Down