Skip to content

Commit

Permalink
Refactor SPIFFE from pkg/security to kit (dapr#7669)
Browse files Browse the repository at this point in the history
* Refactor SPIFFE from `pkg/security` to `kit`

Updates the `pkg/security` package to move the SPIFFE implementation to
a new kit package. This new kit package is more modulated and fuller
test coverage. This package has been moved so that it can be both
imported by dapr & components-contrib, as well as making the package
more suitable for further development to support X.509 Component auth.

dapr/proposals#51

Also moves in test/utils from dapr to crypto/test for shared usage.

Part of dapr/proposals#51

Uses go mod fork of dapr/kit#92

Signed-off-by: joshvanl <[email protected]>

* Include SVID context with `Init`ing Component

Signed-off-by: joshvanl <[email protected]>

* Adds security to processor options

Signed-off-by: joshvanl <[email protected]>

* Update github.com/dapr/dapr to master

Signed-off-by: joshvanl <[email protected]>

* Update `util` to new `test` package import

Signed-off-by: joshvanl <[email protected]>

* Update go.sum

Signed-off-by: joshvanl <[email protected]>

---------

Signed-off-by: joshvanl <[email protected]>
  • Loading branch information
JoshVanL authored and cicoyle committed May 24, 2024
1 parent 06acc7c commit b9adbf2
Show file tree
Hide file tree
Showing 37 changed files with 429 additions and 1,336 deletions.
4 changes: 2 additions & 2 deletions cmd/injector/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func Run() {
SentryAddress: cfg.SentryAddress,
ControlPlaneTrustDomain: cfg.ControlPlaneTrustDomain,
ControlPlaneNamespace: namespace,
TrustAnchorsFile: cfg.TrustAnchorsFile,
TrustAnchorsFile: &cfg.TrustAnchorsFile,
AppID: "dapr-injector",
MTLSEnabled: true,
Mode: modes.KubernetesMode,
Expand Down Expand Up @@ -165,7 +165,7 @@ func Run() {
return rerr
}

caBundle, rErr := sec.CurrentTrustAnchors()
caBundle, rErr := sec.CurrentTrustAnchors(ctx)
if rErr != nil {
return rErr
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/placement/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func Run() {
SentryAddress: opts.SentryAddress,
ControlPlaneTrustDomain: opts.TrustDomain,
ControlPlaneNamespace: security.CurrentNamespace(),
TrustAnchorsFile: opts.TrustAnchorsFile,
TrustAnchorsFile: &opts.TrustAnchorsFile,
AppID: "dapr-placement",
MTLSEnabled: opts.TLSEnabled,
Mode: modes.DaprMode(opts.Mode),
Expand Down
32 changes: 14 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/cloudevents/sdk-go/v2 v2.14.0
github.com/dapr/components-contrib v1.13.0-rc.2.0.20240503231149-1f46231d875c
github.com/dapr/kit v0.13.1-0.20240415171926-a3f906d60908
github.com/diagridio/go-etcd-cron v0.0.0-20240513144201-9d76b648b787
github.com/diagridio/go-etcd-cron v0.0.0-20240521170733-c7c1a7109a7b
github.com/evanphx/json-patch/v5 v5.8.1
github.com/go-chi/chi/v5 v5.0.11
github.com/go-chi/cors v1.2.1
Expand Down Expand Up @@ -67,10 +67,9 @@ require (
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/net v0.24.0
golang.org/x/sync v0.6.0
google.golang.org/genproto/googleapis/api v0.0.0-20240304212257-790db918fca8
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8
google.golang.org/grpc v1.62.1
google.golang.org/grpc/examples v0.0.0-20230224211313-3775f633ce20
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.28.4
Expand All @@ -88,14 +87,14 @@ require (
)

require (
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go v0.110.10 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/datastore v1.15.0 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/pubsub v1.34.0 // indirect
cloud.google.com/go/pubsub v1.33.0 // indirect
cloud.google.com/go/secretmanager v1.11.4 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
cloud.google.com/go/storage v1.33.0 // indirect
dubbo.apache.org/dubbo-go/v3 v3.0.3-0.20230118042253-4f159a2b38f3 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
Expand Down Expand Up @@ -212,7 +211,6 @@ require (
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/fasthttp-contrib/sessions v0.0.0-20160905201309-74f6ac73d5d5 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
github.com/go-errors/errors v1.4.2 // indirect
Expand Down Expand Up @@ -410,26 +408,27 @@ require (
go.etcd.io/etcd/client/v2 v2.305.13 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.13 // indirect
go.etcd.io/etcd/raft/v3 v3.5.13 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/api v0.155.0 // indirect
google.golang.org/api v0.149.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/grpc/examples v0.0.0-20230224211313-3775f633ce20 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/couchbase/gocb.v1 v1.6.7 // indirect
gopkg.in/couchbase/gocbcore.v7 v7.1.18 // indirect
Expand Down Expand Up @@ -482,9 +481,6 @@ replace (
// check for retracted versions: go list -mod=mod -f '{{if .Retracted}}{{.}}{{end}}' -u -m all
replace github.com/microcosm-cc/bluemonday => github.com/microcosm-cc/bluemonday v1.0.24

// Needed due to a deprecated method used in functional tests
replace github.com/stretchr/testify => github.com/stretchr/testify v1.8.4

// Uncomment for local development for testing with changes in the components-contrib && kit repositories.
// Don't commit with this uncommented!
//
Expand Down
Loading

0 comments on commit b9adbf2

Please sign in to comment.