Skip to content

Commit

Permalink
Disallow v0 entity/node/runtime descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Jun 10, 2020
1 parent 15ae821 commit 1464fc2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
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

0 comments on commit 1464fc2

Please sign in to comment.