Skip to content
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
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ linters:
- testpackage
- goconst
- exhaustruct
- exhaustruct_v5
- ireturn
- gomodguard
exclusions:
rules:
- path: '(.+)_test\.go'
Expand All @@ -19,6 +21,7 @@ linters:
- gochecknoglobals
- lll
- varnamelen
- gosec
- linters:
- funlen
text: "Function 'UnmarshalCaddyfile' has too many statements"
Expand Down
3 changes: 2 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
golangci-lint 2.8.0
golangci-lint 2.15.0

4 changes: 4 additions & 0 deletions authenticator/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ func (au *SessionCookieAuthenticator) AuthenticateRequest(cfg OIDCConfiguration,
}

func (au *SessionCookieAuthenticator) NewCookie(value string) *http.Cookie {
//nolint:gosec // cookie parameters are not client controlled
cookie := &http.Cookie{
Name: au.Name,
Value: value,
Expand Down Expand Up @@ -408,6 +409,7 @@ func (au *SessionCookieAuthenticator) StartLogin(cfg OAuthAuthorizationFlowConfi
return err
}

//nolint:gosec
csrfCookie := au.NewCookie(csrfCookieValue)
csrfCookie.Name = csrfCookieName
csrfCookie.MaxAge = 900 // 15-minute short expiry time for the CSRF cookie
Expand All @@ -422,6 +424,7 @@ func (au *SessionCookieAuthenticator) StartLogin(cfg OAuthAuthorizationFlowConfi
return err
}

//nolint:gosec
http.Redirect(rw, r, authCodeURL, http.StatusFound)

return nil
Expand All @@ -438,6 +441,7 @@ func (au *SessionCookieAuthenticator) handleCallbackParseCSRFCookie(rw http.Resp
}

// Delete CSRF cookie
//nolint:gosec
deleteCsrfCookie := au.NewCookie("")
deleteCsrfCookie.Name = csrfCookieName
deleteCsrfCookie.MaxAge = -1
Expand Down
1 change: 0 additions & 1 deletion authenticator/cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ func newTestUserInfo(t *testing.T, claims string) *oidc.UserInfo {
claimsField := reflect.ValueOf(userInfo).Elem().FieldByName("claims")
require.True(t, claimsField.IsValid())

//nolint:gosec // This is only used for testing
reflect.NewAt(claimsField.Type(), unsafe.Pointer(claimsField.UnsafeAddr())).
Elem().
SetBytes([]byte(claims))
Expand Down
2 changes: 1 addition & 1 deletion internal/baseline/baseline.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func isByReferenceMutable(t reflect.Type) bool {
return t.Kind() == reflect.Ptr || t.Kind() == reflect.Interface || t.Kind() == reflect.Map || t.Kind() == reflect.Slice
return t.Kind() == reflect.Pointer || t.Kind() == reflect.Interface || t.Kind() == reflect.Map || t.Kind() == reflect.Slice
}

// Apply applies a baseline to the destination struct.
Expand Down
1 change: 1 addition & 0 deletions internal/pkgtest/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// NewRequest returns a new http.Request with a context containing an empty replacer.
func NewRequest(method, target string, body io.Reader) *http.Request {
//nolint:noctx
r := httptest.NewRequest(method, target, body)
r = r.WithContext(context.WithValue(r.Context(), caddy.ReplacerCtxKey, caddy.NewEmptyReplacer()))

Expand Down
Loading