mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 18:05:27 +00:00
fix secrets lookup logic (#6059)
* fix secrets lookup logic * check len
This commit is contained in:
parent
89c77d1e9e
commit
cbd90df51c
@ -122,6 +122,8 @@ func (f *FileAuthProvider) init() {
|
||||
|
||||
// LookupAddr looks up a given domain/address and returns appropriate auth strategy
|
||||
func (f *FileAuthProvider) LookupAddr(addr string) []authx.AuthStrategy {
|
||||
var strategies []authx.AuthStrategy
|
||||
|
||||
if strings.Contains(addr, ":") {
|
||||
// default normalization for host:port
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
@ -131,15 +133,16 @@ func (f *FileAuthProvider) LookupAddr(addr string) []authx.AuthStrategy {
|
||||
}
|
||||
for domain, strategy := range f.domains {
|
||||
if strings.EqualFold(domain, addr) {
|
||||
return strategy
|
||||
strategies = append(strategies, strategy...)
|
||||
}
|
||||
}
|
||||
for compiled, strategy := range f.compiled {
|
||||
if compiled.MatchString(addr) {
|
||||
return strategy
|
||||
strategies = append(strategies, strategy...)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
return strategies
|
||||
}
|
||||
|
||||
// LookupURL looks up a given URL and returns appropriate auth strategy
|
||||
|
||||
@ -22,7 +22,7 @@ func NewMultiAuthProvider(providers ...AuthProvider) AuthProvider {
|
||||
func (m *MultiAuthProvider) LookupAddr(host string) []authx.AuthStrategy {
|
||||
for _, provider := range m.Providers {
|
||||
strategy := provider.LookupAddr(host)
|
||||
if strategy != nil {
|
||||
if len(strategy) > 0 {
|
||||
return strategy
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user