Skip to content

Commit

Permalink
cleanup: add goling gosec exception for Secret type constants
Browse files Browse the repository at this point in the history
  • Loading branch information
waveywaves committed Feb 19, 2025
1 parent 03eec53 commit 4ccc489
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pkg/credentials/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package common

// Secret key constants used in credential files,
// so as to avoid reliance on corev1.Secret.
//
//nolint:gosec // for known Kubernetes secret-type constants, not real credentials
const (
BasicAuthUsernameKey = "username"
BasicAuthPasswordKey = "password"
Expand Down
1 change: 1 addition & 0 deletions pkg/credentials/gitcreds/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package gitcreds
import (
"flag"
"fmt"

"github.com/tektoncd/pipeline/pkg/credentials/common"
credmatcher "github.com/tektoncd/pipeline/pkg/credentials/matcher"
credwriter "github.com/tektoncd/pipeline/pkg/credentials/writer"
Expand Down
6 changes: 2 additions & 4 deletions pkg/credentials/matcher/matcher.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2024 The Tekton Authors
Copyright 2025 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,8 +34,7 @@ type Secret interface {
// Matcher is the interface for a credential initializer of any type.
type Matcher interface {
// MatchingAnnotations extracts flags for the credential
// helper from the supplied secret and returns a slice (of
// length 0 or greater) of applicable domains.
// helper from the supplied secret and returns a slice (of length 0 or greater)
MatchingAnnotations(secret Secret) []string
}

Expand All @@ -51,7 +50,6 @@ func GetSecretType(secret Secret) string {
if v.Kind() == reflect.Ptr {
v = v.Elem()
}
// Grab the field by name
f := v.FieldByName("Type")
if !f.IsValid() || !f.CanInterface() {
return ""
Expand Down

0 comments on commit 4ccc489

Please sign in to comment.