mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 20:25:27 +00:00
use stringsutil.HasPrefixAnyI
This commit is contained in:
parent
494dacc671
commit
d720d4ec8d
@ -31,7 +31,7 @@ func ValidateNFailRequest(page *rod.Page, e *proto.FetchRequestPaused) error {
|
|||||||
}
|
}
|
||||||
// validate potential invalid schemes
|
// validate potential invalid schemes
|
||||||
// javascript protocol is allowed for xss fuzzing
|
// javascript protocol is allowed for xss fuzzing
|
||||||
if HasPrefixAnyI(normalized, "ftp:", "externalfile:", "chrome:", "chrome-extension:") {
|
if stringsutil.HasPrefixAnyI(normalized, "ftp:", "externalfile:", "chrome:", "chrome-extension:") {
|
||||||
return multierr.Combine(FailWithReason(page, e), ErrURLDenied.Msgf(reqURL, "protocol blocked by network policy"))
|
return multierr.Combine(FailWithReason(page, e), ErrURLDenied.Msgf(reqURL, "protocol blocked by network policy"))
|
||||||
}
|
}
|
||||||
if !isValidHost(reqURL) {
|
if !isValidHost(reqURL) {
|
||||||
@ -77,14 +77,3 @@ func isValidHost(targetUrl string) bool {
|
|||||||
_, ok := networkPolicy.ValidateHost(targetUrl)
|
_, ok := networkPolicy.ValidateHost(targetUrl)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasPrefixAnyI checks if the string has any of the prefixes
|
|
||||||
// TODO: replace with stringsutil.HasPrefixAnyI after implementation
|
|
||||||
func HasPrefixAnyI(s string, prefixes ...string) bool {
|
|
||||||
for _, prefix := range prefixes {
|
|
||||||
if stringsutil.HasPrefixI(s, prefix) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user