Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade ristretto to use generics #1195

Merged
merged 1 commit into from
Nov 4, 2024
Merged
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
8 changes: 4 additions & 4 deletions driver/configuration/provider_koanf.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type (
l *logrusx.Logger
ctx context.Context

configValidationCache *ristretto.Cache
configValidationCache *ristretto.Cache[string, bool]

subscriptions subscriptions
}
Expand All @@ -60,13 +60,13 @@ var _ Provider = new(KoanfProvider)

func NewKoanfProvider(ctx context.Context, flags *pflag.FlagSet, l *logrusx.Logger, opts ...configx.OptionModifier) (kp *KoanfProvider, err error) {
maxItems := int64(5000)
cache, _ := ristretto.NewCache(&ristretto.Config{
cache, _ := ristretto.NewCache(&ristretto.Config[string, bool]{
NumCounters: maxItems * 10,
MaxCost: maxItems,
BufferItems: 64,
Metrics: false,
IgnoreInternalCost: true,
Cost: func(value interface{}) int64 {
Cost: func(value bool) int64 {
return 1
},
})
Expand Down Expand Up @@ -323,7 +323,7 @@ func (v *KoanfProvider) PipelineConfig(prefix, id string, override json.RawMessa

hash := v.hashPipelineConfig(prefix, id, marshalled)
item, found := v.configValidationCache.Get(hash)
if !found || !item.(bool) {
if !found || !item {
if err = v.validatePipelineConfig(prefix, id, marshalled); err != nil {
return errors.WithStack(err)
}
Expand Down
90 changes: 49 additions & 41 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ module github.com/ory/oathkeeper

replace github.com/mattn/go-sqlite3 => github.com/mattn/go-sqlite3 v1.14.10

// Bump Fosite to https://github.com/ory/fosite/tree/hperl/v0.47.0%2B168636f, which contains
// https://github.com/ory/fosite/commit/b40b1cbb1997e2160eaaf97fb6f73960db4c6118 and https://github.com/ory/fosite/pull/833/commits/eab241e153a4c97abe2e4c6e654f20b9ae206473 on top of the latest release.
//
// This is needed until we release the next version of the master branch, as that branch already contains the redirect URI validation fix, which
// may be breaking for some users.
replace github.com/ory/fosite => github.com/ory/fosite v0.47.1-0.20241101073333-eab241e153a4

require (
github.com/Azure/azure-pipeline-go v0.2.2
github.com/Azure/azure-storage-blob-go v0.9.0
github.com/Masterminds/sprig/v3 v3.2.2
github.com/auth0/go-jwt-middleware/v2 v2.2.2
github.com/aws/aws-sdk-go v1.34.28
github.com/blang/semver v3.5.1+incompatible
github.com/dgraph-io/ristretto v0.1.1
github.com/dgraph-io/ristretto v1.0.0
github.com/dlclark/regexp2 v1.2.0
github.com/ghodss/yaml v1.0.0
github.com/go-faker/faker/v4 v4.0.0-beta.2
Expand All @@ -23,7 +30,7 @@ require (
github.com/go-openapi/strfmt v0.21.3
github.com/go-openapi/swag v0.22.3
github.com/go-openapi/validate v0.22.0
github.com/go-sql-driver/mysql v1.7.0
github.com/go-sql-driver/mysql v1.8.1
github.com/go-swagger/go-swagger v0.30.0
github.com/gobuffalo/httptest v1.5.2
github.com/gobwas/glob v0.2.3
Expand All @@ -35,23 +42,22 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/julienschmidt/httprouter v1.3.0
github.com/knadh/koanf/v2 v2.0.1
github.com/lib/pq v1.10.7
github.com/lib/pq v1.10.9
github.com/mitchellh/copystructure v1.2.0
github.com/ory/analytics-go/v5 v5.0.1
github.com/ory/fosite v0.47.0
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe
github.com/ory/gojsonschema v1.2.0
github.com/ory/graceful v0.1.1
github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88
github.com/ory/jsonschema/v3 v3.0.7
github.com/ory/jsonschema/v3 v3.0.8
github.com/ory/ladon v1.1.0
github.com/ory/viper v1.7.5
github.com/ory/x v0.0.605
github.com/ory/x v0.0.666
github.com/pborman/uuid v1.2.1
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.13.0
github.com/rs/cors v1.8.2
github.com/rs/cors v1.11.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand All @@ -60,9 +66,9 @@ require (
github.com/tidwall/sjson v1.2.5
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
github.com/urfave/negroni v1.0.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
go.opentelemetry.io/otel v1.21.0
go.opentelemetry.io/otel/trace v1.21.0
gocloud.dev v0.20.0
golang.org/x/crypto v0.24.0
golang.org/x/oauth2 v0.14.0
Expand All @@ -77,28 +83,30 @@ require (
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
code.dny.dev/ssrf v0.2.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-autorest/autorest v0.11.1 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/avast/retry-go/v4 v4.3.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/cockroach-go/v2 v2.2.16 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/cockroach-go/v2 v2.3.5 // indirect
github.com/containerd/continuity v0.4.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/docker/cli v20.10.21+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v20.10.24+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v26.1.4+incompatible // indirect
github.com/docker/docker v26.1.4+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
Expand All @@ -117,20 +125,19 @@ require (
github.com/go-openapi/spec v0.20.7 // indirect
github.com/gobuffalo/envy v1.10.2 // indirect
github.com/gobuffalo/fizz v1.14.4 // indirect
github.com/gobuffalo/flect v0.3.0 // indirect
github.com/gobuffalo/flect v1.0.0 // indirect
github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect
github.com/gobuffalo/helpers v0.6.7 // indirect
github.com/gobuffalo/nulls v0.4.2 // indirect
github.com/gobuffalo/plush/v4 v4.1.16 // indirect
github.com/gobuffalo/pop/v6 v6.0.8 // indirect
github.com/gobuffalo/plush/v4 v4.1.18 // indirect
github.com/gobuffalo/pop/v6 v6.1.1 // indirect
github.com/gobuffalo/tags/v3 v3.1.4 // indirect
github.com/gobuffalo/validate/v3 v3.3.3 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/goccy/go-yaml v1.9.6 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gofrs/uuid v4.3.0+incompatible // indirect
github.com/gofrs/uuid v4.3.1+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/martian/v3 v3.3.3-0.20220816151257-0f7e6797a04d // indirect
Expand Down Expand Up @@ -188,19 +195,20 @@ require (
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/mattn/goveralls v0.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/microcosm-cc/bluemonday v1.0.21 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/nyaruka/phonenumbers v1.1.1 // indirect
github.com/nyaruka/phonenumbers v1.1.6 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.14 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/ory/dockertest/v3 v3.9.1 // indirect
github.com/ory/dockertest/v3 v3.10.1-0.20240704115616-d229e74b748d // indirect
github.com/ory/go-convenience v0.1.0 // indirect
github.com/ory/gojsonreference v0.0.0-20190720135523-6b606c2d8ee8 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
Expand Down Expand Up @@ -233,22 +241,22 @@ require (
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
go.mongodb.org/mongo-driver v1.10.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.45.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.20.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.20.0 // indirect
go.opentelemetry.io/contrib/samplers/jaegerremote v0.14.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.21.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.21.1 // indirect
go.opentelemetry.io/contrib/samplers/jaegerremote v0.15.1 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
Expand Down
Loading
Loading