Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down
30 changes: 30 additions & 0 deletions handlers/desired_lrp_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 31 additions & 0 deletions handlers/task_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handlers_test

import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -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)
Expand Down
Loading