Skip to content

Commit cbd90df

Browse files
fix secrets lookup logic (#6059)
* fix secrets lookup logic * check len
1 parent 89c77d1 commit cbd90df

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pkg/authprovider/file.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ func (f *FileAuthProvider) init() {
122122

123123
// LookupAddr looks up a given domain/address and returns appropriate auth strategy
124124
func (f *FileAuthProvider) LookupAddr(addr string) []authx.AuthStrategy {
125+
var strategies []authx.AuthStrategy
126+
125127
if strings.Contains(addr, ":") {
126128
// default normalization for host:port
127129
host, port, err := net.SplitHostPort(addr)
@@ -131,15 +133,16 @@ func (f *FileAuthProvider) LookupAddr(addr string) []authx.AuthStrategy {
131133
}
132134
for domain, strategy := range f.domains {
133135
if strings.EqualFold(domain, addr) {
134-
return strategy
136+
strategies = append(strategies, strategy...)
135137
}
136138
}
137139
for compiled, strategy := range f.compiled {
138140
if compiled.MatchString(addr) {
139-
return strategy
141+
strategies = append(strategies, strategy...)
140142
}
141143
}
142-
return nil
144+
145+
return strategies
143146
}
144147

145148
// LookupURL looks up a given URL and returns appropriate auth strategy

pkg/authprovider/multi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewMultiAuthProvider(providers ...AuthProvider) AuthProvider {
2222
func (m *MultiAuthProvider) LookupAddr(host string) []authx.AuthStrategy {
2323
for _, provider := range m.Providers {
2424
strategy := provider.LookupAddr(host)
25-
if strategy != nil {
25+
if len(strategy) > 0 {
2626
return strategy
2727
}
2828
}

0 commit comments

Comments
 (0)