Merge pull request #2144 from flant/bump-linter-version
Bump golag-ci lint version to 1.40.1
This commit is contained in:
commit
5d996661ea
@ -6,8 +6,6 @@ linters-settings:
|
|||||||
local-prefixes: github.com/dexidp/dex
|
local-prefixes: github.com/dexidp/dex
|
||||||
goimports:
|
goimports:
|
||||||
local-prefixes: github.com/dexidp/dex
|
local-prefixes: github.com/dexidp/dex
|
||||||
golint:
|
|
||||||
min-confidence: 0
|
|
||||||
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
@ -24,7 +22,6 @@ linters:
|
|||||||
- gofmt
|
- gofmt
|
||||||
- gofumpt
|
- gofumpt
|
||||||
- goimports
|
- goimports
|
||||||
- golint
|
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosimple
|
- gosimple
|
||||||
- govet
|
- govet
|
||||||
@ -33,6 +30,7 @@ linters:
|
|||||||
- nakedret
|
- nakedret
|
||||||
- nolintlint
|
- nolintlint
|
||||||
- prealloc
|
- prealloc
|
||||||
|
- revive
|
||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- sqlclosecheck
|
- sqlclosecheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
7
Makefile
7
Makefile
@ -20,7 +20,7 @@ export GOBIN=$(PWD)/bin
|
|||||||
LD_FLAGS="-w -X main.version=$(VERSION)"
|
LD_FLAGS="-w -X main.version=$(VERSION)"
|
||||||
|
|
||||||
# Dependency versions
|
# Dependency versions
|
||||||
GOLANGCI_VERSION = 1.32.2
|
GOLANGCI_VERSION = 1.40.1
|
||||||
|
|
||||||
PROTOC_VERSION = 3.15.6
|
PROTOC_VERSION = 3.15.6
|
||||||
PROTOC_GEN_GO_VERSION = 1.26.0
|
PROTOC_GEN_GO_VERSION = 1.26.0
|
||||||
@ -86,10 +86,13 @@ bin/golangci-lint-${GOLANGCI_VERSION}:
|
|||||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION}
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION}
|
||||||
@mv bin/golangci-lint $@
|
@mv bin/golangci-lint $@
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint lint-fix
|
||||||
lint: bin/golangci-lint ## Run linter
|
lint: bin/golangci-lint ## Run linter
|
||||||
bin/golangci-lint run
|
bin/golangci-lint run
|
||||||
|
|
||||||
|
lint-fix: bin/golangci-lint ## Run linter and fix issues
|
||||||
|
bin/golangci-lint run --fix
|
||||||
|
|
||||||
.PHONY: fix
|
.PHONY: fix
|
||||||
fix: bin/golangci-lint ## Fix lint violations
|
fix: bin/golangci-lint ## Fix lint violations
|
||||||
bin/golangci-lint run --fix
|
bin/golangci-lint run --fix
|
||||||
|
@ -24,8 +24,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CodeChallengeMethodPlain = "plain"
|
codeChallengeMethodPlain = "plain"
|
||||||
CodeChallengeMethodS256 = "S256"
|
codeChallengeMethodS256 = "S256"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) handlePublicKeys(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) handlePublicKeys(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -96,7 +96,7 @@ func (s *Server) discoveryHandler() (http.HandlerFunc, error) {
|
|||||||
Subjects: []string{"public"},
|
Subjects: []string{"public"},
|
||||||
GrantTypes: []string{grantTypeAuthorizationCode, grantTypeRefreshToken, grantTypeDeviceCode},
|
GrantTypes: []string{grantTypeAuthorizationCode, grantTypeRefreshToken, grantTypeDeviceCode},
|
||||||
IDTokenAlgs: []string{string(jose.RS256)},
|
IDTokenAlgs: []string{string(jose.RS256)},
|
||||||
CodeChallengeAlgs: []string{CodeChallengeMethodS256, CodeChallengeMethodPlain},
|
CodeChallengeAlgs: []string{codeChallengeMethodS256, codeChallengeMethodPlain},
|
||||||
Scopes: []string{"openid", "email", "groups", "profile", "offline_access"},
|
Scopes: []string{"openid", "email", "groups", "profile", "offline_access"},
|
||||||
AuthMethods: []string{"client_secret_basic", "client_secret_post"},
|
AuthMethods: []string{"client_secret_basic", "client_secret_post"},
|
||||||
Claims: []string{
|
Claims: []string{
|
||||||
@ -724,9 +724,9 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func (s *Server) calculateCodeChallenge(codeVerifier, codeChallengeMethod string) (string, error) {
|
func (s *Server) calculateCodeChallenge(codeVerifier, codeChallengeMethod string) (string, error) {
|
||||||
switch codeChallengeMethod {
|
switch codeChallengeMethod {
|
||||||
case CodeChallengeMethodPlain:
|
case codeChallengeMethodPlain:
|
||||||
return codeVerifier, nil
|
return codeVerifier, nil
|
||||||
case CodeChallengeMethodS256:
|
case codeChallengeMethodS256:
|
||||||
shaSum := sha256.Sum256([]byte(codeVerifier))
|
shaSum := sha256.Sum256([]byte(codeVerifier))
|
||||||
return base64.RawURLEncoding.EncodeToString(shaSum[:]), nil
|
return base64.RawURLEncoding.EncodeToString(shaSum[:]), nil
|
||||||
default:
|
default:
|
||||||
|
@ -428,7 +428,7 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques
|
|||||||
codeChallengeMethod := q.Get("code_challenge_method")
|
codeChallengeMethod := q.Get("code_challenge_method")
|
||||||
|
|
||||||
if codeChallengeMethod == "" {
|
if codeChallengeMethod == "" {
|
||||||
codeChallengeMethod = CodeChallengeMethodPlain
|
codeChallengeMethod = codeChallengeMethodPlain
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := s.storage.GetClient(clientID)
|
client, err := s.storage.GetClient(clientID)
|
||||||
@ -470,7 +470,7 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques
|
|||||||
return nil, newErr(errRequestNotSupported, "Server does not support request parameter.")
|
return nil, newErr(errRequestNotSupported, "Server does not support request parameter.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if codeChallengeMethod != CodeChallengeMethodS256 && codeChallengeMethod != CodeChallengeMethodPlain {
|
if codeChallengeMethod != codeChallengeMethodS256 && codeChallengeMethod != codeChallengeMethodPlain {
|
||||||
description := fmt.Sprintf("Unsupported PKCE challenge method (%q).", codeChallengeMethod)
|
description := fmt.Sprintf("Unsupported PKCE challenge method (%q).", codeChallengeMethod)
|
||||||
return nil, newErr(errInvalidRequest, description)
|
return nil, newErr(errInvalidRequest, description)
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func (d *Database) DeleteOfflineSessions(userID, connID string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePassword changes an offline session by user id and connector id using an updater function.
|
// UpdateOfflineSessions changes an offline session by user id and connector id using an updater function.
|
||||||
func (d *Database) UpdateOfflineSessions(userID string, connID string, updater func(s storage.OfflineSessions) (storage.OfflineSessions, error)) error {
|
func (d *Database) UpdateOfflineSessions(userID string, connID string, updater func(s storage.OfflineSessions) (storage.OfflineSessions, error)) error {
|
||||||
id := offlineSessionID(userID, connID, d.hasher)
|
id := offlineSessionID(userID, connID, d.hasher)
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ func (d *Database) UpdateOfflineSessions(userID string, connID string, updater f
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = tx.Commit(); err != nil {
|
if err = tx.Commit(); err != nil {
|
||||||
return rollback(tx, "update password commit: %w", err)
|
return rollback(tx, "update offline session commit: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -29,8 +29,7 @@ func New(logger log.Logger) storage.Storage {
|
|||||||
// Config is an implementation of a storage configuration.
|
// Config is an implementation of a storage configuration.
|
||||||
//
|
//
|
||||||
// TODO(ericchiang): Actually define a storage config interface and have registration.
|
// TODO(ericchiang): Actually define a storage config interface and have registration.
|
||||||
type Config struct {
|
type Config struct { // The in memory implementation has no config.
|
||||||
// The in memory implementation has no config.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open always returns a new in memory storage.
|
// Open always returns a new in memory storage.
|
||||||
|
@ -177,7 +177,7 @@ type Claims struct {
|
|||||||
Groups []string
|
Groups []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data needed for PKCE (RFC 7636)
|
// PKCE is a container for the data needed to perform Proof Key for Code Exchange (RFC 7636) auth flow
|
||||||
type PKCE struct {
|
type PKCE struct {
|
||||||
CodeChallenge string
|
CodeChallenge string
|
||||||
CodeChallengeMethod string
|
CodeChallengeMethod string
|
||||||
|
Reference in New Issue
Block a user