From cab068e35cefa9286e00923c9148f11f0ed7872e Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 5 Oct 2026 20:18:37 +0200 Subject: [PATCH 01/14] Test service account certificate identity wire round trip (red) --- models/certificate_properties_test.go | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 models/certificate_properties_test.go diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go new file mode 100644 index 00000000..50e086f8 --- /dev/null +++ b/models/certificate_properties_test.go @@ -0,0 +1,36 @@ +package models_test + +import ( + "encoding/json" + "testing" + + "code.cloudfoundry.org/bbs/models" + "github.com/gogo/protobuf/proto" +) + +func TestServiceAccountCertificatePropertiesRoundTrip(t *testing.T) { + var properties models.CertificateProperties + if err := json.Unmarshal([]byte(`{"organizational_unit":["app:app-guid"],"service_account":{"name":"payments-worker"}}`), &properties); err != nil { + t.Fatal(err) + } + wire, err := proto.Marshal(&properties) + if err != nil { + t.Fatal(err) + } + var decoded models.CertificateProperties + if err := proto.Unmarshal(wire, &decoded); err != nil { + t.Fatal(err) + } + payload, err := json.Marshal(&decoded) + if err != nil { + t.Fatal(err) + } + var result map[string]interface{} + if err := json.Unmarshal(payload, &result); err != nil { + t.Fatal(err) + } + identity, ok := result["service_account"].(map[string]interface{}) + if !ok || identity["name"] != "payments-worker" { + t.Fatalf("service account lost in protobuf round trip: %s", payload) + } +} From 1b8b954c5d96c29ae699b111de2e5c3d4f4c7bc3 Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 5 Oct 2026 20:19:25 +0200 Subject: [PATCH 02/14] Add typed service account certificate properties contract --- models/certificate_properties.pb.go | 308 ++++++++++++++++++++++++++-- models/certificate_properties.proto | 4 + 2 files changed, 300 insertions(+), 12 deletions(-) diff --git a/models/certificate_properties.pb.go b/models/certificate_properties.pb.go index 7815f28f..71de91b8 100644 --- a/models/certificate_properties.pb.go +++ b/models/certificate_properties.pb.go @@ -25,7 +25,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type CertificateProperties struct { - OrganizationalUnit []string `protobuf:"bytes,1,rep,name=organizational_unit,json=organizationalUnit,proto3" json:"organizational_unit,omitempty"` + OrganizationalUnit []string `protobuf:"bytes,1,rep,name=organizational_unit,json=organizationalUnit,proto3" json:"organizational_unit,omitempty"` + ServiceAccount *ServiceAccount `protobuf:"bytes,2,opt,name=service_account,json=serviceAccount,proto3" json:"service_account,omitempty"` } func (m *CertificateProperties) Reset() { *m = CertificateProperties{} } @@ -67,25 +68,80 @@ func (m *CertificateProperties) GetOrganizationalUnit() []string { return nil } +func (m *CertificateProperties) GetServiceAccount() *ServiceAccount { + if m != nil { + return m.ServiceAccount + } + return nil +} + +type ServiceAccount struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *ServiceAccount) Reset() { *m = ServiceAccount{} } +func (*ServiceAccount) ProtoMessage() {} +func (*ServiceAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_9291b57c1fe01997, []int{1} +} +func (m *ServiceAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ServiceAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ServiceAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ServiceAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceAccount.Merge(m, src) +} +func (m *ServiceAccount) XXX_Size() int { + return m.Size() +} +func (m *ServiceAccount) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceAccount proto.InternalMessageInfo + +func (m *ServiceAccount) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func init() { proto.RegisterType((*CertificateProperties)(nil), "models.CertificateProperties") + proto.RegisterType((*ServiceAccount)(nil), "models.ServiceAccount") } func init() { proto.RegisterFile("certificate_properties.proto", fileDescriptor_9291b57c1fe01997) } var fileDescriptor_9291b57c1fe01997 = []byte{ - // 169 bytes of a gzipped FileDescriptorProto + // 232 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x4e, 0x2d, 0x2a, 0xc9, 0x4c, 0xcb, 0x4c, 0x4e, 0x2c, 0x49, 0x8d, 0x2f, 0x28, 0xca, 0x2f, 0x00, 0x71, 0x53, 0x8b, - 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xd8, 0x72, 0xf3, 0x53, 0x52, 0x73, 0x8a, 0x95, 0x3c, - 0xb8, 0x44, 0x9d, 0x11, 0xea, 0x02, 0xe0, 0xca, 0x84, 0xf4, 0xb9, 0x84, 0xf3, 0x8b, 0xd2, 0x13, - 0xf3, 0x32, 0xab, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x12, 0x73, 0xe2, 0x4b, 0xf3, 0x32, 0x4b, 0x24, - 0x18, 0x15, 0x98, 0x35, 0x38, 0x83, 0x84, 0x50, 0xa5, 0x42, 0xf3, 0x32, 0x4b, 0x9c, 0x4c, 0x2e, - 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xe1, 0xc3, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, - 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, - 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, - 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x9d, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, - 0xff, 0x07, 0xe2, 0x02, 0xdf, 0xae, 0x00, 0x00, 0x00, + 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xd8, 0x72, 0xf3, 0x53, 0x52, 0x73, 0x8a, 0x95, 0x3a, + 0x19, 0xb9, 0x44, 0x9d, 0x11, 0x0a, 0x03, 0xe0, 0xea, 0x84, 0xf4, 0xb9, 0x84, 0xf3, 0x8b, 0xd2, + 0x13, 0xf3, 0x32, 0xab, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x12, 0x73, 0xe2, 0x4b, 0xf3, 0x32, 0x4b, + 0x24, 0x18, 0x15, 0x98, 0x35, 0x38, 0x83, 0x84, 0x50, 0xa5, 0x42, 0xf3, 0x32, 0x4b, 0x84, 0xec, + 0xb9, 0xf8, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xe3, 0x13, 0x93, 0x93, 0xf3, 0x4b, 0xf3, + 0x4a, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf4, 0x20, 0x96, 0xe9, 0x05, 0x43, 0xa4, + 0x1d, 0x21, 0xb2, 0x41, 0x7c, 0xc5, 0x28, 0x7c, 0x25, 0x15, 0x2e, 0x3e, 0x54, 0x15, 0x42, 0x42, + 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x93, + 0xc9, 0x85, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xd8, 0xf0, 0x48, + 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, + 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0xb7, 0x8d, 0x01, 0x03, 0x00, + 0xf5, 0xbb, 0xa9, 0xe9, 0x16, 0x01, 0x00, 0x00, } func (this *CertificateProperties) Equal(that interface{}) bool { @@ -115,15 +171,55 @@ func (this *CertificateProperties) Equal(that interface{}) bool { return false } } + if !this.ServiceAccount.Equal(that1.ServiceAccount) { + return false + } + return true +} +func (this *ServiceAccount) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ServiceAccount) + if !ok { + that2, ok := that.(ServiceAccount) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } return true } func (this *CertificateProperties) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 5) + s := make([]string, 0, 6) s = append(s, "&models.CertificateProperties{") s = append(s, "OrganizationalUnit: "+fmt.Sprintf("%#v", this.OrganizationalUnit)+",\n") + if this.ServiceAccount != nil { + s = append(s, "ServiceAccount: "+fmt.Sprintf("%#v", this.ServiceAccount)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ServiceAccount) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&models.ServiceAccount{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -155,6 +251,18 @@ func (m *CertificateProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ServiceAccount != nil { + { + size, err := m.ServiceAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCertificateProperties(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.OrganizationalUnit) > 0 { for iNdEx := len(m.OrganizationalUnit) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.OrganizationalUnit[iNdEx]) @@ -167,6 +275,36 @@ func (m *CertificateProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ServiceAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ServiceAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCertificateProperties(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintCertificateProperties(dAtA []byte, offset int, v uint64) int { offset -= sovCertificateProperties(v) base := offset @@ -190,6 +328,23 @@ func (m *CertificateProperties) Size() (n int) { n += 1 + l + sovCertificateProperties(uint64(l)) } } + if m.ServiceAccount != nil { + l = m.ServiceAccount.Size() + n += 1 + l + sovCertificateProperties(uint64(l)) + } + return n +} + +func (m *ServiceAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCertificateProperties(uint64(l)) + } return n } @@ -205,6 +360,17 @@ func (this *CertificateProperties) String() string { } s := strings.Join([]string{`&CertificateProperties{`, `OrganizationalUnit:` + fmt.Sprintf("%v", this.OrganizationalUnit) + `,`, + `ServiceAccount:` + strings.Replace(this.ServiceAccount.String(), "ServiceAccount", "ServiceAccount", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ServiceAccount) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ServiceAccount{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `}`, }, "") return s @@ -278,6 +444,124 @@ func (m *CertificateProperties) Unmarshal(dAtA []byte) error { } m.OrganizationalUnit = append(m.OrganizationalUnit, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCertificateProperties + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCertificateProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ServiceAccount == nil { + m.ServiceAccount = &ServiceAccount{} + } + if err := m.ServiceAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCertificateProperties(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCertificateProperties + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ServiceAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ServiceAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCertificateProperties + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCertificateProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCertificateProperties(dAtA[iNdEx:]) diff --git a/models/certificate_properties.proto b/models/certificate_properties.proto index 9eced102..3810da01 100644 --- a/models/certificate_properties.proto +++ b/models/certificate_properties.proto @@ -4,5 +4,9 @@ package models; message CertificateProperties { repeated string organizational_unit = 1; + ServiceAccount service_account = 2; } +message ServiceAccount { + string name = 1; +} From 680b730425794374cded6bedbe9942e322f8209c Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 5 Oct 2026 23:09:38 +0200 Subject: [PATCH 03/14] Test canonical account identity validation in LRP and task contracts (red) --- models/certificate_properties_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go index 50e086f8..3feac5c8 100644 --- a/models/certificate_properties_test.go +++ b/models/certificate_properties_test.go @@ -2,6 +2,7 @@ package models_test import ( "encoding/json" + "strings" "testing" "code.cloudfoundry.org/bbs/models" @@ -34,3 +35,27 @@ func TestServiceAccountCertificatePropertiesRoundTrip(t *testing.T) { t.Fatalf("service account lost in protobuf round trip: %s", payload) } } + +func TestServiceAccountCertificatePropertiesValidation(t *testing.T) { + for _, name := range []string{"", "ab", "Payments-worker", "-payments", "payments-", "payments.reader", "payments.svc.identity", "payments_worker", strings.Repeat("a", 64)} { + t.Run(name, func(t *testing.T) { + properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: name}} + if err := properties.Validate(); err == nil { + t.Fatal("noncanonical service account accepted") + } + runInfo := models.DesiredLRPRunInfo{DesiredLRPKey: models.DesiredLRPKey{ProcessGuid: "process"}, Action: models.WrapAction(&models.RunAction{Path: "/bin/true", User: "vcap"}), CertificateProperties: properties} + if err := runInfo.Validate(); err == nil || !strings.Contains(err.Error(), "service_account") { + t.Fatalf("LRP validation lost service account error: %v", err) + } + task := models.TaskDefinition{RootFs: "preloaded:stack", Action: runInfo.Action, CertificateProperties: properties} + if err := task.Validate(); err == nil || !strings.Contains(err.Error(), "service_account") { + t.Fatalf("task validation lost service account error: %v", err) + } + }) + } + for _, properties := range []*models.CertificateProperties{{}, {ServiceAccount: &models.ServiceAccount{Name: "payments-worker"}}, {ServiceAccount: &models.ServiceAccount{Name: strings.Repeat("a", 63)}}} { + if err := properties.Validate(); err != nil { + t.Fatalf("valid certificate properties rejected: %v", err) + } + } +} From bd154ac377fbe4d0fe7833d415887a699104f0ae Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 5 Oct 2026 23:10:02 +0200 Subject: [PATCH 04/14] Validate service account certificate identity in LRP and task definitions --- models/desired_lrp.go | 9 ++++++++- models/task.go | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/models/desired_lrp.go b/models/desired_lrp.go index 7783d362..38909bf5 100644 --- a/models/desired_lrp.go +++ b/models/desired_lrp.go @@ -18,6 +18,7 @@ const ExtraRootFSScheme = "extra" const volumeMountedFilesMaxAllowedSize = 1 * 1024 * 1024 // 1MB in bytes var processGuidPattern = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`) +var serviceAccountNamePattern = regexp.MustCompile(`\A[a-z0-9][a-z0-9-]{1,61}[a-z0-9]\z`) type DesiredLRPChange struct { Before *DesiredLRP @@ -786,6 +787,9 @@ func NewDesiredLRPRunInfo( func (runInfo DesiredLRPRunInfo) Validate() error { var validationError ValidationError + if runInfo.CertificateProperties != nil { + validationError = validationError.Check(runInfo.CertificateProperties) + } validationError = validationError.Check(runInfo.DesiredLRPKey) @@ -877,7 +881,10 @@ func (*CertificateProperties) Version() format.Version { return format.V0 } -func (CertificateProperties) Validate() error { +func (properties CertificateProperties) Validate() error { + if properties.ServiceAccount != nil && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Name) { + return ErrInvalidField{"certificate_properties.service_account.name"} + } return nil } diff --git a/models/task.go b/models/task.go index 2319fe99..d12b4546 100644 --- a/models/task.go +++ b/models/task.go @@ -93,6 +93,9 @@ func (t *TaskDefinition) Copy() *TaskDefinition { func (def *TaskDefinition) Validate() error { var validationError ValidationError + if def.CertificateProperties != nil { + validationError = validationError.Check(def.CertificateProperties) + } if def.RootFs == "" { validationError = validationError.Append(ErrInvalidField{"rootfs"}) From 1a660abdab50a5bf81075a68bc9a9073a2315ccd Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 5 Oct 2026 23:38:04 +0200 Subject: [PATCH 05/14] Test assembled stored LRP preserves certificate account identity (red) --- models/certificate_properties_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go index 3feac5c8..eb15c94f 100644 --- a/models/certificate_properties_test.go +++ b/models/certificate_properties_test.go @@ -59,3 +59,12 @@ func TestServiceAccountCertificatePropertiesValidation(t *testing.T) { } } } + +func TestAssembledDesiredLRPRetainsServiceAccountIdentity(t *testing.T) { + properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: "payments-worker"}} + desired := &models.DesiredLRP{} + desired.AddRunInfo(models.DesiredLRPRunInfo{CertificateProperties: properties}) + if desired.CertificateProperties == nil || desired.CertificateProperties.ServiceAccount.Name != "payments-worker" { + t.Fatal("assembling stored LRP run info dropped account identity") + } +} From 869b0650f4147bb24d790f52153ef571fc11bda0 Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 5 Oct 2026 23:38:24 +0200 Subject: [PATCH 06/14] Preserve certificate properties when assembling stored desired LRPs --- models/desired_lrp.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/desired_lrp.go b/models/desired_lrp.go index 38909bf5..d3beec24 100644 --- a/models/desired_lrp.go +++ b/models/desired_lrp.go @@ -124,6 +124,7 @@ func (desiredLRP *DesiredLRP) AddRunInfo(runInfo DesiredLRPRunInfo) { desiredLRP.TrustedSystemCertificatesPath = runInfo.TrustedSystemCertificatesPath desiredLRP.VolumeMounts = runInfo.VolumeMounts desiredLRP.Network = runInfo.Network + desiredLRP.CertificateProperties = runInfo.CertificateProperties desiredLRP.CheckDefinition = runInfo.CheckDefinition desiredLRP.VolumeMountedFiles = volumeMountedFiles } From 379748297f7d1d665656bae34d1561a3a0edab8f Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 9 Nov 2026 15:14:34 +0100 Subject: [PATCH 07/14] Test qualified account prefix survives the certificate contract (red) --- models/certificate_properties_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go index eb15c94f..6739a48b 100644 --- a/models/certificate_properties_test.go +++ b/models/certificate_properties_test.go @@ -36,6 +36,22 @@ func TestServiceAccountCertificatePropertiesRoundTrip(t *testing.T) { } } +func TestQualifiedServiceAccountPrefixRoundTrip(t *testing.T) { + var properties models.CertificateProperties + if err := json.Unmarshal([]byte(`{"service_account":{"name":"payments-worker","prefix":"payments-team"}}`), &properties); err != nil { + t.Fatal(err) + } + wire, err := proto.Marshal(&properties) + if err != nil { t.Fatal(err) } + var decoded models.CertificateProperties + if err := proto.Unmarshal(wire, &decoded); err != nil { t.Fatal(err) } + payload, err := json.Marshal(&decoded) + if err != nil { t.Fatal(err) } + if !strings.Contains(string(payload), `"prefix":"payments-team"`) { + t.Fatalf("qualified prefix lost: %s", payload) + } +} + func TestServiceAccountCertificatePropertiesValidation(t *testing.T) { for _, name := range []string{"", "ab", "Payments-worker", "-payments", "payments-", "payments.reader", "payments.svc.identity", "payments_worker", strings.Repeat("a", 64)} { t.Run(name, func(t *testing.T) { From e2b3a2c0aa90a076a57dedbd32211f1ae023c2ba Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 9 Nov 2026 15:15:18 +0100 Subject: [PATCH 08/14] Carry the organization prefix in service account certificate identities --- models/certificate_properties.pb.go | 93 +++++++++++++++++++++------ models/certificate_properties.proto | 1 + models/certificate_properties_test.go | 12 +++- 3 files changed, 85 insertions(+), 21 deletions(-) diff --git a/models/certificate_properties.pb.go b/models/certificate_properties.pb.go index 71de91b8..785f83a8 100644 --- a/models/certificate_properties.pb.go +++ b/models/certificate_properties.pb.go @@ -76,7 +76,8 @@ func (m *CertificateProperties) GetServiceAccount() *ServiceAccount { } type ServiceAccount struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` } func (m *ServiceAccount) Reset() { *m = ServiceAccount{} } @@ -118,6 +119,13 @@ func (m *ServiceAccount) GetName() string { return "" } +func (m *ServiceAccount) GetPrefix() string { + if m != nil { + return m.Prefix + } + return "" +} + func init() { proto.RegisterType((*CertificateProperties)(nil), "models.CertificateProperties") proto.RegisterType((*ServiceAccount)(nil), "models.ServiceAccount") @@ -126,22 +134,23 @@ func init() { func init() { proto.RegisterFile("certificate_properties.proto", fileDescriptor_9291b57c1fe01997) } var fileDescriptor_9291b57c1fe01997 = []byte{ - // 232 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x4e, 0x2d, 0x2a, - 0xc9, 0x4c, 0xcb, 0x4c, 0x4e, 0x2c, 0x49, 0x8d, 0x2f, 0x28, 0xca, 0x2f, 0x00, 0x71, 0x53, 0x8b, - 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xd8, 0x72, 0xf3, 0x53, 0x52, 0x73, 0x8a, 0x95, 0x3a, - 0x19, 0xb9, 0x44, 0x9d, 0x11, 0x0a, 0x03, 0xe0, 0xea, 0x84, 0xf4, 0xb9, 0x84, 0xf3, 0x8b, 0xd2, - 0x13, 0xf3, 0x32, 0xab, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x12, 0x73, 0xe2, 0x4b, 0xf3, 0x32, 0x4b, - 0x24, 0x18, 0x15, 0x98, 0x35, 0x38, 0x83, 0x84, 0x50, 0xa5, 0x42, 0xf3, 0x32, 0x4b, 0x84, 0xec, - 0xb9, 0xf8, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xe3, 0x13, 0x93, 0x93, 0xf3, 0x4b, 0xf3, - 0x4a, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf4, 0x20, 0x96, 0xe9, 0x05, 0x43, 0xa4, - 0x1d, 0x21, 0xb2, 0x41, 0x7c, 0xc5, 0x28, 0x7c, 0x25, 0x15, 0x2e, 0x3e, 0x54, 0x15, 0x42, 0x42, - 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x93, - 0xc9, 0x85, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xd8, 0xf0, 0x48, - 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, - 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, - 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0xb7, 0x8d, 0x01, 0x03, 0x00, - 0xf5, 0xbb, 0xa9, 0xe9, 0x16, 0x01, 0x00, 0x00, + // 247 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xb1, 0x4a, 0xc4, 0x40, + 0x10, 0x40, 0x77, 0x54, 0x02, 0x59, 0xe1, 0x84, 0x15, 0x8f, 0x14, 0x32, 0x84, 0xab, 0x52, 0x45, + 0x50, 0x4b, 0x41, 0xd4, 0x1f, 0x90, 0x88, 0x75, 0x58, 0xd7, 0x3d, 0x19, 0xb8, 0xdb, 0x0d, 0x9b, + 0x3d, 0x11, 0x2b, 0x5b, 0x3b, 0x3f, 0xc3, 0x4f, 0xb1, 0x4c, 0x79, 0xa5, 0xd9, 0x34, 0x96, 0xf7, + 0x09, 0x62, 0x22, 0x4a, 0xba, 0x79, 0xbc, 0xc7, 0x0c, 0x0c, 0x3f, 0x54, 0xda, 0x79, 0x9a, 0x93, + 0x92, 0x5e, 0x97, 0x95, 0xb3, 0xd5, 0x0f, 0xea, 0x3a, 0xaf, 0x9c, 0xf5, 0x56, 0x44, 0x4b, 0x7b, + 0xaf, 0x17, 0xf5, 0xec, 0x15, 0xf8, 0xc1, 0xd5, 0x7f, 0x78, 0xfd, 0xd7, 0x89, 0x23, 0xbe, 0x6f, + 0xdd, 0x83, 0x34, 0xf4, 0x2c, 0x3d, 0x59, 0x23, 0x17, 0xe5, 0xca, 0x90, 0x4f, 0x20, 0xdd, 0xce, + 0xe2, 0x42, 0x8c, 0xd5, 0xad, 0x21, 0x2f, 0xce, 0xf9, 0x5e, 0xad, 0xdd, 0x23, 0x29, 0x5d, 0x4a, + 0xa5, 0xec, 0xca, 0xf8, 0x64, 0x2b, 0x85, 0x6c, 0xf7, 0x78, 0x9a, 0x0f, 0xc7, 0xf2, 0x9b, 0x41, + 0x5f, 0x0c, 0xb6, 0x98, 0xd4, 0x23, 0x9e, 0x9d, 0xf1, 0xc9, 0xb8, 0x10, 0x82, 0xef, 0x18, 0xb9, + 0xd4, 0x09, 0xa4, 0x90, 0xc5, 0x45, 0x3f, 0x8b, 0x29, 0x8f, 0x2a, 0xa7, 0xe7, 0xf4, 0xd4, 0x6f, + 0x8f, 0x8b, 0x5f, 0xba, 0x3c, 0x6d, 0x5a, 0x64, 0xeb, 0x16, 0xd9, 0xa6, 0x45, 0x78, 0x09, 0x08, + 0xef, 0x01, 0xe1, 0x23, 0x20, 0x34, 0x01, 0xe1, 0x33, 0x20, 0x7c, 0x05, 0x64, 0x9b, 0x80, 0xf0, + 0xd6, 0x21, 0x6b, 0x3a, 0x64, 0xeb, 0x0e, 0xd9, 0x5d, 0xd4, 0xbf, 0xe3, 0xe4, 0x7b, 0x00, 0x5b, + 0xb0, 0xeb, 0x33, 0x2e, 0x01, 0x00, 0x00, } func (this *CertificateProperties) Equal(that interface{}) bool { @@ -198,6 +207,9 @@ func (this *ServiceAccount) Equal(that interface{}) bool { if this.Name != that1.Name { return false } + if this.Prefix != that1.Prefix { + return false + } return true } func (this *CertificateProperties) GoString() string { @@ -217,9 +229,10 @@ func (this *ServiceAccount) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 5) + s := make([]string, 0, 6) s = append(s, "&models.ServiceAccount{") s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "Prefix: "+fmt.Sprintf("%#v", this.Prefix)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -295,6 +308,13 @@ func (m *ServiceAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Prefix) > 0 { + i -= len(m.Prefix) + copy(dAtA[i:], m.Prefix) + i = encodeVarintCertificateProperties(dAtA, i, uint64(len(m.Prefix))) + i-- + dAtA[i] = 0x12 + } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) @@ -345,6 +365,10 @@ func (m *ServiceAccount) Size() (n int) { if l > 0 { n += 1 + l + sovCertificateProperties(uint64(l)) } + l = len(m.Prefix) + if l > 0 { + n += 1 + l + sovCertificateProperties(uint64(l)) + } return n } @@ -371,6 +395,7 @@ func (this *ServiceAccount) String() string { } s := strings.Join([]string{`&ServiceAccount{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Prefix:` + fmt.Sprintf("%v", this.Prefix) + `,`, `}`, }, "") return s @@ -562,6 +587,38 @@ func (m *ServiceAccount) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCertificateProperties + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCertificateProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCertificateProperties(dAtA[iNdEx:]) diff --git a/models/certificate_properties.proto b/models/certificate_properties.proto index 3810da01..e2f65fde 100644 --- a/models/certificate_properties.proto +++ b/models/certificate_properties.proto @@ -9,4 +9,5 @@ message CertificateProperties { message ServiceAccount { string name = 1; + string prefix = 2; } diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go index 6739a48b..6dffbdfb 100644 --- a/models/certificate_properties_test.go +++ b/models/certificate_properties_test.go @@ -42,11 +42,17 @@ func TestQualifiedServiceAccountPrefixRoundTrip(t *testing.T) { t.Fatal(err) } wire, err := proto.Marshal(&properties) - if err != nil { t.Fatal(err) } + if err != nil { + t.Fatal(err) + } var decoded models.CertificateProperties - if err := proto.Unmarshal(wire, &decoded); err != nil { t.Fatal(err) } + if err := proto.Unmarshal(wire, &decoded); err != nil { + t.Fatal(err) + } payload, err := json.Marshal(&decoded) - if err != nil { t.Fatal(err) } + if err != nil { + t.Fatal(err) + } if !strings.Contains(string(payload), `"prefix":"payments-team"`) { t.Fatalf("qualified prefix lost: %s", payload) } From 105b5b691b3792acef2e848609a61e21512fac62 Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 9 Nov 2026 17:15:41 +0100 Subject: [PATCH 09/14] Test rejecting malformed qualified account prefixes (red) --- models/certificate_properties_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go index 6dffbdfb..d43c0461 100644 --- a/models/certificate_properties_test.go +++ b/models/certificate_properties_test.go @@ -58,6 +58,15 @@ func TestQualifiedServiceAccountPrefixRoundTrip(t *testing.T) { } } +func TestQualifiedPrefixRejectsNoncanonicalLabels(t *testing.T) { + for _, prefix := range []string{"ab", "Upper", "a.b", "-abc", strings.Repeat("a", 64)} { + properties := models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: "worker-app", Prefix: prefix}} + if err := properties.Validate(); err == nil { + t.Fatalf("invalid prefix accepted: %q", prefix) + } + } +} + func TestServiceAccountCertificatePropertiesValidation(t *testing.T) { for _, name := range []string{"", "ab", "Payments-worker", "-payments", "payments-", "payments.reader", "payments.svc.identity", "payments_worker", strings.Repeat("a", 64)} { t.Run(name, func(t *testing.T) { From f974b85f8320d5d9b5544af2d431481471844ace Mon Sep 17 00:00:00 2001 From: rkoster Date: Mon, 9 Nov 2026 17:16:08 +0100 Subject: [PATCH 10/14] Validate qualified service account namespace labels in runtime contracts --- models/desired_lrp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/desired_lrp.go b/models/desired_lrp.go index d3beec24..205ffb35 100644 --- a/models/desired_lrp.go +++ b/models/desired_lrp.go @@ -883,6 +883,9 @@ func (*CertificateProperties) Version() format.Version { } func (properties CertificateProperties) Validate() error { + if properties.ServiceAccount != nil && properties.ServiceAccount.Prefix != "" && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Prefix) { + return ErrInvalidField{"certificate_properties.service_account.prefix"} + } if properties.ServiceAccount != nil && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Name) { return ErrInvalidField{"certificate_properties.service_account.name"} } From 29fc9bb6cf7eff624fa70545cbd939da50c1d314 Mon Sep 17 00:00:00 2001 From: rkoster Date: Thu, 19 Nov 2026 09:24:03 +0100 Subject: [PATCH 11/14] Test rejecting unqualified service account identities (red) --- models/certificate_properties_test.go | 52 +++++++++++++++++++-------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/models/certificate_properties_test.go b/models/certificate_properties_test.go index d43c0461..5476dc35 100644 --- a/models/certificate_properties_test.go +++ b/models/certificate_properties_test.go @@ -11,7 +11,7 @@ import ( func TestServiceAccountCertificatePropertiesRoundTrip(t *testing.T) { var properties models.CertificateProperties - if err := json.Unmarshal([]byte(`{"organizational_unit":["app:app-guid"],"service_account":{"name":"payments-worker"}}`), &properties); err != nil { + if err := json.Unmarshal([]byte(`{"organizational_unit":["app:app-guid"],"service_account":{"name":"payments-worker","prefix":"payments-team"}}`), &properties); err != nil { t.Fatal(err) } wire, err := proto.Marshal(&properties) @@ -31,7 +31,7 @@ func TestServiceAccountCertificatePropertiesRoundTrip(t *testing.T) { t.Fatal(err) } identity, ok := result["service_account"].(map[string]interface{}) - if !ok || identity["name"] != "payments-worker" { + if !ok || identity["name"] != "payments-worker" || identity["prefix"] != "payments-team" { t.Fatalf("service account lost in protobuf round trip: %s", payload) } } @@ -59,22 +59,34 @@ func TestQualifiedServiceAccountPrefixRoundTrip(t *testing.T) { } func TestQualifiedPrefixRejectsNoncanonicalLabels(t *testing.T) { - for _, prefix := range []string{"ab", "Upper", "a.b", "-abc", strings.Repeat("a", 64)} { - properties := models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: "worker-app", Prefix: prefix}} - if err := properties.Validate(); err == nil { - t.Fatalf("invalid prefix accepted: %q", prefix) - } + for _, prefix := range []string{"", "ab", "Upper", "a.b", "-abc", "abc-", "abc_def", strings.Repeat("a", 64)} { + t.Run(prefix, func(t *testing.T) { + properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: "worker-app", Prefix: prefix}} + runInfo := models.DesiredLRPRunInfo{DesiredLRPKey: models.DesiredLRPKey{ProcessGuid: "process", Domain: "cf-apps"}, Action: models.WrapAction(&models.RunAction{Path: "/bin/true", User: "vcap"}), CertificateProperties: properties} + task := models.TaskDefinition{RootFs: "preloaded:stack", Action: runInfo.Action, CertificateProperties: properties} + for name, validate := range map[string]func() error{ + "certificate properties": properties.Validate, + "LRP": runInfo.Validate, + "task": task.Validate, + } { + t.Run(name, func(t *testing.T) { + if err := validate(); err == nil || !strings.Contains(err.Error(), "certificate_properties.service_account.prefix") { + t.Fatalf("expected invalid prefix error for %q, got: %v", prefix, err) + } + }) + } + }) } } func TestServiceAccountCertificatePropertiesValidation(t *testing.T) { for _, name := range []string{"", "ab", "Payments-worker", "-payments", "payments-", "payments.reader", "payments.svc.identity", "payments_worker", strings.Repeat("a", 64)} { t.Run(name, func(t *testing.T) { - properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: name}} - if err := properties.Validate(); err == nil { + properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: name, Prefix: "payments-team"}} + if err := properties.Validate(); err == nil || !strings.Contains(err.Error(), "certificate_properties.service_account.name") { t.Fatal("noncanonical service account accepted") } - runInfo := models.DesiredLRPRunInfo{DesiredLRPKey: models.DesiredLRPKey{ProcessGuid: "process"}, Action: models.WrapAction(&models.RunAction{Path: "/bin/true", User: "vcap"}), CertificateProperties: properties} + runInfo := models.DesiredLRPRunInfo{DesiredLRPKey: models.DesiredLRPKey{ProcessGuid: "process", Domain: "cf-apps"}, Action: models.WrapAction(&models.RunAction{Path: "/bin/true", User: "vcap"}), CertificateProperties: properties} if err := runInfo.Validate(); err == nil || !strings.Contains(err.Error(), "service_account") { t.Fatalf("LRP validation lost service account error: %v", err) } @@ -84,18 +96,28 @@ func TestServiceAccountCertificatePropertiesValidation(t *testing.T) { } }) } - for _, properties := range []*models.CertificateProperties{{}, {ServiceAccount: &models.ServiceAccount{Name: "payments-worker"}}, {ServiceAccount: &models.ServiceAccount{Name: strings.Repeat("a", 63)}}} { - if err := properties.Validate(); err != nil { - t.Fatalf("valid certificate properties rejected: %v", err) + for _, properties := range []*models.CertificateProperties{nil, {}, {ServiceAccount: &models.ServiceAccount{Name: "payments-worker", Prefix: "payments-team"}}, {ServiceAccount: &models.ServiceAccount{Name: "a-0", Prefix: "0-a"}}, {ServiceAccount: &models.ServiceAccount{Name: strings.Repeat("a", 63), Prefix: strings.Repeat("b", 63)}}} { + if properties != nil { + if err := properties.Validate(); err != nil { + t.Fatalf("valid certificate properties rejected: %v", err) + } + } + runInfo := models.DesiredLRPRunInfo{DesiredLRPKey: models.DesiredLRPKey{ProcessGuid: "process", Domain: "cf-apps"}, Action: models.WrapAction(&models.RunAction{Path: "/bin/true", User: "vcap"}), CertificateProperties: properties} + if err := runInfo.Validate(); err != nil { + t.Fatalf("valid LRP rejected: %v", err) + } + task := models.TaskDefinition{RootFs: "preloaded:stack", Action: runInfo.Action, CertificateProperties: properties} + if err := task.Validate(); err != nil { + t.Fatalf("valid task rejected: %v", err) } } } func TestAssembledDesiredLRPRetainsServiceAccountIdentity(t *testing.T) { - properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: "payments-worker"}} + properties := &models.CertificateProperties{ServiceAccount: &models.ServiceAccount{Name: "payments-worker", Prefix: "payments-team"}} desired := &models.DesiredLRP{} desired.AddRunInfo(models.DesiredLRPRunInfo{CertificateProperties: properties}) - if desired.CertificateProperties == nil || desired.CertificateProperties.ServiceAccount.Name != "payments-worker" { + if desired.CertificateProperties == nil || desired.CertificateProperties.ServiceAccount == nil || desired.CertificateProperties.ServiceAccount.Name != "payments-worker" || desired.CertificateProperties.ServiceAccount.Prefix != "payments-team" { t.Fatal("assembling stored LRP run info dropped account identity") } } From 7fc64d1d37a1bb2f5bcb6619c87ac27f859ea62e Mon Sep 17 00:00:00 2001 From: rkoster Date: Thu, 19 Nov 2026 09:24:36 +0100 Subject: [PATCH 12/14] Require qualified service account certificate identities --- models/desired_lrp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/desired_lrp.go b/models/desired_lrp.go index 205ffb35..2416021b 100644 --- a/models/desired_lrp.go +++ b/models/desired_lrp.go @@ -883,7 +883,7 @@ func (*CertificateProperties) Version() format.Version { } func (properties CertificateProperties) Validate() error { - if properties.ServiceAccount != nil && properties.ServiceAccount.Prefix != "" && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Prefix) { + if properties.ServiceAccount != nil && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Prefix) { return ErrInvalidField{"certificate_properties.service_account.prefix"} } if properties.ServiceAccount != nil && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Name) { From a5c9c60f67ad62f71519fcc1b60047cfdd286bf9 Mon Sep 17 00:00:00 2001 From: rkoster Date: Fri, 20 Nov 2026 10:37:39 +0100 Subject: [PATCH 13/14] Test server preserves and validates service account identities (red) --- handlers/desired_lrp_handlers_test.go | 30 ++++++++++++++++++++++++++ handlers/task_handlers_test.go | 31 +++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/handlers/desired_lrp_handlers_test.go b/handlers/desired_lrp_handlers_test.go index 2401b93a..ecf8a408 100644 --- a/handlers/desired_lrp_handlers_test.go +++ b/handlers/desired_lrp_handlers_test.go @@ -1058,6 +1058,36 @@ var _ = Describe("DesiredLRP Handlers", func() { Expect(response.Error).To(BeNil()) }) + Context("with a qualified service account", func() { + BeforeEach(func() { + desiredLRP.CertificateProperties = &models.CertificateProperties{} + Expect(json.Unmarshal([]byte(`{"service_account":{"name":"payments-worker","prefix":"payments-team"}}`), desiredLRP.CertificateProperties)).To(Succeed()) + }) + + It("preserves the service account through server request decoding", func() { + Expect(fakeDesiredLRPDB.DesireLRPCallCount()).To(Equal(1)) + _, _, actual := fakeDesiredLRPDB.DesireLRPArgsForCall(0) + payload, err := json.Marshal(actual.CertificateProperties) + Expect(err).NotTo(HaveOccurred()) + Expect(string(payload)).To(MatchJSON(`{"service_account":{"name":"payments-worker","prefix":"payments-team"}}`)) + }) + }) + + Context("with an unqualified service account", func() { + BeforeEach(func() { + desiredLRP.CertificateProperties = &models.CertificateProperties{} + Expect(json.Unmarshal([]byte(`{"service_account":{"name":"payments-worker"}}`), desiredLRP.CertificateProperties)).To(Succeed()) + }) + + It("rejects the service account before persistence", func() { + Expect(fakeDesiredLRPDB.DesireLRPCallCount()).To(BeZero()) + response := models.DesiredLRPLifecycleResponse{} + Expect(response.Unmarshal(responseRecorder.Body.Bytes())).To(Succeed()) + Expect(response.Error).NotTo(BeNil()) + Expect(response.Error.Message).To(ContainSubstring("service_account.prefix")) + }) + }) + It("emits a create event to the hub", func() { Eventually(desiredHub.EmitCallCount).Should(Equal(1)) event := desiredHub.EmitArgsForCall(0) diff --git a/handlers/task_handlers_test.go b/handlers/task_handlers_test.go index 349c4107..003287cb 100644 --- a/handlers/task_handlers_test.go +++ b/handlers/task_handlers_test.go @@ -2,6 +2,7 @@ package handlers_test import ( "context" + "encoding/json" "fmt" "net/http" "net/http/httptest" @@ -522,6 +523,36 @@ var _ = Describe("Task Handlers", func() { }) Context("when the desire is successful", func() { + Context("with a qualified service account", func() { + BeforeEach(func() { + taskDef.CertificateProperties = &models.CertificateProperties{} + Expect(json.Unmarshal([]byte(`{"service_account":{"name":"payments-worker","prefix":"payments-team"}}`), taskDef.CertificateProperties)).To(Succeed()) + }) + + It("preserves the service account through server request decoding", func() { + Expect(controller.DesireTaskCallCount()).To(Equal(1)) + _, _, actual, _, _ := controller.DesireTaskArgsForCall(0) + payload, err := json.Marshal(actual.CertificateProperties) + Expect(err).NotTo(HaveOccurred()) + Expect(string(payload)).To(MatchJSON(`{"service_account":{"name":"payments-worker","prefix":"payments-team"}}`)) + }) + }) + + Context("with an unqualified service account", func() { + BeforeEach(func() { + taskDef.CertificateProperties = &models.CertificateProperties{} + Expect(json.Unmarshal([]byte(`{"service_account":{"name":"payments-worker"}}`), taskDef.CertificateProperties)).To(Succeed()) + }) + + It("rejects the service account before persistence", func() { + Expect(controller.DesireTaskCallCount()).To(BeZero()) + response := models.TaskLifecycleResponse{} + Expect(response.Unmarshal(responseRecorder.Body.Bytes())).To(Succeed()) + Expect(response.Error).NotTo(BeNil()) + Expect(response.Error.Message).To(ContainSubstring("service_account.prefix")) + }) + }) + It("desires the task with the requested definitions", func() { Expect(controller.DesireTaskCallCount()).To(Equal(1)) _, _, actualTaskDef, actualTaskGuid, actualDomain := controller.DesireTaskArgsForCall(0) From 4f448fa91c7b4e41b27f9b9b2f9b51439ccdcc43 Mon Sep 17 00:00:00 2001 From: rkoster Date: Fri, 20 Nov 2026 10:41:45 +0100 Subject: [PATCH 14/14] Align server models dependency with qualified account contract --- go.mod | 14 +- go.sum | 24 +- .../bbs/models/certificate_properties.pb.go | 369 +++++++++++++++++- .../bbs/models/certificate_properties.proto | 5 + .../bbs/models/desired_lrp.go | 13 +- .../code.cloudfoundry.org/bbs/models/task.go | 3 + vendor/github.com/onsi/gomega/CHANGELOG.md | 14 + vendor/github.com/onsi/gomega/gomega_dsl.go | 2 +- vendor/github.com/onsi/gomega/matchers.go | 6 + .../onsi/gomega/matchers/attributes_slice.go | 8 +- .../gomega/matchers/be_numerically_matcher.go | 58 ++- .../gomega/matchers/have_exact_elements.go | 11 +- .../onsi/gomega/matchers/have_key_matcher.go | 42 +- .../matchers/have_key_with_value_matcher.go | 62 +-- .../gomega/matchers/match_json_matcher.go | 98 ++++- .../onsi/gomega/matchers/match_xml_matcher.go | 20 +- .../gomega/matchers/match_yaml_matcher.go | 106 ++++- .../onsi/gomega/matchers/type_support.go | 22 +- vendor/modules.txt | 13 +- 19 files changed, 726 insertions(+), 164 deletions(-) diff --git a/go.mod b/go.mod index f3a4e534..ac4b86d3 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module code.cloudfoundry.org/bbs go 1.26.2 require ( - code.cloudfoundry.org/bbs/encryption v1.14.0 - code.cloudfoundry.org/bbs/format v1.12.0 - code.cloudfoundry.org/bbs/models v1.13.0 + code.cloudfoundry.org/bbs/encryption v1.16.0 + code.cloudfoundry.org/bbs/format v1.13.0 + code.cloudfoundry.org/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1 code.cloudfoundry.org/cfhttp/v2 v2.95.0 code.cloudfoundry.org/clock v1.88.0 code.cloudfoundry.org/debugserver v0.115.0 @@ -14,7 +14,7 @@ require ( code.cloudfoundry.org/durationjson v0.90.0 code.cloudfoundry.org/go-loggregator/v9 v9.2.1 code.cloudfoundry.org/inigo v0.0.0-20250908175034-b7230e46c815 - code.cloudfoundry.org/lager/v3 v3.87.0 + code.cloudfoundry.org/lager/v3 v3.88.0 code.cloudfoundry.org/locket v1.13.0 code.cloudfoundry.org/routing-info v1.14.0 code.cloudfoundry.org/tlsconfig v0.67.0 @@ -25,7 +25,7 @@ require ( github.com/jackc/pgx/v5 v5.11.0 github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d github.com/onsi/ginkgo/v2 v2.33.0 - github.com/onsi/gomega v1.43.1 + github.com/onsi/gomega v1.44.0 github.com/openzipkin/zipkin-go v0.4.3 github.com/tedsuo/ifrit v0.0.0-20260908181113-dd353a7daa27 github.com/tedsuo/rata v1.0.0 @@ -41,7 +41,7 @@ require ( github.com/go-logr/logr v1.4.4 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/pprof v0.0.0-20260906184651-6331bc6350fe // indirect + github.com/google/pprof v0.0.0-20260926063103-aaccee046517 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect @@ -62,3 +62,5 @@ require ( // pin ifrit until https://github.com/tedsuo/ifrit/pull/48 is merged replace github.com/tedsuo/ifrit => github.com/tedsuo/ifrit v0.0.0-20260418191334-846868129986 + +replace code.cloudfoundry.org/bbs/models => github.com/rkoster/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1 diff --git a/go.sum b/go.sum index 15216836..705d4dd4 100644 --- a/go.sum +++ b/go.sum @@ -592,12 +592,10 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -code.cloudfoundry.org/bbs/encryption v1.14.0 h1:yd+Jb2LqmfaWF5ISGQRTeN9CSpIADVh994uL9HqjAw8= -code.cloudfoundry.org/bbs/encryption v1.14.0/go.mod h1:9d1YCMLJ5yHCnbsrr84GMdJ2XMBi+rMpjP7eikfuUW4= -code.cloudfoundry.org/bbs/format v1.12.0 h1:NlRlSgYcwAYzTAOcb0de/9Gi1lV3NHP5TuMuQ0hnBJA= -code.cloudfoundry.org/bbs/format v1.12.0/go.mod h1:FKe+sJENJimE0S6RlqYDqG8dDpiao/+YtjaKqvadXyU= -code.cloudfoundry.org/bbs/models v1.13.0 h1:rFnXwBUWT1PqeNI6/S/2RmIDa143apLu5KYzjj6cCCc= -code.cloudfoundry.org/bbs/models v1.13.0/go.mod h1:58T80LLEoBX4Z76TbQIDr93xSTx5soZw1JJM7Mht1E4= +code.cloudfoundry.org/bbs/encryption v1.16.0 h1:/sw3A7HvupOD/HCta5CYFatBQqvk2FGzgW6Zo41C1R0= +code.cloudfoundry.org/bbs/encryption v1.16.0/go.mod h1:8w+9l3ctXHuE7gUWaBhtBwUpNmowSvMF2vWVlSP7LRA= +code.cloudfoundry.org/bbs/format v1.13.0 h1:gLzokleSeLS+TIbDqfGRwT+Yg5mV4yQqGhpyNnO7J7U= +code.cloudfoundry.org/bbs/format v1.13.0/go.mod h1:+f07f5yznZ3tTkSUnzAmrk5OuCfmLGauGjOkGOup10A= code.cloudfoundry.org/cfhttp/v2 v2.95.0 h1:lIadLnwpEJces15YfIvIxGe/kwLfXIdCSP15OenAMFs= code.cloudfoundry.org/cfhttp/v2 v2.95.0/go.mod h1:E7m7LQcaPm4j0b3bWTv5gemXgT60jGwD6SYoPBPy9MU= code.cloudfoundry.org/clock v1.88.0 h1:rlPCGl0D5fV9vjNl8ww+QS3ffvhRl+zoQdCdv+uHtFg= @@ -616,8 +614,8 @@ code.cloudfoundry.org/go-loggregator/v9 v9.2.1 h1:S6Lgg5UJbhh2bt2TGQxs6R00CF8PrU code.cloudfoundry.org/go-loggregator/v9 v9.2.1/go.mod h1:FTFFruqGeOhVCDFvyLgl8EV8YW63NNwRzLhxJcporu8= code.cloudfoundry.org/inigo v0.0.0-20250908175034-b7230e46c815 h1:f3kRw+Gb7E8422fnIu0eXhgxqTYZm3siyGuOyyF4RHw= code.cloudfoundry.org/inigo v0.0.0-20250908175034-b7230e46c815/go.mod h1:1ZB1JCh2FAp+SqX79ve6dc8YREvbsziULEOncAilX4Q= -code.cloudfoundry.org/lager/v3 v3.87.0 h1:e6zDuyV8/jsMhHaSCtFecWh65dSLNeNVlydwAznI9D0= -code.cloudfoundry.org/lager/v3 v3.87.0/go.mod h1:2PulAlxdP8DQApM9bvxiAiJnV+Xs6HkyxgcPvQ4fTPg= +code.cloudfoundry.org/lager/v3 v3.88.0 h1:6L5TP+FamXT5pYb0SlinGkap0bTKRalxCt/RGNswZf0= +code.cloudfoundry.org/lager/v3 v3.88.0/go.mod h1:pT0Xsju4DYiiEDKVxvNfrZllKAYr1qwLZzRQKwT2wOw= code.cloudfoundry.org/locket v1.13.0 h1:qmLnQ8qjbgFUcuYkwibXJxu5UQyN9mC0NV3pRQI2cqY= code.cloudfoundry.org/locket v1.13.0/go.mod h1:GZysEk+mqoOkeG2lN2CVehM5DrNVvBmMRJGQEBvwJGs= code.cloudfoundry.org/routing-info v1.14.0 h1:+g5p8/7qNXSyYOmLQyRbsWoSncjnBVxGMYwTetZrj2c= @@ -816,8 +814,8 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20260906184651-6331bc6350fe h1:QAinXoAFJdGQYztXn3VpFey7KCwpedbZ/EkzbplQ0cY= -github.com/google/pprof v0.0.0-20260906184651-6331bc6350fe/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk= +github.com/google/pprof v0.0.0-20260926063103-aaccee046517 h1:joNby64wfCIWh0HXBMrjZc6ii70nntnG9u3CQSXXwiA= +github.com/google/pprof v0.0.0-20260926063103-aaccee046517/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -928,8 +926,8 @@ github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfad github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= -github.com/onsi/gomega v1.43.1 h1:vGIPFuYrIO6/0Z09s0I0QQQgFchiX4+tb1re3MScJYo= -github.com/onsi/gomega v1.43.1/go.mod h1:e/C2HwaZ1DhvjzXXuFhcR7hY7Sh9pl7MmoWKEjzwcdA= +github.com/onsi/gomega v1.44.0 h1:eAiGl3Pw5jz5GQdDff0BcxYpAX1JxW8xD7mFUuwNfZQ= +github.com/onsi/gomega v1.44.0/go.mod h1:e/C2HwaZ1DhvjzXXuFhcR7hY7Sh9pl7MmoWKEjzwcdA= github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= @@ -947,6 +945,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rkoster/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1 h1:X/Xay0t5UXWjYycoWC0rYG1HkQej86lhkRP2F7kqNnM= +github.com/rkoster/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1/go.mod h1:/JjPTukAyP00ykFdv267UfiGq6c6zZqh3/LB32OWOjY= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= diff --git a/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.pb.go b/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.pb.go index 7815f28f..785f83a8 100644 --- a/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.pb.go +++ b/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.pb.go @@ -25,7 +25,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type CertificateProperties struct { - OrganizationalUnit []string `protobuf:"bytes,1,rep,name=organizational_unit,json=organizationalUnit,proto3" json:"organizational_unit,omitempty"` + OrganizationalUnit []string `protobuf:"bytes,1,rep,name=organizational_unit,json=organizationalUnit,proto3" json:"organizational_unit,omitempty"` + ServiceAccount *ServiceAccount `protobuf:"bytes,2,opt,name=service_account,json=serviceAccount,proto3" json:"service_account,omitempty"` } func (m *CertificateProperties) Reset() { *m = CertificateProperties{} } @@ -67,25 +68,89 @@ func (m *CertificateProperties) GetOrganizationalUnit() []string { return nil } +func (m *CertificateProperties) GetServiceAccount() *ServiceAccount { + if m != nil { + return m.ServiceAccount + } + return nil +} + +type ServiceAccount struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` +} + +func (m *ServiceAccount) Reset() { *m = ServiceAccount{} } +func (*ServiceAccount) ProtoMessage() {} +func (*ServiceAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_9291b57c1fe01997, []int{1} +} +func (m *ServiceAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ServiceAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ServiceAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ServiceAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceAccount.Merge(m, src) +} +func (m *ServiceAccount) XXX_Size() int { + return m.Size() +} +func (m *ServiceAccount) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceAccount proto.InternalMessageInfo + +func (m *ServiceAccount) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ServiceAccount) GetPrefix() string { + if m != nil { + return m.Prefix + } + return "" +} + func init() { proto.RegisterType((*CertificateProperties)(nil), "models.CertificateProperties") + proto.RegisterType((*ServiceAccount)(nil), "models.ServiceAccount") } func init() { proto.RegisterFile("certificate_properties.proto", fileDescriptor_9291b57c1fe01997) } var fileDescriptor_9291b57c1fe01997 = []byte{ - // 169 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x4e, 0x2d, 0x2a, - 0xc9, 0x4c, 0xcb, 0x4c, 0x4e, 0x2c, 0x49, 0x8d, 0x2f, 0x28, 0xca, 0x2f, 0x00, 0x71, 0x53, 0x8b, - 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xd8, 0x72, 0xf3, 0x53, 0x52, 0x73, 0x8a, 0x95, 0x3c, - 0xb8, 0x44, 0x9d, 0x11, 0xea, 0x02, 0xe0, 0xca, 0x84, 0xf4, 0xb9, 0x84, 0xf3, 0x8b, 0xd2, 0x13, - 0xf3, 0x32, 0xab, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x12, 0x73, 0xe2, 0x4b, 0xf3, 0x32, 0x4b, 0x24, - 0x18, 0x15, 0x98, 0x35, 0x38, 0x83, 0x84, 0x50, 0xa5, 0x42, 0xf3, 0x32, 0x4b, 0x9c, 0x4c, 0x2e, - 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xe1, 0xc3, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, - 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, - 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, - 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x9d, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, - 0xff, 0x07, 0xe2, 0x02, 0xdf, 0xae, 0x00, 0x00, 0x00, + // 247 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xb1, 0x4a, 0xc4, 0x40, + 0x10, 0x40, 0x77, 0x54, 0x02, 0x59, 0xe1, 0x84, 0x15, 0x8f, 0x14, 0x32, 0x84, 0xab, 0x52, 0x45, + 0x50, 0x4b, 0x41, 0xd4, 0x1f, 0x90, 0x88, 0x75, 0x58, 0xd7, 0x3d, 0x19, 0xb8, 0xdb, 0x0d, 0x9b, + 0x3d, 0x11, 0x2b, 0x5b, 0x3b, 0x3f, 0xc3, 0x4f, 0xb1, 0x4c, 0x79, 0xa5, 0xd9, 0x34, 0x96, 0xf7, + 0x09, 0x62, 0x22, 0x4a, 0xba, 0x79, 0xbc, 0xc7, 0x0c, 0x0c, 0x3f, 0x54, 0xda, 0x79, 0x9a, 0x93, + 0x92, 0x5e, 0x97, 0x95, 0xb3, 0xd5, 0x0f, 0xea, 0x3a, 0xaf, 0x9c, 0xf5, 0x56, 0x44, 0x4b, 0x7b, + 0xaf, 0x17, 0xf5, 0xec, 0x15, 0xf8, 0xc1, 0xd5, 0x7f, 0x78, 0xfd, 0xd7, 0x89, 0x23, 0xbe, 0x6f, + 0xdd, 0x83, 0x34, 0xf4, 0x2c, 0x3d, 0x59, 0x23, 0x17, 0xe5, 0xca, 0x90, 0x4f, 0x20, 0xdd, 0xce, + 0xe2, 0x42, 0x8c, 0xd5, 0xad, 0x21, 0x2f, 0xce, 0xf9, 0x5e, 0xad, 0xdd, 0x23, 0x29, 0x5d, 0x4a, + 0xa5, 0xec, 0xca, 0xf8, 0x64, 0x2b, 0x85, 0x6c, 0xf7, 0x78, 0x9a, 0x0f, 0xc7, 0xf2, 0x9b, 0x41, + 0x5f, 0x0c, 0xb6, 0x98, 0xd4, 0x23, 0x9e, 0x9d, 0xf1, 0xc9, 0xb8, 0x10, 0x82, 0xef, 0x18, 0xb9, + 0xd4, 0x09, 0xa4, 0x90, 0xc5, 0x45, 0x3f, 0x8b, 0x29, 0x8f, 0x2a, 0xa7, 0xe7, 0xf4, 0xd4, 0x6f, + 0x8f, 0x8b, 0x5f, 0xba, 0x3c, 0x6d, 0x5a, 0x64, 0xeb, 0x16, 0xd9, 0xa6, 0x45, 0x78, 0x09, 0x08, + 0xef, 0x01, 0xe1, 0x23, 0x20, 0x34, 0x01, 0xe1, 0x33, 0x20, 0x7c, 0x05, 0x64, 0x9b, 0x80, 0xf0, + 0xd6, 0x21, 0x6b, 0x3a, 0x64, 0xeb, 0x0e, 0xd9, 0x5d, 0xd4, 0xbf, 0xe3, 0xe4, 0x7b, 0x00, 0x5b, + 0xb0, 0xeb, 0x33, 0x2e, 0x01, 0x00, 0x00, } func (this *CertificateProperties) Equal(that interface{}) bool { @@ -115,15 +180,59 @@ func (this *CertificateProperties) Equal(that interface{}) bool { return false } } + if !this.ServiceAccount.Equal(that1.ServiceAccount) { + return false + } + return true +} +func (this *ServiceAccount) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ServiceAccount) + if !ok { + that2, ok := that.(ServiceAccount) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.Prefix != that1.Prefix { + return false + } return true } func (this *CertificateProperties) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 5) + s := make([]string, 0, 6) s = append(s, "&models.CertificateProperties{") s = append(s, "OrganizationalUnit: "+fmt.Sprintf("%#v", this.OrganizationalUnit)+",\n") + if this.ServiceAccount != nil { + s = append(s, "ServiceAccount: "+fmt.Sprintf("%#v", this.ServiceAccount)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ServiceAccount) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&models.ServiceAccount{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "Prefix: "+fmt.Sprintf("%#v", this.Prefix)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -155,6 +264,18 @@ func (m *CertificateProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ServiceAccount != nil { + { + size, err := m.ServiceAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCertificateProperties(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.OrganizationalUnit) > 0 { for iNdEx := len(m.OrganizationalUnit) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.OrganizationalUnit[iNdEx]) @@ -167,6 +288,43 @@ func (m *CertificateProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ServiceAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ServiceAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Prefix) > 0 { + i -= len(m.Prefix) + copy(dAtA[i:], m.Prefix) + i = encodeVarintCertificateProperties(dAtA, i, uint64(len(m.Prefix))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCertificateProperties(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintCertificateProperties(dAtA []byte, offset int, v uint64) int { offset -= sovCertificateProperties(v) base := offset @@ -190,6 +348,27 @@ func (m *CertificateProperties) Size() (n int) { n += 1 + l + sovCertificateProperties(uint64(l)) } } + if m.ServiceAccount != nil { + l = m.ServiceAccount.Size() + n += 1 + l + sovCertificateProperties(uint64(l)) + } + return n +} + +func (m *ServiceAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCertificateProperties(uint64(l)) + } + l = len(m.Prefix) + if l > 0 { + n += 1 + l + sovCertificateProperties(uint64(l)) + } return n } @@ -205,6 +384,18 @@ func (this *CertificateProperties) String() string { } s := strings.Join([]string{`&CertificateProperties{`, `OrganizationalUnit:` + fmt.Sprintf("%v", this.OrganizationalUnit) + `,`, + `ServiceAccount:` + strings.Replace(this.ServiceAccount.String(), "ServiceAccount", "ServiceAccount", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ServiceAccount) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ServiceAccount{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Prefix:` + fmt.Sprintf("%v", this.Prefix) + `,`, `}`, }, "") return s @@ -278,6 +469,156 @@ func (m *CertificateProperties) Unmarshal(dAtA []byte) error { } m.OrganizationalUnit = append(m.OrganizationalUnit, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCertificateProperties + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCertificateProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ServiceAccount == nil { + m.ServiceAccount = &ServiceAccount{} + } + if err := m.ServiceAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCertificateProperties(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCertificateProperties + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ServiceAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ServiceAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCertificateProperties + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCertificateProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCertificateProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCertificateProperties + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCertificateProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCertificateProperties(dAtA[iNdEx:]) diff --git a/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.proto b/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.proto index 9eced102..e2f65fde 100644 --- a/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.proto +++ b/vendor/code.cloudfoundry.org/bbs/models/certificate_properties.proto @@ -4,5 +4,10 @@ package models; message CertificateProperties { repeated string organizational_unit = 1; + ServiceAccount service_account = 2; } +message ServiceAccount { + string name = 1; + string prefix = 2; +} diff --git a/vendor/code.cloudfoundry.org/bbs/models/desired_lrp.go b/vendor/code.cloudfoundry.org/bbs/models/desired_lrp.go index 7783d362..2416021b 100644 --- a/vendor/code.cloudfoundry.org/bbs/models/desired_lrp.go +++ b/vendor/code.cloudfoundry.org/bbs/models/desired_lrp.go @@ -18,6 +18,7 @@ const ExtraRootFSScheme = "extra" const volumeMountedFilesMaxAllowedSize = 1 * 1024 * 1024 // 1MB in bytes var processGuidPattern = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`) +var serviceAccountNamePattern = regexp.MustCompile(`\A[a-z0-9][a-z0-9-]{1,61}[a-z0-9]\z`) type DesiredLRPChange struct { Before *DesiredLRP @@ -123,6 +124,7 @@ func (desiredLRP *DesiredLRP) AddRunInfo(runInfo DesiredLRPRunInfo) { desiredLRP.TrustedSystemCertificatesPath = runInfo.TrustedSystemCertificatesPath desiredLRP.VolumeMounts = runInfo.VolumeMounts desiredLRP.Network = runInfo.Network + desiredLRP.CertificateProperties = runInfo.CertificateProperties desiredLRP.CheckDefinition = runInfo.CheckDefinition desiredLRP.VolumeMountedFiles = volumeMountedFiles } @@ -786,6 +788,9 @@ func NewDesiredLRPRunInfo( func (runInfo DesiredLRPRunInfo) Validate() error { var validationError ValidationError + if runInfo.CertificateProperties != nil { + validationError = validationError.Check(runInfo.CertificateProperties) + } validationError = validationError.Check(runInfo.DesiredLRPKey) @@ -877,7 +882,13 @@ func (*CertificateProperties) Version() format.Version { return format.V0 } -func (CertificateProperties) Validate() error { +func (properties CertificateProperties) Validate() error { + if properties.ServiceAccount != nil && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Prefix) { + return ErrInvalidField{"certificate_properties.service_account.prefix"} + } + if properties.ServiceAccount != nil && !serviceAccountNamePattern.MatchString(properties.ServiceAccount.Name) { + return ErrInvalidField{"certificate_properties.service_account.name"} + } return nil } diff --git a/vendor/code.cloudfoundry.org/bbs/models/task.go b/vendor/code.cloudfoundry.org/bbs/models/task.go index 2319fe99..d12b4546 100644 --- a/vendor/code.cloudfoundry.org/bbs/models/task.go +++ b/vendor/code.cloudfoundry.org/bbs/models/task.go @@ -93,6 +93,9 @@ func (t *TaskDefinition) Copy() *TaskDefinition { func (def *TaskDefinition) Validate() error { var validationError ValidationError + if def.CertificateProperties != nil { + validationError = validationError.Check(def.CertificateProperties) + } if def.RootFs == "" { validationError = validationError.Append(ErrInvalidField{"rootfs"}) diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 51239daf..07f33258 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -6,6 +6,20 @@ ### Maintenance +## 1.44.0 + +### Fixes +- `BeNumerically` compares signed and unsigned integers by value: `-1` no longer equals `uint64(math.MaxUint64)` and `uint(5)` is now greater than `-3` (#925) [26e3c6b] +- `BeNumerically("~")` no longer overflows when computing the distance between extreme integers (#928) [1955764] +- `BeNumerically("==", x, threshold)` now honors the threshold for floats, as it already did for integers (#927) [10e2aca] +- `HaveKeyWithValue` succeeds if any key accepted by the key matcher has a matching value, rather than depending on map iteration order (#929) [ffc577a] +- `HaveKey` and `HaveKeyWithValue` treat key and value matcher errors like `ContainElement` does: a match wins, and an error is only reported when nothing matches (#926) [dc91598] +- `MatchJSON` no longer treats numbers too large for a float64 as equal to one another (#930) [9d619a5] +- `MatchJSON` compares integers beyond ±2^53 exactly, so neighboring large integers (e.g. IDs) no longer match; all other numbers are still compared as float64s (#931) [8ef1aa7, 630fe12] +- `HaveExactElements` reports missing or extra elements that start at index 0, and reports the first extra element's index rather than the last (#934) [af1b777] +- `MatchYAML` compares every document in a multi-document stream rather than only the first; empty documents (e.g. a leading or trailing `---`) are ignored (#933) [2773796] +- `MatchXML` ignores namespace prefixes: elements and attributes are compared by namespace URI, and the URIs declared on each element must match whatever prefix they are bound to (#932) [c0dbd89, 2565350] + ## 1.43.1 ### Maintenance diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index dd1511f2..cf4eaefa 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.43.1" +const GOMEGA_VERSION = "1.44.0" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index bf572260..e3e01f66 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -291,6 +291,8 @@ func HaveSuffix(suffix string, args ...any) types.GomegaMatcher { // MatchJSON succeeds if actual is a string or stringer of JSON that matches // the expected JSON. The JSONs are decoded and the resulting objects are compared via // reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +// Numbers are compared as float64s, except for integers too large to be represented +// exactly by a float64 (beyond ±2^53), which are compared exactly. func MatchJSON(json any) types.GomegaMatcher { return &matchers.MatchJSONMatcher{ JSONToMatch: json, @@ -300,6 +302,8 @@ func MatchJSON(json any) types.GomegaMatcher { // MatchXML succeeds if actual is a string or stringer of XML that matches // the expected XML. The XMLs are decoded and the resulting objects are compared via // reflect.DeepEqual so things like whitespaces shouldn't matter. +// Namespace prefixes are ignored: element and attribute names are compared by +// namespace URI, and the namespace URIs declared on each element must match. func MatchXML(xml any) types.GomegaMatcher { return &matchers.MatchXMLMatcher{ XMLToMatch: xml, @@ -309,6 +313,8 @@ func MatchXML(xml any) types.GomegaMatcher { // MatchYAML succeeds if actual is a string or stringer of YAML that matches // the expected YAML. The YAML's are decoded and the resulting objects are compared via // reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +// Multi-document YAML streams are compared document by document; empty documents +// (e.g. from a leading or trailing "---") are ignored. func MatchYAML(yaml any) types.GomegaMatcher { return &matchers.MatchYAMLMatcher{ YAMLToMatch: yaml, diff --git a/vendor/github.com/onsi/gomega/matchers/attributes_slice.go b/vendor/github.com/onsi/gomega/matchers/attributes_slice.go index 355b362f..ea8e5ba1 100644 --- a/vendor/github.com/onsi/gomega/matchers/attributes_slice.go +++ b/vendor/github.com/onsi/gomega/matchers/attributes_slice.go @@ -9,6 +9,12 @@ type attributesSlice []xml.Attr func (attrs attributesSlice) Len() int { return len(attrs) } func (attrs attributesSlice) Less(i, j int) bool { - return strings.Compare(attrs[i].Name.Local, attrs[j].Name.Local) == -1 + if attrs[i].Name.Local != attrs[j].Name.Local { + return strings.Compare(attrs[i].Name.Local, attrs[j].Name.Local) == -1 + } + if attrs[i].Name.Space != attrs[j].Name.Space { + return strings.Compare(attrs[i].Name.Space, attrs[j].Name.Space) == -1 + } + return strings.Compare(attrs[i].Value, attrs[j].Value) == -1 } func (attrs attributesSlice) Swap(i, j int) { attrs[i], attrs[j] = attrs[j], attrs[i] } diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go index 7e6ce154..02839f34 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go @@ -5,6 +5,7 @@ package matchers import ( "fmt" "math" + "math/big" "github.com/onsi/gomega/format" ) @@ -60,18 +61,12 @@ func (matcher *BeNumericallyMatcher) Match(actual any) (success bool, err error) secondOperand = toFloat(matcher.CompareTo[1]) } success = matcher.matchFloats(toFloat(actual), toFloat(matcher.CompareTo[0]), secondOperand) - } else if isInteger(actual) { - var secondOperand int64 = 0 + } else if isInteger(actual) || isUnsignedInteger(actual) { + var threshold any = 0 if len(matcher.CompareTo) == 2 { - secondOperand = toInteger(matcher.CompareTo[1]) + threshold = matcher.CompareTo[1] } - success = matcher.matchIntegers(toInteger(actual), toInteger(matcher.CompareTo[0]), secondOperand) - } else if isUnsignedInteger(actual) { - var secondOperand uint64 = 0 - if len(matcher.CompareTo) == 2 { - secondOperand = toUnsignedInteger(matcher.CompareTo[1]) - } - success = matcher.matchUnsignedIntegers(toUnsignedInteger(actual), toUnsignedInteger(matcher.CompareTo[0]), secondOperand) + success = matcher.matchIntegers(toBigInt(actual), toBigInt(matcher.CompareTo[0]), threshold) } else { return false, fmt.Errorf("Failed to compare:\n%s\n%s:\n%s", format.Object(actual, 1), matcher.Comparator, format.Object(matcher.CompareTo[0], 1)) } @@ -79,40 +74,35 @@ func (matcher *BeNumericallyMatcher) Match(actual any) (success bool, err error) return success, nil } -func (matcher *BeNumericallyMatcher) matchIntegers(actual, compareTo, threshold int64) (success bool) { +// matchIntegers compares signed and unsigned integers by their exact mathematical value, using math/big so +// that neither mixing signedness nor computing the distance between the two values can overflow +func (matcher *BeNumericallyMatcher) matchIntegers(actual, compareTo *big.Int, threshold any) (success bool) { switch matcher.Comparator { case "==", "~": - diff := actual - compareTo - return -threshold <= diff && diff <= threshold + distance := new(big.Int).Sub(actual, compareTo) + return isWithinThreshold(distance.Abs(distance), threshold) case ">": - return (actual > compareTo) + return actual.Cmp(compareTo) > 0 case ">=": - return (actual >= compareTo) + return actual.Cmp(compareTo) >= 0 case "<": - return (actual < compareTo) + return actual.Cmp(compareTo) < 0 case "<=": - return (actual <= compareTo) + return actual.Cmp(compareTo) <= 0 } return false } -func (matcher *BeNumericallyMatcher) matchUnsignedIntegers(actual, compareTo, threshold uint64) (success bool) { - switch matcher.Comparator { - case "==", "~": - if actual < compareTo { - actual, compareTo = compareTo, actual +// isWithinThreshold reports whether the (non-negative) distance is no greater than the threshold, which may be any number +func isWithinThreshold(distance *big.Int, threshold any) bool { + if isFloat(threshold) { + t := toFloat(threshold) + if math.IsNaN(t) { + return false } - return actual-compareTo <= threshold - case ">": - return (actual > compareTo) - case ">=": - return (actual >= compareTo) - case "<": - return (actual < compareTo) - case "<=": - return (actual <= compareTo) + return new(big.Float).SetInt(distance).Cmp(big.NewFloat(t)) <= 0 } - return false + return distance.Cmp(toBigInt(threshold)) <= 0 } func (matcher *BeNumericallyMatcher) matchFloats(actual, compareTo, threshold float64) (success bool) { @@ -120,6 +110,10 @@ func (matcher *BeNumericallyMatcher) matchFloats(actual, compareTo, threshold fl case "~": return math.Abs(actual-compareTo) <= threshold case "==": + // an explicit threshold is honored, as it is for integers; without one == means exact equality + if len(matcher.CompareTo) == 2 { + return math.Abs(actual-compareTo) <= threshold + } return (actual == compareTo) case ">": return (actual > compareTo) diff --git a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go index 8b2d297c..18f7b284 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go +++ b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go @@ -79,7 +79,7 @@ func (matcher *HaveExactElementsMatcher) Match(actual any) (success bool, err er if i >= lenMatchers { matcher.extraIndex = i success = false - continue + return } if i >= lenValues { @@ -110,10 +110,10 @@ func (matcher *HaveExactElementsMatcher) Match(actual any) (success bool, err er func (matcher *HaveExactElementsMatcher) FailureMessage(actual any) (message string) { message = format.Message(actual, "to have exact elements with", presentable(matcher.Elements)) - if matcher.missingIndex > 0 { + if matcher.missingIndex >= 0 { message = fmt.Sprintf("%s\nthe missing elements start from index %d", message, matcher.missingIndex) } - if matcher.extraIndex > 0 { + if matcher.extraIndex >= 0 { message = fmt.Sprintf("%s\nthe extra elements start from index %d", message, matcher.extraIndex) } if len(matcher.mismatchFailures) != 0 { @@ -131,6 +131,7 @@ func (matcher *HaveExactElementsMatcher) NegatedFailureMessage(actual any) (mess func (matcher *HaveExactElementsMatcher) resetState() { matcher.mismatchFailures = nil - matcher.missingIndex = 0 - matcher.extraIndex = 0 + // -1 means "no missing/extra elements"; 0 is a valid starting index + matcher.missingIndex = -1 + matcher.extraIndex = -1 } diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go index 16630c18..5b27babe 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -24,31 +24,41 @@ func (matcher *HaveKeyMatcher) Match(actual any) (success bool, err error) { keyMatcher = &EqualMatcher{Expected: matcher.Key} } + // As with ContainElement, a key the key matcher accepts wins regardless of + // errors on other keys; the matcher's (last) error is only reported when + // no key matches. + var lastError error if miter.IsSeq2(actual) { - var success bool - var err error + found := false miter.IterateKV(actual, func(k, v reflect.Value) bool { - success, err = keyMatcher.Match(k.Interface()) + success, err := keyMatcher.Match(k.Interface()) if err != nil { - err = fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) - return false + lastError = err + return true } - return !success + found = success + return !found }) - return success, err - } - - keys := reflect.ValueOf(actual).MapKeys() - for i := range keys { - success, err := keyMatcher.Match(keys[i].Interface()) - if err != nil { - return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) - } - if success { + if found { return true, nil } + } else { + keys := reflect.ValueOf(actual).MapKeys() + for i := range keys { + success, err := keyMatcher.Match(keys[i].Interface()) + if err != nil { + lastError = err + continue + } + if success { + return true, nil + } + } } + if lastError != nil { + return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, lastError.Error()) + } return false, nil } diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go index 0cd70815..29410a5f 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -30,44 +30,46 @@ func (matcher *HaveKeyWithValueMatcher) Match(actual any) (success bool, err err valueMatcher = &EqualMatcher{Expected: matcher.Value} } + // As with ContainElement, an entry whose key and value both match wins + // regardless of errors on other entries; the (last) key or value matcher + // error is only reported when no entry matches. + var lastError error + entryMatches := func(k, v reflect.Value) bool { + success, err := keyMatcher.Match(k.Interface()) + if err != nil { + lastError = fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + if !success { + return false + } + success, err = valueMatcher.Match(v.Interface()) + if err != nil { + lastError = fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + return success + } + if miter.IsSeq2(actual) { - var success bool - var err error + found := false miter.IterateKV(actual, func(k, v reflect.Value) bool { - success, err = keyMatcher.Match(k.Interface()) - if err != nil { - err = fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) - return false - } - if success { - success, err = valueMatcher.Match(v.Interface()) - if err != nil { - err = fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) - return false - } - } - return !success + found = entryMatches(k, v) + return !found }) - return success, err - } - - keys := reflect.ValueOf(actual).MapKeys() - for i := range keys { - success, err := keyMatcher.Match(keys[i].Interface()) - if err != nil { - return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) + if found { + return true, nil } - if success { - actualValue := reflect.ValueOf(actual).MapIndex(keys[i]) - success, err := valueMatcher.Match(actualValue.Interface()) - if err != nil { - return false, fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) + } else { + value := reflect.ValueOf(actual) + for _, k := range value.MapKeys() { + if entryMatches(k, value.MapIndex(k)) { + return true, nil } - return success, nil } } - return false, nil + return false, lastError } func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual any) (message string) { diff --git a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go index 331f289a..96f5246f 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go @@ -4,6 +4,9 @@ import ( "bytes" "encoding/json" "fmt" + "math/big" + "strconv" + "strings" "github.com/onsi/gomega/format" ) @@ -22,14 +25,103 @@ func (matcher *MatchJSONMatcher) Match(actual any) (success bool, err error) { var aval any var eval any - // this is guarded by prettyPrint - json.Unmarshal([]byte(actualString), &aval) - json.Unmarshal([]byte(expectedString), &eval) + // prettyPrint has already checked the syntax, so decoding is not expected to fail + if aval, err = decodeJSON(actualString); err != nil { + return false, fmt.Errorf("Actual '%s' should be valid JSON, but it is not.\nUnderlying error:%s", actualString, err) + } + if eval, err = decodeJSON(expectedString); err != nil { + return false, fmt.Errorf("Expected '%s' should be valid JSON, but it is not.\nUnderlying error:%s", expectedString, err) + } var equal bool equal, matcher.firstFailurePath = deepEqual(aval, eval) return equal, nil } +// decodeJSON decodes s as json.Unmarshal would into an any, except that +// integers too large to be represented exactly by a float64 are decoded as +// canonicalJSONNumbers, so that they are compared exactly rather than after +// rounding to the nearest float64. +func decodeJSON(s string) (any, error) { + decoder := json.NewDecoder(strings.NewReader(s)) + decoder.UseNumber() + var value any + if err := decoder.Decode(&value); err != nil { + return nil, err + } + return decodeJSONNumbers(value), nil +} + +func decodeJSONNumbers(value any) any { + switch v := value.(type) { + case []any: + for i, element := range v { + v[i] = decodeJSONNumbers(element) + } + case map[string]any: + for key, element := range v { + v[key] = decodeJSONNumbers(element) + } + case json.Number: + return decodeJSONNumber(v) + } + return value +} + +// canonicalJSONNumber is a JSON number written as its significant digits +// followed by a base-10 exponent, e.g. 12345678901234567890 and +// 1.234567890123456789e19 are both 123456789012345678900e1. Two JSON numbers +// have the same value exactly when they have the same canonical form. +type canonicalJSONNumber string + +// maxExactFloat64Integer is 2^53: every integer with a magnitude no greater +// than this is represented exactly by a float64. +var maxExactFloat64Integer = new(big.Int).Lsh(big.NewInt(1), 53) + +// decodeJSONNumber returns integers whose magnitude exceeds 2^53 in canonical +// form, and every other number as the float64 that json.Unmarshal would +// produce. Numbers that are not integers but are too large for a float64 are +// also returned in canonical form. +func decodeJSONNumber(n json.Number) any { + s, sign := string(n), "" + if rest, negative := strings.CutPrefix(s, "-"); negative { + s, sign = rest, "-" + } + mantissa, exponentString, _ := strings.Cut(strings.ToLower(s), "e") + integerPart, fractionPart, _ := strings.Cut(mantissa, ".") + + digits := strings.TrimLeft(integerPart+fractionPart, "0") + significantDigits := strings.TrimRight(digits, "0") + + // the exponent is parsed as a big.Int as JSON puts no limit on its size + exponent := new(big.Int) + if exponentString != "" { + exponent.SetString(exponentString, 10) // the syntax has been checked by the decoder + } + exponent.Add(exponent, big.NewInt(int64(len(digits)-len(significantDigits)-len(fractionPart)))) + canonical := canonicalJSONNumber(sign + significantDigits + "e" + exponent.String()) + + if significantDigits != "" && exponent.Sign() >= 0 && exceedsMaxExactFloat64Integer(significantDigits, exponent) { + return canonical + } + f, err := strconv.ParseFloat(string(n), 64) + if err != nil { + // the syntax has been checked, so the number must be too large for a float64 + return canonical + } + return f +} + +// exceedsMaxExactFloat64Integer reports whether significantDigits * 10^exponent, +// with exponent >= 0, is greater than 2^53. +func exceedsMaxExactFloat64Integer(significantDigits string, exponent *big.Int) bool { + if exponent.Cmp(big.NewInt(16)) >= 0 { + return true // 10^16 > 2^53 + } + value, _ := new(big.Int).SetString(significantDigits, 10) + value.Mul(value, new(big.Int).Exp(big.NewInt(10), exponent, nil)) + return value.Cmp(maxExactFloat64Integer) > 0 +} + func (matcher *MatchJSONMatcher) FailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.prettyPrint(actual) return formattedMessage(format.Message(actualString, "to match JSON of", expectedString), matcher.firstFailurePath) diff --git a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go index f7dcaf6f..86bf2f2d 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go @@ -83,9 +83,9 @@ func parseXmlContent(content string) (*xmlNode, error) { switch tok := tok.(type) { case xml.StartElement: - attrs := attributesSlice(tok.Attr) + attrs := withNormalizedNamespaceDeclarations(tok.Attr) sort.Sort(attrs) - allNodes = append(allNodes, &xmlNode{XMLName: tok.Name, XMLAttr: tok.Attr}) + allNodes = append(allNodes, &xmlNode{XMLName: tok.Name, XMLAttr: attrs}) case xml.EndElement: if len(allNodes) > 1 { allNodes[lastNodeIndex-1].Nodes = append(allNodes[lastNodeIndex-1].Nodes, lastNode) @@ -109,6 +109,22 @@ func parseXmlContent(content string) (*xmlNode, error) { return firstNode, nil } +// withNormalizedNamespaceDeclarations replaces the name of each xmlns="..." and +// xmlns:prefix="..." attribute with the same placeholder name, so that only the +// namespace URIs declared on the element are compared, not the prefixes bound +// to them. The decoder has already resolved element and attribute names to +// namespace URIs, so the prefixes play no other part in the comparison. +func withNormalizedNamespaceDeclarations(attrs []xml.Attr) attributesSlice { + normalized := make(attributesSlice, len(attrs)) + for i, attr := range attrs { + if attr.Name.Space == "xmlns" || (attr.Name.Space == "" && attr.Name.Local == "xmlns") { + attr.Name = xml.Name{Space: "xmlns"} + } + normalized[i] = attr + } + return normalized +} + func newXmlDecoder(reader io.Reader) *xml.Decoder { dec := xml.NewDecoder(reader) dec.CharsetReader = charset.NewReaderLabel diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go index c3da9bd4..a6c558d9 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go @@ -1,7 +1,9 @@ package matchers import ( + "errors" "fmt" + "io" "strings" "github.com/onsi/gomega/format" @@ -11,37 +13,60 @@ import ( type MatchYAMLMatcher struct { YAMLToMatch any firstFailurePath []any + // the 1-based number of the first mismatched document when comparing + // multi-document streams; 0 otherwise + firstFailureDocument int } func (matcher *MatchYAMLMatcher) Match(actual any) (success bool, err error) { + matcher.firstFailurePath = nil + matcher.firstFailureDocument = 0 + actualString, expectedString, err := matcher.toStrings(actual) if err != nil { return false, err } - var aval any - var eval any - - if err := yaml.Unmarshal([]byte(actualString), &aval); err != nil { + adocs, err := decodeYAMLDocuments(actualString) + if err != nil { return false, fmt.Errorf("Actual '%s' should be valid YAML, but it is not.\nUnderlying error:%s", actualString, err) } - if err := yaml.Unmarshal([]byte(expectedString), &eval); err != nil { + edocs, err := decodeYAMLDocuments(expectedString) + if err != nil { return false, fmt.Errorf("Expected '%s' should be valid YAML, but it is not.\nUnderlying error:%s", expectedString, err) } - var equal bool - equal, matcher.firstFailurePath = deepEqual(aval, eval) - return equal, nil + if len(adocs) != len(edocs) { + return false, nil + } + for i := range adocs { + var equal bool + equal, matcher.firstFailurePath = deepEqual(adocs[i], edocs[i]) + if !equal { + if len(adocs) > 1 { + matcher.firstFailureDocument = i + 1 + } + return false, nil + } + } + return true, nil } func (matcher *MatchYAMLMatcher) FailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.toNormalisedStrings(actual) - return formattedMessage(format.Message(actualString, "to match YAML of", expectedString), matcher.firstFailurePath) + return matcher.formattedMessage(format.Message(actualString, "to match YAML of", expectedString)) } func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.toNormalisedStrings(actual) - return formattedMessage(format.Message(actualString, "not to match YAML of", expectedString), matcher.firstFailurePath) + return matcher.formattedMessage(format.Message(actualString, "not to match YAML of", expectedString)) +} + +func (matcher *MatchYAMLMatcher) formattedMessage(comparisonMessage string) string { + if matcher.firstFailureDocument > 0 { + comparisonMessage = fmt.Sprintf("%s\n\nfirst mismatched document: %d (counting from 1)", comparisonMessage, matcher.firstFailureDocument) + } + return formattedMessage(comparisonMessage, matcher.firstFailurePath) } func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual any) (actualFormatted, expectedFormatted string, err error) { @@ -50,16 +75,63 @@ func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual any) (actualFormatte } func normalise(input string) string { - var val any - err := yaml.Unmarshal([]byte(input), &val) + docs, err := decodeYAMLDocuments(input) if err != nil { - panic(err) // unreachable since Match already calls Unmarshal + panic(err) // unreachable since Match already decodes the input } - output, err := yaml.Marshal(val) - if err != nil { - panic(err) // untested section, unreachable since we Unmarshal above + outputs := make([]string, len(docs)) + for i, doc := range docs { + output, err := yaml.Marshal(doc) + if err != nil { + panic(err) // untested section, unreachable since we decode above + } + outputs[i] = string(output) + } + return strings.TrimSpace(strings.Join(outputs, "---\n")) +} + +// decodeYAMLDocuments decodes every document in a YAML stream. +// +// Empty documents - such as those produced by a leading or trailing "---" - are +// skipped, so "---\na: 1\n---\n" is the single document "a: 1". A stream with +// no documents at all is treated as a single null document, as yaml.Unmarshal +// does. +func decodeYAMLDocuments(input string) ([]any, error) { + docs := []any{} + decoder := yaml.NewDecoder(strings.NewReader(input)) + for { + var node yaml.Node + err := decoder.Decode(&node) + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return nil, err + } + if isEmptyYAMLDocument(&node) { + continue + } + var doc any + if err := node.Decode(&doc); err != nil { + return nil, err + } + docs = append(docs, doc) + } + if len(docs) == 0 { + docs = append(docs, nil) + } + return docs, nil +} + +// isEmptyYAMLDocument reports whether a document has no content at all. +// Explicit nulls (e.g. "~" or "null") are content. +func isEmptyYAMLDocument(document *yaml.Node) bool { + if len(document.Content) != 1 { + return false } - return strings.TrimSpace(string(output)) + content := document.Content[0] + return content.Kind == yaml.ScalarNode && content.ShortTag() == "!!null" && content.Value == "" && + content.Style == 0 && content.Anchor == "" } func (matcher *MatchYAMLMatcher) toStrings(actual any) (actualFormatted, expectedFormatted string, err error) { diff --git a/vendor/github.com/onsi/gomega/matchers/type_support.go b/vendor/github.com/onsi/gomega/matchers/type_support.go index d020dedc..89056f44 100644 --- a/vendor/github.com/onsi/gomega/matchers/type_support.go +++ b/vendor/github.com/onsi/gomega/matchers/type_support.go @@ -14,6 +14,7 @@ package matchers import ( "encoding/json" "fmt" + "math/big" "reflect" "github.com/onsi/gomega/matchers/internal/miter" @@ -52,26 +53,11 @@ func isFloat(a any) bool { return reflect.Float32 <= kind && kind <= reflect.Float64 } -func toInteger(a any) int64 { +func toBigInt(a any) *big.Int { if isInteger(a) { - return reflect.ValueOf(a).Int() - } else if isUnsignedInteger(a) { - return int64(reflect.ValueOf(a).Uint()) - } else if isFloat(a) { - return int64(reflect.ValueOf(a).Float()) - } - panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) -} - -func toUnsignedInteger(a any) uint64 { - if isInteger(a) { - return uint64(reflect.ValueOf(a).Int()) - } else if isUnsignedInteger(a) { - return reflect.ValueOf(a).Uint() - } else if isFloat(a) { - return uint64(reflect.ValueOf(a).Float()) + return big.NewInt(reflect.ValueOf(a).Int()) } - panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) + return new(big.Int).SetUint64(reflect.ValueOf(a).Uint()) } func toFloat(a any) float64 { diff --git a/vendor/modules.txt b/vendor/modules.txt index 09e539b1..b562b69c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,11 +1,11 @@ -# code.cloudfoundry.org/bbs/encryption v1.14.0 +# code.cloudfoundry.org/bbs/encryption v1.16.0 ## explicit; go 1.26.2 code.cloudfoundry.org/bbs/encryption code.cloudfoundry.org/bbs/encryption/encryptionfakes -# code.cloudfoundry.org/bbs/format v1.12.0 +# code.cloudfoundry.org/bbs/format v1.13.0 ## explicit; go 1.26.2 code.cloudfoundry.org/bbs/format -# code.cloudfoundry.org/bbs/models v1.13.0 +# code.cloudfoundry.org/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1 => github.com/rkoster/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1 ## explicit; go 1.26.2 code.cloudfoundry.org/bbs/models code.cloudfoundry.org/bbs/models/test/matchers @@ -44,7 +44,7 @@ code.cloudfoundry.org/go-loggregator/v9/runtimeemitter # code.cloudfoundry.org/inigo v0.0.0-20250908175034-b7230e46c815 ## explicit code.cloudfoundry.org/inigo/helpers/portauthority -# code.cloudfoundry.org/lager/v3 v3.87.0 +# code.cloudfoundry.org/lager/v3 v3.88.0 ## explicit; go 1.26.0 code.cloudfoundry.org/lager/v3 code.cloudfoundry.org/lager/v3/internal/truncate @@ -114,7 +114,7 @@ github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/google/pprof v0.0.0-20260906184651-6331bc6350fe +# github.com/google/pprof v0.0.0-20260926063103-aaccee046517 ## explicit; go 1.25.0 github.com/google/pprof/profile # github.com/jackc/pgpassfile v1.0.0 @@ -169,7 +169,7 @@ github.com/onsi/ginkgo/v2/internal/reporters github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/types -# github.com/onsi/gomega v1.43.1 +# github.com/onsi/gomega v1.44.0 ## explicit; go 1.25.0 github.com/onsi/gomega github.com/onsi/gomega/format @@ -419,3 +419,4 @@ google.golang.org/protobuf/types/known/anypb google.golang.org/protobuf/types/known/durationpb google.golang.org/protobuf/types/known/timestamppb # github.com/tedsuo/ifrit => github.com/tedsuo/ifrit v0.0.0-20260418191334-846868129986 +# code.cloudfoundry.org/bbs/models => github.com/rkoster/bbs/models v1.15.1-0.20261119082436-7fc64d1d37a1