diff --git a/proto/spiffe/workload/workload.pb.go b/proto/spiffe/workload/workload.pb.go index e2f6f074..582658a1 100644 --- a/proto/spiffe/workload/workload.pb.go +++ b/proto/spiffe/workload/workload.pb.go @@ -9,6 +9,8 @@ import ( proto "github.com/golang/protobuf/proto" _struct "github.com/golang/protobuf/ptypes/struct" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" math "math" ) @@ -131,10 +133,7 @@ type X509SVID struct { X509SvidKey []byte `protobuf:"bytes,3,opt,name=x509_svid_key,json=x509SvidKey,proto3" json:"x509_svid_key,omitempty"` // CA certificates belonging to the Trust Domain // ASN.1 DER encoded - Bundle []byte `protobuf:"bytes,4,opt,name=bundle,proto3" json:"bundle,omitempty"` - // List of trust domains the SVID federates with, which corresponds to - // keys in the federated_bundles map in the X509SVIDResponse message. - FederatesWith []string `protobuf:"bytes,5,rep,name=federates_with,json=federatesWith,proto3" json:"federates_with,omitempty"` + Bundle []byte `protobuf:"bytes,4,opt,name=bundle,proto3" json:"bundle,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -193,13 +192,6 @@ func (m *X509SVID) GetBundle() []byte { return nil } -func (m *X509SVID) GetFederatesWith() []string { - if m != nil { - return m.FederatesWith - } - return nil -} - type JWTSVID struct { SpiffeId string `protobuf:"bytes,1,opt,name=spiffe_id,json=spiffeId,proto3" json:"spiffe_id,omitempty"` // Encoded using JWS Compact Serialization @@ -520,42 +512,41 @@ func init() { func init() { proto.RegisterFile("workload.proto", fileDescriptor_611edb31abe0f206) } var fileDescriptor_611edb31abe0f206 = []byte{ - // 556 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x5d, 0x8f, 0xd2, 0x4c, - 0x14, 0xce, 0xd0, 0x85, 0xa5, 0x87, 0xef, 0xd9, 0xf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fe, 0x1d, 0x15, 0x5a, 0x03, 0x38, 0x96, 0x0b, 0x92, 0xa8, 0x19, 0x64, 0x9f, - 0x45, 0x32, 0x9b, 0x21, 0x03, 0xf4, 0x01, 0x54, 0xff, 0x79, 0x0f, 0xde, 0xc1, 0xe9, 0x8d, 0xed, - 0xb9, 0x8e, 0xcd, 0xe8, 0xbd, 0x9d, 0x42, 0x99, 0x4e, 0x1d, 0xea, 0xf5, 0x12, 0xda, 0x7b, 0x4a, - 0xa2, 0xb8, 0x7b, 0xe7, 0xd6, 0x85, 0xd2, 0xdc, 0xb3, 0xdd, 0x4f, 0x21, 0x57, 0xab, 0xf4, 0xdb, - 0x24, 0x39, 0x57, 0x22, 0xcf, 0x95, 0x8c, 0xf8, 0xb9, 0x5a, 0x82, 0xd6, 0xff, 0x5a, 0x80, 0xd6, - 0x88, 0x47, 0x4f, 0xc4, 0x9d, 0xbf, 0xfa, 0x30, 0xc4, 0x67, 0x50, 0xbd, 0xa2, 0x6c, 0xbe, 0x92, - 0xbb, 0xd2, 0x20, 0xd9, 0x7a, 0xf4, 0x26, 0xc9, 0xa7, 0xf5, 0x12, 0x1a, 0x32, 0x44, 0xf4, 0x0f, - 0x63, 0xb2, 0x37, 0x31, 0xfd, 0xe4, 0xc0, 0x24, 0x7a, 0x08, 0x5f, 0x42, 0x23, 0x57, 0x2f, 0x6e, - 0x93, 0xc3, 0xbd, 0xd4, 0x35, 0xf2, 0xa7, 0xd6, 0x3c, 0x87, 0x1a, 0xcf, 0x21, 0xbd, 0xc5, 0x26, - 0xc9, 0xfd, 0x8d, 0xf4, 0xd6, 0xde, 0xaf, 0xa2, 0x87, 0x66, 0x25, 0xde, 0x9d, 0x67, 0x3f, 0x03, - 0x00, 0x00, 0xff, 0xff, 0xb6, 0x6b, 0xd6, 0x93, 0xec, 0x04, 0x00, 0x00, + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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, 0xce, 0x66, 0x92, 0x6d, 0x14, 0x29, 0x59, 0x2e, 0x0b, 0x8c, + 0x21, 0xb4, 0xff, 0xdb, 0xe0, 0xb7, 0x70, 0x7a, 0xe3, 0x04, 0x3e, 0x75, 0x12, 0x76, 0xa7, 0x52, + 0xa8, 0xa4, 0xd4, 0x2e, 0xad, 0x17, 0xd0, 0xd9, 0x62, 0x12, 0xc3, 0xdd, 0xe9, 0x5b, 0x0f, 0x0e, + 0xdc, 0xc0, 0xf1, 0x3f, 0xc5, 0x9c, 0xad, 0x35, 0xe8, 0x90, 0x7c, 0x0f, 0x89, 0xdc, 0x43, 0x32, + 0xe6, 0x7b, 0x68, 0x0b, 0xd8, 0xe0, 0x7b, 0x0d, 0xb4, 0x31, 0xaf, 0x9e, 0x8a, 0x05, 0x7e, 0xf9, + 0x7e, 0x84, 0xcf, 0xa0, 0x7d, 0xc5, 0x12, 0xf7, 0xa3, 0xfc, 0x56, 0x14, 0x52, 0x9e, 0xc7, 0x50, + 0x49, 0xb5, 0xad, 0x17, 0xa0, 0xc8, 0x12, 0xa1, 0x1f, 0xc6, 0x64, 0xcb, 0x31, 0xe3, 0x64, 0x87, + 0x13, 0x7d, 0x84, 0x2f, 0x41, 0xa9, 0xcc, 0x8b, 0x3b, 0x64, 0xb7, 0x96, 0x86, 0x4e, 0xfe, 0x26, + 0xcd, 0x33, 0x38, 0xe2, 0x3d, 0x14, 0x4b, 0xa6, 0x92, 0xca, 0x6f, 0xc6, 0xd0, 0xb6, 0xfe, 0x01, + 0x7d, 0x34, 0x3f, 0xe0, 0xea, 0x3c, 0xfd, 0x15, 0x00, 0x00, 0xff, 0xff, 0x56, 0xf7, 0xe6, 0x8f, + 0xc5, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -684,6 +675,23 @@ type SpiffeWorkloadAPIServer interface { FetchX509SVID(*X509SVIDRequest, SpiffeWorkloadAPI_FetchX509SVIDServer) error } +// UnimplementedSpiffeWorkloadAPIServer can be embedded to have forward compatible implementations. +type UnimplementedSpiffeWorkloadAPIServer struct { +} + +func (*UnimplementedSpiffeWorkloadAPIServer) FetchJWTSVID(ctx context.Context, req *JWTSVIDRequest) (*JWTSVIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchJWTSVID not implemented") +} +func (*UnimplementedSpiffeWorkloadAPIServer) FetchJWTBundles(req *JWTBundlesRequest, srv SpiffeWorkloadAPI_FetchJWTBundlesServer) error { + return status.Errorf(codes.Unimplemented, "method FetchJWTBundles not implemented") +} +func (*UnimplementedSpiffeWorkloadAPIServer) ValidateJWTSVID(ctx context.Context, req *ValidateJWTSVIDRequest) (*ValidateJWTSVIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateJWTSVID not implemented") +} +func (*UnimplementedSpiffeWorkloadAPIServer) FetchX509SVID(req *X509SVIDRequest, srv SpiffeWorkloadAPI_FetchX509SVIDServer) error { + return status.Errorf(codes.Unimplemented, "method FetchX509SVID not implemented") +} + func RegisterSpiffeWorkloadAPIServer(s *grpc.Server, srv SpiffeWorkloadAPIServer) { s.RegisterService(&_SpiffeWorkloadAPI_serviceDesc, srv) } diff --git a/proto/spiffe/workload/workload.proto b/proto/spiffe/workload/workload.proto index ca4d3f08..44beefee 100644 --- a/proto/spiffe/workload/workload.proto +++ b/proto/spiffe/workload/workload.proto @@ -38,13 +38,8 @@ message X509SVID { // CA certificates belonging to the Trust Domain // ASN.1 DER encoded bytes bundle = 4; - - // List of trust domains the SVID federates with, which corresponds to - // keys in the federated_bundles map in the X509SVIDResponse message. - repeated string federates_with = 5; } - message JWTSVID { string spiffe_id = 1; diff --git a/spiffe/tls_peer_test.go b/spiffe/tls_peer_test.go index bb567794..fdf3187b 100644 --- a/spiffe/tls_peer_test.go +++ b/spiffe/tls_peer_test.go @@ -29,9 +29,8 @@ func TestTLSPeer(t *testing.T) { Bundle: domain1CA.Roots(), SVIDs: []spiffetest.X509SVID{ { - CertChain: serverSVID, - Key: serverKey, - FederatesWith: []string{"spiffe://domain2.test"}, + CertChain: serverSVID, + Key: serverKey, }, }, FederatedBundles: map[string][]*x509.Certificate{ @@ -48,9 +47,8 @@ func TestTLSPeer(t *testing.T) { Bundle: domain2CA.Roots(), SVIDs: []spiffetest.X509SVID{ { - CertChain: clientSVID, - Key: clientKey, - FederatesWith: []string{"spiffe://domain1.test"}, + CertChain: clientSVID, + Key: clientKey, }, }, FederatedBundles: map[string][]*x509.Certificate{ @@ -103,9 +101,8 @@ func TestTLSPeerGRPC(t *testing.T) { Bundle: domain1CA.Roots(), SVIDs: []spiffetest.X509SVID{ { - CertChain: serverSVID, - Key: serverKey, - FederatesWith: []string{"spiffe://domain2.test"}, + CertChain: serverSVID, + Key: serverKey, }, }, FederatedBundles: map[string][]*x509.Certificate{ @@ -122,9 +119,8 @@ func TestTLSPeerGRPC(t *testing.T) { Bundle: domain2CA.Roots(), SVIDs: []spiffetest.X509SVID{ { - CertChain: clientSVID, - Key: clientKey, - FederatesWith: []string{"spiffe://domain1.test"}, + CertChain: clientSVID, + Key: clientKey, }, }, FederatedBundles: map[string][]*x509.Certificate{ diff --git a/spiffetest/workload_api.go b/spiffetest/workload_api.go index f03df4b7..67379cd1 100644 --- a/spiffetest/workload_api.go +++ b/spiffetest/workload_api.go @@ -142,9 +142,8 @@ func (w *workloadAPIWrapper) FetchX509SVID(req *workload.X509SVIDRequest, stream } type X509SVID struct { - CertChain []*x509.Certificate - Key crypto.Signer - FederatesWith []string + CertChain []*x509.Certificate + Key crypto.Signer } type X509SVIDResponse struct { @@ -174,11 +173,10 @@ func (r *X509SVIDResponse) ToProto(tb testing.TB) *workload.X509SVIDResponse { require.NoError(tb, err) } pb.Svids = append(pb.Svids, &workload.X509SVID{ - SpiffeId: spiffeID, - X509Svid: derBlobFromCerts(svid.CertChain), - X509SvidKey: keyDER, - Bundle: bundle, - FederatesWith: svid.FederatesWith, + SpiffeId: spiffeID, + X509Svid: derBlobFromCerts(svid.CertChain), + X509SvidKey: keyDER, + Bundle: bundle, }) } for k, v := range r.FederatedBundles { diff --git a/workload/proto.go b/workload/proto.go index 617aa21d..127d874f 100644 --- a/workload/proto.go +++ b/workload/proto.go @@ -40,7 +40,7 @@ func protoToX509SVIDs(protoSVIDs *workload.X509SVIDResponse) (*X509SVIDs, error) return svids, nil } -func protoToX509SVID(svid *workload.X509SVID, allFederatedBundles map[string][]*x509.Certificate) (*X509SVID, error) { +func protoToX509SVID(svid *workload.X509SVID, federatedTrustBundles map[string][]*x509.Certificate) (*X509SVID, error) { certificates, err := x509.ParseCertificates(svid.GetX509Svid()) if err != nil { return nil, err @@ -65,15 +65,9 @@ func protoToX509SVID(svid *workload.X509SVID, allFederatedBundles map[string][]* } trustBundlePool := internal.CertPoolFromCerts(trustBundle) - federatedTrustBundles := make(map[string][]*x509.Certificate) federatedTrustBundlePools := make(map[string]*x509.CertPool) - for _, federatesWith := range svid.GetFederatesWith() { - bundle, ok := allFederatedBundles[federatesWith] - if !ok { - return nil, fmt.Errorf("missing bundle for federated domain %q", federatesWith) - } - federatedTrustBundles[federatesWith] = bundle - federatedTrustBundlePools[federatesWith] = internal.CertPoolFromCerts(bundle) + for trustDomainID, federatedTrustBundle := range federatedTrustBundles { + federatedTrustBundlePools[trustDomainID] = internal.CertPoolFromCerts(federatedTrustBundle) } return &X509SVID{ diff --git a/workload/proto_test.go b/workload/proto_test.go index 0a2f3f7e..aafa61d7 100644 --- a/workload/proto_test.go +++ b/workload/proto_test.go @@ -19,9 +19,8 @@ func TestProtoToX509SVIDs(t *testing.T) { require.Len(t, svidChain, 2) svids := []spiffetest.X509SVID{ { - CertChain: svidChain, - Key: svidKey, - FederatesWith: []string{"spiffe://domain2.test"}, + CertChain: svidChain, + Key: svidKey, }, } @@ -114,14 +113,6 @@ func TestProtoToX509SVIDs(t *testing.T) { }, err: `failed to parse svid entry 0 for spiffe id "spiffe://domain1.test/workload": failed to parse trust bundle: asn1: syntax error: truncated tag or length`, }, - { - name: "missing federated trust bundle", - resp: &spiffetest.X509SVIDResponse{ - Bundle: domain1Bundle, - SVIDs: svids, - }, - err: `failed to parse svid entry 0 for spiffe id "spiffe://domain1.test/workload": missing bundle for federated domain "spiffe://domain2.test"`, - }, { name: "success", resp: &spiffetest.X509SVIDResponse{ @@ -154,11 +145,8 @@ func TestProtoToX509SVIDs(t *testing.T) { require.Equal(t, svidIn.CertChain, svidOut.Certificates) require.Equal(t, testCase.resp.Bundle, svidOut.TrustBundle) require.Equal(t, svidIn.CertChain[0].URIs[0].String(), svidOut.SPIFFEID) - - require.Len(t, svidOut.FederatedTrustBundles, len(svidIn.FederatesWith)) - for _, trustDomain := range svidIn.FederatesWith { - require.Equal(t, testCase.resp.FederatedBundles[trustDomain], svidOut.FederatedTrustBundles[trustDomain]) - } + require.Equal(t, testCase.resp.FederatedBundles, svidOut.FederatedTrustBundles) + require.Len(t, svidOut.FederatedTrustBundlePools, len(testCase.resp.FederatedBundles)) } }) }