Skip to content

Commit 98f8a00

Browse files
authored
chore: upgrade ristretto to use generics (#1195)
1 parent f0c8650 commit 98f8a00

File tree

8 files changed

+165
-315
lines changed

8 files changed

+165
-315
lines changed

driver/configuration/provider_koanf.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type (
4343
l *logrusx.Logger
4444
ctx context.Context
4545

46-
configValidationCache *ristretto.Cache
46+
configValidationCache *ristretto.Cache[string, bool]
4747

4848
subscriptions subscriptions
4949
}
@@ -60,13 +60,13 @@ var _ Provider = new(KoanfProvider)
6060

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

324324
hash := v.hashPipelineConfig(prefix, id, marshalled)
325325
item, found := v.configValidationCache.Get(hash)
326-
if !found || !item.(bool) {
326+
if !found || !item {
327327
if err = v.validatePipelineConfig(prefix, id, marshalled); err != nil {
328328
return errors.WithStack(err)
329329
}

go.mod

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ module github.com/ory/oathkeeper
66

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

9+
// Bump Fosite to https://github.com/ory/fosite/tree/hperl/v0.47.0%2B168636f, which contains
10+
// https://github.com/ory/fosite/commit/b40b1cbb1997e2160eaaf97fb6f73960db4c6118 and https://github.com/ory/fosite/pull/833/commits/eab241e153a4c97abe2e4c6e654f20b9ae206473 on top of the latest release.
11+
//
12+
// This is needed until we release the next version of the master branch, as that branch already contains the redirect URI validation fix, which
13+
// may be breaking for some users.
14+
replace github.com/ory/fosite => github.com/ory/fosite v0.47.1-0.20241101073333-eab241e153a4
15+
916
require (
1017
github.com/Azure/azure-pipeline-go v0.2.2
1118
github.com/Azure/azure-storage-blob-go v0.9.0
1219
github.com/Masterminds/sprig/v3 v3.2.2
1320
github.com/auth0/go-jwt-middleware/v2 v2.2.2
1421
github.com/aws/aws-sdk-go v1.34.28
1522
github.com/blang/semver v3.5.1+incompatible
16-
github.com/dgraph-io/ristretto v0.1.1
23+
github.com/dgraph-io/ristretto v1.0.0
1724
github.com/dlclark/regexp2 v1.2.0
1825
github.com/ghodss/yaml v1.0.0
1926
github.com/go-faker/faker/v4 v4.0.0-beta.2
@@ -23,7 +30,7 @@ require (
2330
github.com/go-openapi/strfmt v0.21.3
2431
github.com/go-openapi/swag v0.22.3
2532
github.com/go-openapi/validate v0.22.0
26-
github.com/go-sql-driver/mysql v1.7.0
33+
github.com/go-sql-driver/mysql v1.8.1
2734
github.com/go-swagger/go-swagger v0.30.0
2835
github.com/gobuffalo/httptest v1.5.2
2936
github.com/gobwas/glob v0.2.3
@@ -35,23 +42,22 @@ require (
3542
github.com/hashicorp/go-retryablehttp v0.7.7
3643
github.com/julienschmidt/httprouter v1.3.0
3744
github.com/knadh/koanf/v2 v2.0.1
38-
github.com/lib/pq v1.10.7
45+
github.com/lib/pq v1.10.9
3946
github.com/mitchellh/copystructure v1.2.0
4047
github.com/ory/analytics-go/v5 v5.0.1
4148
github.com/ory/fosite v0.47.0
4249
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe
4350
github.com/ory/gojsonschema v1.2.0
4451
github.com/ory/graceful v0.1.1
4552
github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88
46-
github.com/ory/jsonschema/v3 v3.0.7
53+
github.com/ory/jsonschema/v3 v3.0.8
4754
github.com/ory/ladon v1.1.0
48-
github.com/ory/viper v1.7.5
49-
github.com/ory/x v0.0.605
55+
github.com/ory/x v0.0.666
5056
github.com/pborman/uuid v1.2.1
5157
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
5258
github.com/pkg/errors v0.9.1
5359
github.com/prometheus/client_golang v1.13.0
54-
github.com/rs/cors v1.8.2
60+
github.com/rs/cors v1.11.0
5561
github.com/sirupsen/logrus v1.9.3
5662
github.com/spf13/cobra v1.7.0
5763
github.com/spf13/pflag v1.0.5
@@ -60,9 +66,9 @@ require (
6066
github.com/tidwall/sjson v1.2.5
6167
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
6268
github.com/urfave/negroni v1.0.0
63-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0
64-
go.opentelemetry.io/otel v1.19.0
65-
go.opentelemetry.io/otel/trace v1.19.0
69+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
70+
go.opentelemetry.io/otel v1.21.0
71+
go.opentelemetry.io/otel/trace v1.21.0
6672
gocloud.dev v0.20.0
6773
golang.org/x/crypto v0.24.0
6874
golang.org/x/oauth2 v0.14.0
@@ -77,28 +83,30 @@ require (
7783
cloud.google.com/go/iam v1.1.5 // indirect
7884
cloud.google.com/go/storage v1.30.1 // indirect
7985
code.dny.dev/ssrf v0.2.0 // indirect
80-
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
86+
dario.cat/mergo v1.0.0 // indirect
87+
filippo.io/edwards25519 v1.1.0 // indirect
88+
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
8189
github.com/Azure/go-autorest/autorest v0.11.1 // indirect
8290
github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect
8391
github.com/Masterminds/goutils v1.1.1 // indirect
8492
github.com/Masterminds/semver/v3 v3.1.1 // indirect
85-
github.com/Microsoft/go-winio v0.6.0 // indirect
93+
github.com/Microsoft/go-winio v0.6.2 // indirect
8694
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
8795
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
8896
github.com/avast/retry-go/v4 v4.3.0 // indirect
8997
github.com/aymerick/douceur v0.2.0 // indirect
9098
github.com/beorn7/perks v1.0.1 // indirect
91-
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
92-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
93-
github.com/cockroachdb/cockroach-go/v2 v2.2.16 // indirect
94-
github.com/containerd/continuity v0.3.0 // indirect
99+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
100+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
101+
github.com/cockroachdb/cockroach-go/v2 v2.3.5 // indirect
102+
github.com/containerd/continuity v0.4.3 // indirect
95103
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
96104
github.com/davecgh/go-spew v1.1.1 // indirect
97105
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
98-
github.com/docker/cli v20.10.21+incompatible // indirect
99-
github.com/docker/distribution v2.8.2+incompatible // indirect
100-
github.com/docker/docker v20.10.24+incompatible // indirect
101-
github.com/docker/go-connections v0.4.0 // indirect
106+
github.com/distribution/reference v0.6.0 // indirect
107+
github.com/docker/cli v26.1.4+incompatible // indirect
108+
github.com/docker/docker v26.1.4+incompatible // indirect
109+
github.com/docker/go-connections v0.5.0 // indirect
102110
github.com/docker/go-units v0.5.0 // indirect
103111
github.com/dustin/go-humanize v1.0.1 // indirect
104112
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
@@ -117,20 +125,19 @@ require (
117125
github.com/go-openapi/spec v0.20.7 // indirect
118126
github.com/gobuffalo/envy v1.10.2 // indirect
119127
github.com/gobuffalo/fizz v1.14.4 // indirect
120-
github.com/gobuffalo/flect v0.3.0 // indirect
128+
github.com/gobuffalo/flect v1.0.0 // indirect
121129
github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect
122130
github.com/gobuffalo/helpers v0.6.7 // indirect
123131
github.com/gobuffalo/nulls v0.4.2 // indirect
124-
github.com/gobuffalo/plush/v4 v4.1.16 // indirect
125-
github.com/gobuffalo/pop/v6 v6.0.8 // indirect
132+
github.com/gobuffalo/plush/v4 v4.1.18 // indirect
133+
github.com/gobuffalo/pop/v6 v6.1.1 // indirect
126134
github.com/gobuffalo/tags/v3 v3.1.4 // indirect
127135
github.com/gobuffalo/validate/v3 v3.3.3 // indirect
128136
github.com/goccy/go-json v0.10.2 // indirect
129137
github.com/goccy/go-yaml v1.9.6 // indirect
130138
github.com/gofrs/flock v0.8.1 // indirect
131-
github.com/gofrs/uuid v4.3.0+incompatible // indirect
139+
github.com/gofrs/uuid v4.3.1+incompatible // indirect
132140
github.com/gogo/protobuf v1.3.2 // indirect
133-
github.com/golang/glog v1.1.2 // indirect
134141
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
135142
github.com/golang/protobuf v1.5.3 // indirect
136143
github.com/google/martian/v3 v3.3.3-0.20220816151257-0f7e6797a04d // indirect
@@ -188,19 +195,20 @@ require (
188195
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
189196
github.com/mattn/goveralls v0.0.12 // indirect
190197
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
191-
github.com/microcosm-cc/bluemonday v1.0.21 // indirect
198+
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
192199
github.com/mitchellh/mapstructure v1.5.0 // indirect
193200
github.com/mitchellh/reflectwalk v1.0.2 // indirect
194-
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
201+
github.com/moby/docker-image-spec v1.3.1 // indirect
202+
github.com/moby/term v0.5.0 // indirect
195203
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
196-
github.com/nyaruka/phonenumbers v1.1.1 // indirect
204+
github.com/nyaruka/phonenumbers v1.1.6 // indirect
197205
github.com/oklog/ulid v1.3.1 // indirect
198206
github.com/opencontainers/go-digest v1.0.0 // indirect
199-
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
200-
github.com/opencontainers/runc v1.1.12 // indirect
207+
github.com/opencontainers/image-spec v1.1.0 // indirect
208+
github.com/opencontainers/runc v1.1.14 // indirect
201209
github.com/opentracing/opentracing-go v1.2.0 // indirect
202210
github.com/openzipkin/zipkin-go v0.4.2 // indirect
203-
github.com/ory/dockertest/v3 v3.9.1 // indirect
211+
github.com/ory/dockertest/v3 v3.10.1-0.20240704115616-d229e74b748d // indirect
204212
github.com/ory/go-convenience v0.1.0 // indirect
205213
github.com/ory/gojsonreference v0.0.0-20190720135523-6b606c2d8ee8 // indirect
206214
github.com/pelletier/go-toml v1.9.5 // indirect
@@ -233,22 +241,22 @@ require (
233241
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
234242
go.mongodb.org/mongo-driver v1.10.3 // indirect
235243
go.opencensus.io v0.24.0 // indirect
236-
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.45.0 // indirect
237-
go.opentelemetry.io/contrib/propagators/b3 v1.20.0 // indirect
238-
go.opentelemetry.io/contrib/propagators/jaeger v1.20.0 // indirect
239-
go.opentelemetry.io/contrib/samplers/jaegerremote v0.14.0 // indirect
244+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 // indirect
245+
go.opentelemetry.io/contrib/propagators/b3 v1.21.0 // indirect
246+
go.opentelemetry.io/contrib/propagators/jaeger v1.21.1 // indirect
247+
go.opentelemetry.io/contrib/samplers/jaegerremote v0.15.1 // indirect
240248
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
241-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
242-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
243-
go.opentelemetry.io/otel/exporters/zipkin v1.19.0 // indirect
244-
go.opentelemetry.io/otel/metric v1.19.0 // indirect
245-
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
249+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
250+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
251+
go.opentelemetry.io/otel/exporters/zipkin v1.21.0 // indirect
252+
go.opentelemetry.io/otel/metric v1.21.0 // indirect
253+
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
246254
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
247255
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
248256
golang.org/x/mod v0.17.0 // indirect
249257
golang.org/x/net v0.26.0 // indirect
250258
golang.org/x/sync v0.8.0 // indirect
251-
golang.org/x/sys v0.21.0 // indirect
259+
golang.org/x/sys v0.25.0 // indirect
252260
golang.org/x/text v0.16.0 // indirect
253261
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
254262
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect

0 commit comments

Comments
 (0)