Skip to content

Commit 0693b8a

Browse files
committed
chore: fix linter
1 parent cc41d75 commit 0693b8a

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

driver/configuration/provider_koanf_public_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/rs/cors"
1414
"github.com/stretchr/testify/assert"
1515
"github.com/stretchr/testify/require"
16-
"go.opentelemetry.io/otel/trace"
16+
"go.opentelemetry.io/otel/trace/noop"
1717

1818
"github.com/ory/x/configx"
1919
"github.com/ory/x/logrusx"
@@ -248,7 +248,7 @@ func TestKoanfProvider(t *testing.T) {
248248
})
249249

250250
t.Run("authenticator=cookie_session", func(t *testing.T) {
251-
a := authn.NewAuthenticatorCookieSession(p, logger, trace.NewNoopTracerProvider())
251+
a := authn.NewAuthenticatorCookieSession(p, logger, noop.NewTracerProvider())
252252
assert.True(t, p.AuthenticatorIsEnabled(a.GetID()))
253253
require.NoError(t, a.Validate(nil))
254254

@@ -286,7 +286,7 @@ func TestKoanfProvider(t *testing.T) {
286286
})
287287

288288
t.Run("authenticator=oauth2_introspection", func(t *testing.T) {
289-
a := authn.NewAuthenticatorOAuth2Introspection(p, logger, trace.NewNoopTracerProvider())
289+
a := authn.NewAuthenticatorOAuth2Introspection(p, logger, noop.NewTracerProvider())
290290
assert.True(t, p.AuthenticatorIsEnabled(a.GetID()))
291291
require.NoError(t, a.Validate(nil))
292292

@@ -434,7 +434,7 @@ func TestAuthenticatorOAuth2TokenIntrospectionPreAuthorization(t *testing.T) {
434434
{enabled: true, id: "a", secret: "b", turl: "https://some-url", err: false},
435435
} {
436436
t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) {
437-
a := authn.NewAuthenticatorOAuth2Introspection(p, logrusx.New("", ""), trace.NewNoopTracerProvider())
437+
a := authn.NewAuthenticatorOAuth2Introspection(p, logrusx.New("", ""), noop.NewTracerProvider())
438438

439439
config, _, err := a.Config(json.RawMessage(fmt.Sprintf(`{
440440
"pre_authorization": {

pipeline/authn/authenticator_cookie_session.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package authn
55

66
import (
7-
"crypto/md5"
7+
"crypto/md5" //#nosec G501 -- MD5 is used for cache key generation, not cryptography
88
"encoding/json"
99
"fmt"
1010
"io"
@@ -189,7 +189,7 @@ func cookiesToCacheKey(cookies []*http.Cookie) string {
189189
for _, cookie := range cookies {
190190
parts = append(parts, fmt.Sprintf("%s=%s", cookie.Name, cookie.Value))
191191
}
192-
return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(parts, "|"))))
192+
return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(parts, "|")))) //#nosec G401 -- MD5 is used for cache key generation, not cryptography
193193
}
194194

195195
type cachedSessionData struct {

pipeline/authn/authenticator_cookie_session_cache_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
14-
"go.opentelemetry.io/otel/trace"
14+
"go.opentelemetry.io/otel/trace/noop"
1515

1616
"github.com/ory/oathkeeper/driver/configuration"
1717
"github.com/ory/x/configx"
@@ -31,7 +31,7 @@ func TestCookieSessionCache(t *testing.T) {
3131
}))
3232
require.NoError(t, err)
3333

34-
a := NewAuthenticatorCookieSession(c, logger, trace.NewNoopTracerProvider())
34+
a := NewAuthenticatorCookieSession(c, logger, noop.NewTracerProvider())
3535
assert.Equal(t, "cookie_session", a.GetID())
3636

3737
config, err := a.Config(nil)
@@ -50,7 +50,6 @@ func TestCookieSessionCache(t *testing.T) {
5050
a.sessionToCache(config, req, subject, extra)
5151
time.Sleep(time.Millisecond * 10)
5252

53-
subject = "modified-subject"
5453
v := a.sessionFromCache(config, req)
5554
require.NotNil(t, v)
5655
require.Equal(t, "test-subject", v.Subject)

0 commit comments

Comments
 (0)