From a6175e25a6849b049c416d930985055d53f3c6c6 Mon Sep 17 00:00:00 2001 From: Nico Weisenauer <137267159+nweisenauer-sap@users.noreply.github.com> Date: Thu, 8 Jan 2026 15:13:15 +0100 Subject: [PATCH 1/2] PostStatus posts agent status including the agent version Signed-off-by: Nico Weisenauer <137267159+nweisenauer-sap@users.noreply.github.com> --- .gitignore | 1 + proto/spire/api/server/agent/v1/agent.pb.go | 20 ++++++++++--- proto/spire/api/server/agent/v1/agent.proto | 3 ++ proto/spire/api/types/agent.pb.go | 32 +++++++++++++++++---- proto/spire/api/types/agent.proto | 6 ++++ 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 86b3eeb..e6d3b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .build *.swp +.vscode diff --git a/proto/spire/api/server/agent/v1/agent.pb.go b/proto/spire/api/server/agent/v1/agent.pb.go index 3c2b5a8..f96bfcd 100644 --- a/proto/spire/api/server/agent/v1/agent.pb.go +++ b/proto/spire/api/server/agent/v1/agent.pb.go @@ -765,8 +765,10 @@ type PostStatusRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. Serial number of the bundle currently being served by the agent CurrentBundleSerial uint64 `protobuf:"varint,1,opt,name=current_bundle_serial,json=currentBundleSerial,proto3" json:"current_bundle_serial,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // The version of the agent. + AgentVersion *string `protobuf:"bytes,2,opt,name=agent_version,json=agentVersion,proto3,oneof" json:"agent_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PostStatusRequest) Reset() { @@ -806,6 +808,13 @@ func (x *PostStatusRequest) GetCurrentBundleSerial() uint64 { return 0 } +func (x *PostStatusRequest) GetAgentVersion() string { + if x != nil && x.AgentVersion != nil { + return *x.AgentVersion + } + return "" +} + type PostStatusResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -1174,9 +1183,11 @@ const file_spire_api_server_agent_v1_agent_proto_rawDesc = "" + "\x05token\x18\x02 \x01(\tR\x05token\x124\n" + "\bagent_id\x18\x03 \x01(\v2\x19.spire.api.types.SPIFFEIDR\aagentId\"'\n" + "\x13AgentX509SVIDParams\x12\x10\n" + - "\x03csr\x18\x01 \x01(\fR\x03csr\"G\n" + + "\x03csr\x18\x01 \x01(\fR\x03csr\"\x83\x01\n" + "\x11PostStatusRequest\x122\n" + - "\x15current_bundle_serial\x18\x01 \x01(\x04R\x13currentBundleSerial\"\x14\n" + + "\x15current_bundle_serial\x18\x01 \x01(\x04R\x13currentBundleSerial\x12(\n" + + "\ragent_version\x18\x02 \x01(\tH\x00R\fagentVersion\x88\x01\x01B\x10\n" + + "\x0e_agent_version\"\x14\n" + "\x12PostStatusResponse2\x80\a\n" + "\x05Agent\x12l\n" + "\vCountAgents\x12-.spire.api.server.agent.v1.CountAgentsRequest\x1a..spire.api.server.agent.v1.CountAgentsResponse\x12i\n" + @@ -1296,6 +1307,7 @@ func file_spire_api_server_agent_v1_agent_proto_init() { (*AttestAgentResponse_Result_)(nil), (*AttestAgentResponse_Challenge)(nil), } + file_spire_api_server_agent_v1_agent_proto_msgTypes[13].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/spire/api/server/agent/v1/agent.proto b/proto/spire/api/server/agent/v1/agent.proto index 1679819..a527342 100644 --- a/proto/spire/api/server/agent/v1/agent.proto +++ b/proto/spire/api/server/agent/v1/agent.proto @@ -226,6 +226,9 @@ message AgentX509SVIDParams { message PostStatusRequest { // Required. Serial number of the bundle currently being served by the agent uint64 current_bundle_serial = 1; + + // The version of the agent. + optional string agent_version = 2; } message PostStatusResponse { diff --git a/proto/spire/api/types/agent.pb.go b/proto/spire/api/types/agent.pb.go index 3c90915..29fedf6 100644 --- a/proto/spire/api/types/agent.pb.go +++ b/proto/spire/api/types/agent.pb.go @@ -37,7 +37,9 @@ type Agent struct { // Output only. Whether or not the agent is banned. Banned bool `protobuf:"varint,6,opt,name=banned,proto3" json:"banned,omitempty"` // Output only. Whether or not the agent can re-attest. - CanReattest bool `protobuf:"varint,7,opt,name=can_reattest,json=canReattest,proto3" json:"can_reattest,omitempty"` + CanReattest bool `protobuf:"varint,7,opt,name=can_reattest,json=canReattest,proto3" json:"can_reattest,omitempty"` + // Output only. The version of the agent. + AgentVersion *string `protobuf:"bytes,8,opt,name=agent_version,json=agentVersion,proto3,oneof" json:"agent_version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -121,6 +123,13 @@ func (x *Agent) GetCanReattest() bool { return false } +func (x *Agent) GetAgentVersion() string { + if x != nil && x.AgentVersion != nil { + return *x.AgentVersion + } + return "" +} + type AgentMask struct { state protoimpl.MessageState `protogen:"open.v1"` // attestation_type field mask @@ -134,7 +143,9 @@ type AgentMask struct { // banned field mask Banned bool `protobuf:"varint,6,opt,name=banned,proto3" json:"banned,omitempty"` // can_reattest field mask - CanReattest bool `protobuf:"varint,7,opt,name=can_reattest,json=canReattest,proto3" json:"can_reattest,omitempty"` + CanReattest bool `protobuf:"varint,7,opt,name=can_reattest,json=canReattest,proto3" json:"can_reattest,omitempty"` + // agent_version field mask + AgentVersion bool `protobuf:"varint,8,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -211,11 +222,18 @@ func (x *AgentMask) GetCanReattest() bool { return false } +func (x *AgentMask) GetAgentVersion() bool { + if x != nil { + return x.AgentVersion + } + return false +} + var File_spire_api_types_agent_proto protoreflect.FileDescriptor const file_spire_api_types_agent_proto_rawDesc = "" + "\n" + - "\x1bspire/api/types/agent.proto\x12\x0fspire.api.types\x1a\x1espire/api/types/selector.proto\x1a\x1espire/api/types/spiffeid.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xb7\x02\n" + + "\x1bspire/api/types/agent.proto\x12\x0fspire.api.types\x1a\x1espire/api/types/selector.proto\x1a\x1espire/api/types/spiffeid.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xf3\x02\n" + "\x05Agent\x12)\n" + "\x02id\x18\x01 \x01(\v2\x19.spire.api.types.SPIFFEIDR\x02id\x12)\n" + "\x10attestation_type\x18\x02 \x01(\tR\x0fattestationType\x124\n" + @@ -223,14 +241,17 @@ const file_spire_api_types_agent_proto_rawDesc = "" + "\x13x509svid_expires_at\x18\x04 \x01(\x03R\x11x509svidExpiresAt\x127\n" + "\tselectors\x18\x05 \x03(\v2\x19.spire.api.types.SelectorR\tselectors\x12\x16\n" + "\x06banned\x18\x06 \x01(\bR\x06banned\x12!\n" + - "\fcan_reattest\x18\a \x01(\bR\vcanReattest\"\xf5\x01\n" + + "\fcan_reattest\x18\a \x01(\bR\vcanReattest\x12(\n" + + "\ragent_version\x18\b \x01(\tH\x00R\fagentVersion\x88\x01\x01B\x10\n" + + "\x0e_agent_version\"\x9a\x02\n" + "\tAgentMask\x12)\n" + "\x10attestation_type\x18\x02 \x01(\bR\x0fattestationType\x124\n" + "\x16x509svid_serial_number\x18\x03 \x01(\bR\x14x509svidSerialNumber\x12.\n" + "\x13x509svid_expires_at\x18\x04 \x01(\bR\x11x509svidExpiresAt\x12\x1c\n" + "\tselectors\x18\x05 \x01(\bR\tselectors\x12\x16\n" + "\x06banned\x18\x06 \x01(\bR\x06banned\x12!\n" + - "\fcan_reattest\x18\a \x01(\bR\vcanReattestB7Z5github.com/spiffe/spire-api-sdk/proto/spire/api/typesb\x06proto3" + "\fcan_reattest\x18\a \x01(\bR\vcanReattest\x12#\n" + + "\ragent_version\x18\b \x01(\bR\fagentVersionB7Z5github.com/spiffe/spire-api-sdk/proto/spire/api/typesb\x06proto3" var ( file_spire_api_types_agent_proto_rawDescOnce sync.Once @@ -268,6 +289,7 @@ func file_spire_api_types_agent_proto_init() { } file_spire_api_types_selector_proto_init() file_spire_api_types_spiffeid_proto_init() + file_spire_api_types_agent_proto_msgTypes[0].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/spire/api/types/agent.proto b/proto/spire/api/types/agent.proto index 5d96ef8..d02f3de 100644 --- a/proto/spire/api/types/agent.proto +++ b/proto/spire/api/types/agent.proto @@ -27,6 +27,9 @@ message Agent { // Output only. Whether or not the agent can re-attest. bool can_reattest = 7; + + // Output only. The version of the agent. + optional string agent_version = 8; } message AgentMask { @@ -47,4 +50,7 @@ message AgentMask { // can_reattest field mask bool can_reattest = 7; + + // agent_version field mask + bool agent_version = 8; } From cfd5cac1d76ec9957a0c51712c4e549e294293f7 Mon Sep 17 00:00:00 2001 From: Nico Weisenauer <137267159+nweisenauer-sap@users.noreply.github.com> Date: Thu, 8 Jan 2026 15:56:59 +0100 Subject: [PATCH 2/2] makes agent_version a string (from *string) Signed-off-by: Nico Weisenauer <137267159+nweisenauer-sap@users.noreply.github.com> --- proto/spire/api/server/agent/v1/agent.pb.go | 16 +++++++--------- proto/spire/api/server/agent/v1/agent.proto | 4 ++-- proto/spire/api/types/agent.pb.go | 16 +++++++--------- proto/spire/api/types/agent.proto | 4 ++-- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/proto/spire/api/server/agent/v1/agent.pb.go b/proto/spire/api/server/agent/v1/agent.pb.go index f96bfcd..56a91fe 100644 --- a/proto/spire/api/server/agent/v1/agent.pb.go +++ b/proto/spire/api/server/agent/v1/agent.pb.go @@ -765,8 +765,8 @@ type PostStatusRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. Serial number of the bundle currently being served by the agent CurrentBundleSerial uint64 `protobuf:"varint,1,opt,name=current_bundle_serial,json=currentBundleSerial,proto3" json:"current_bundle_serial,omitempty"` - // The version of the agent. - AgentVersion *string `protobuf:"bytes,2,opt,name=agent_version,json=agentVersion,proto3,oneof" json:"agent_version,omitempty"` + // Optional. The version of the agent. + AgentVersion string `protobuf:"bytes,2,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -809,8 +809,8 @@ func (x *PostStatusRequest) GetCurrentBundleSerial() uint64 { } func (x *PostStatusRequest) GetAgentVersion() string { - if x != nil && x.AgentVersion != nil { - return *x.AgentVersion + if x != nil { + return x.AgentVersion } return "" } @@ -1183,11 +1183,10 @@ const file_spire_api_server_agent_v1_agent_proto_rawDesc = "" + "\x05token\x18\x02 \x01(\tR\x05token\x124\n" + "\bagent_id\x18\x03 \x01(\v2\x19.spire.api.types.SPIFFEIDR\aagentId\"'\n" + "\x13AgentX509SVIDParams\x12\x10\n" + - "\x03csr\x18\x01 \x01(\fR\x03csr\"\x83\x01\n" + + "\x03csr\x18\x01 \x01(\fR\x03csr\"l\n" + "\x11PostStatusRequest\x122\n" + - "\x15current_bundle_serial\x18\x01 \x01(\x04R\x13currentBundleSerial\x12(\n" + - "\ragent_version\x18\x02 \x01(\tH\x00R\fagentVersion\x88\x01\x01B\x10\n" + - "\x0e_agent_version\"\x14\n" + + "\x15current_bundle_serial\x18\x01 \x01(\x04R\x13currentBundleSerial\x12#\n" + + "\ragent_version\x18\x02 \x01(\tR\fagentVersion\"\x14\n" + "\x12PostStatusResponse2\x80\a\n" + "\x05Agent\x12l\n" + "\vCountAgents\x12-.spire.api.server.agent.v1.CountAgentsRequest\x1a..spire.api.server.agent.v1.CountAgentsResponse\x12i\n" + @@ -1307,7 +1306,6 @@ func file_spire_api_server_agent_v1_agent_proto_init() { (*AttestAgentResponse_Result_)(nil), (*AttestAgentResponse_Challenge)(nil), } - file_spire_api_server_agent_v1_agent_proto_msgTypes[13].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/spire/api/server/agent/v1/agent.proto b/proto/spire/api/server/agent/v1/agent.proto index a527342..82a20ad 100644 --- a/proto/spire/api/server/agent/v1/agent.proto +++ b/proto/spire/api/server/agent/v1/agent.proto @@ -227,8 +227,8 @@ message PostStatusRequest { // Required. Serial number of the bundle currently being served by the agent uint64 current_bundle_serial = 1; - // The version of the agent. - optional string agent_version = 2; + // Optional. The version of the agent. + string agent_version = 2; } message PostStatusResponse { diff --git a/proto/spire/api/types/agent.pb.go b/proto/spire/api/types/agent.pb.go index 29fedf6..4e91360 100644 --- a/proto/spire/api/types/agent.pb.go +++ b/proto/spire/api/types/agent.pb.go @@ -38,8 +38,8 @@ type Agent struct { Banned bool `protobuf:"varint,6,opt,name=banned,proto3" json:"banned,omitempty"` // Output only. Whether or not the agent can re-attest. CanReattest bool `protobuf:"varint,7,opt,name=can_reattest,json=canReattest,proto3" json:"can_reattest,omitempty"` - // Output only. The version of the agent. - AgentVersion *string `protobuf:"bytes,8,opt,name=agent_version,json=agentVersion,proto3,oneof" json:"agent_version,omitempty"` + // Output only. Optional. The version of the agent. + AgentVersion string `protobuf:"bytes,8,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -124,8 +124,8 @@ func (x *Agent) GetCanReattest() bool { } func (x *Agent) GetAgentVersion() string { - if x != nil && x.AgentVersion != nil { - return *x.AgentVersion + if x != nil { + return x.AgentVersion } return "" } @@ -233,7 +233,7 @@ var File_spire_api_types_agent_proto protoreflect.FileDescriptor const file_spire_api_types_agent_proto_rawDesc = "" + "\n" + - "\x1bspire/api/types/agent.proto\x12\x0fspire.api.types\x1a\x1espire/api/types/selector.proto\x1a\x1espire/api/types/spiffeid.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xf3\x02\n" + + "\x1bspire/api/types/agent.proto\x12\x0fspire.api.types\x1a\x1espire/api/types/selector.proto\x1a\x1espire/api/types/spiffeid.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xdc\x02\n" + "\x05Agent\x12)\n" + "\x02id\x18\x01 \x01(\v2\x19.spire.api.types.SPIFFEIDR\x02id\x12)\n" + "\x10attestation_type\x18\x02 \x01(\tR\x0fattestationType\x124\n" + @@ -241,9 +241,8 @@ const file_spire_api_types_agent_proto_rawDesc = "" + "\x13x509svid_expires_at\x18\x04 \x01(\x03R\x11x509svidExpiresAt\x127\n" + "\tselectors\x18\x05 \x03(\v2\x19.spire.api.types.SelectorR\tselectors\x12\x16\n" + "\x06banned\x18\x06 \x01(\bR\x06banned\x12!\n" + - "\fcan_reattest\x18\a \x01(\bR\vcanReattest\x12(\n" + - "\ragent_version\x18\b \x01(\tH\x00R\fagentVersion\x88\x01\x01B\x10\n" + - "\x0e_agent_version\"\x9a\x02\n" + + "\fcan_reattest\x18\a \x01(\bR\vcanReattest\x12#\n" + + "\ragent_version\x18\b \x01(\tR\fagentVersion\"\x9a\x02\n" + "\tAgentMask\x12)\n" + "\x10attestation_type\x18\x02 \x01(\bR\x0fattestationType\x124\n" + "\x16x509svid_serial_number\x18\x03 \x01(\bR\x14x509svidSerialNumber\x12.\n" + @@ -289,7 +288,6 @@ func file_spire_api_types_agent_proto_init() { } file_spire_api_types_selector_proto_init() file_spire_api_types_spiffeid_proto_init() - file_spire_api_types_agent_proto_msgTypes[0].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/spire/api/types/agent.proto b/proto/spire/api/types/agent.proto index d02f3de..f9e8628 100644 --- a/proto/spire/api/types/agent.proto +++ b/proto/spire/api/types/agent.proto @@ -28,8 +28,8 @@ message Agent { // Output only. Whether or not the agent can re-attest. bool can_reattest = 7; - // Output only. The version of the agent. - optional string agent_version = 8; + // Output only. Optional. The version of the agent. + string agent_version = 8; } message AgentMask {