mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 21:05:26 +00:00
Adding stricter check on offline templates list (#2213)
This commit is contained in:
parent
5b3c2861c2
commit
3c945f6ae9
@ -3,7 +3,6 @@ package templates
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
@ -14,6 +13,7 @@ import (
|
|||||||
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/offlinehttp"
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/offlinehttp"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/templates/cache"
|
"github.com/projectdiscovery/nuclei/v2/pkg/templates/cache"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/utils"
|
"github.com/projectdiscovery/nuclei/v2/pkg/utils"
|
||||||
|
"github.com/projectdiscovery/stringsutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -203,8 +203,13 @@ func (template *Template) compileOfflineHTTPRequest(options protocols.ExecuterOp
|
|||||||
|
|
||||||
mainLoop:
|
mainLoop:
|
||||||
for _, req := range template.RequestsHTTP {
|
for _, req := range template.RequestsHTTP {
|
||||||
|
hasPaths := len(req.Path) > 0
|
||||||
|
if !hasPaths {
|
||||||
|
break mainLoop
|
||||||
|
}
|
||||||
for _, path := range req.Path {
|
for _, path := range req.Path {
|
||||||
if !(strings.EqualFold(path, "{{BaseURL}}") || strings.EqualFold(path, "{{BaseURL}}/")) {
|
pathIsBaseURL := stringsutil.EqualFoldAny(path, "{{BaseURL}}", "{{BaseURL}}/", "/")
|
||||||
|
if !pathIsBaseURL {
|
||||||
break mainLoop
|
break mainLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user