mirror of
https://github.com/distribution/distribution.git
synced 2025-09-17 15:50:20 +00:00
feat(linter): enable errcheck linter in golangci-lint
Also, bump the linter version to the latest available version. Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
"github.com/distribution/distribution/v3/internal/dcontext"
|
||||
"github.com/distribution/distribution/v3/registry/auth"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type accessController struct {
|
||||
@@ -151,5 +152,7 @@ func createHtpasswdFile(path string) error {
|
||||
}
|
||||
|
||||
func init() {
|
||||
auth.Register("htpasswd", auth.InitFunc(newAccessController))
|
||||
if err := auth.Register("htpasswd", auth.InitFunc(newAccessController)); err != nil {
|
||||
logrus.Errorf("failed to register htpasswd auth: %v", err)
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,9 @@ func (htpasswd *htpasswd) authenticateUser(username string, password string) err
|
||||
credentials, ok := htpasswd.entries[username]
|
||||
if !ok {
|
||||
// timing attack paranoia
|
||||
bcrypt.CompareHashAndPassword([]byte{}, []byte(password))
|
||||
if err := bcrypt.CompareHashAndPassword([]byte{}, []byte(password)); err != nil {
|
||||
return auth.ErrAuthenticationFailure
|
||||
}
|
||||
|
||||
return auth.ErrAuthenticationFailure
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/distribution/distribution/v3/registry/auth"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// accessController provides a simple implementation of auth.AccessController
|
||||
@@ -87,5 +88,7 @@ func (ch challenge) Error() string {
|
||||
|
||||
// init registers the silly auth backend.
|
||||
func init() {
|
||||
auth.Register("silly", auth.InitFunc(newAccessController))
|
||||
if err := auth.Register("silly", auth.InitFunc(newAccessController)); err != nil {
|
||||
logrus.Errorf("failed to register silly auth: %v", err)
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/distribution/distribution/v3/registry/auth"
|
||||
"github.com/go-jose/go-jose/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// accessSet maps a typed, named resource to
|
||||
@@ -339,5 +340,7 @@ func (ac *accessController) Authorized(req *http.Request, accessItems ...auth.Ac
|
||||
|
||||
// init handles registering the token auth backend.
|
||||
func init() {
|
||||
auth.Register("token", auth.InitFunc(newAccessController))
|
||||
if err := auth.Register("token", auth.InitFunc(newAccessController)); err != nil {
|
||||
logrus.Errorf("tailed to register token auth: %v", err)
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,10 @@ func FuzzToken1(f *testing.F) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
token.Verify(verifyOps)
|
||||
_, err = token.Verify(verifyOps)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _ = token.VerifySigningKey(verifyOps)
|
||||
})
|
||||
}
|
||||
@@ -40,7 +43,10 @@ func FuzzToken2(f *testing.F) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
token.Verify(verifyOps)
|
||||
_, err = token.Verify(verifyOps)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _ = token.VerifySigningKey(verifyOps)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user