mirror of https://github.com/daffainfo/nuclei.git
Fix edge cases `disable-path-automerge` (#4035)
* fix edge cases for disable-path-automerge * misc updatedev
parent
b2916c1348
commit
7997e8dbec
|
@ -10,6 +10,9 @@ http:
|
|||
- |
|
||||
GET /api/v1/test?id=123 HTTP/1.1
|
||||
Host: {{Hostname}}
|
||||
- |
|
||||
GET HTTP/1.1
|
||||
Host: {{Hostname}}
|
||||
disable-path-automerge: true
|
||||
matchers:
|
||||
- type: status
|
||||
|
|
|
@ -1453,11 +1453,15 @@ func (h *httpDisablePathAutomerge) Execute(filePath string) error {
|
|||
router.GET("/api/v1/test", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
fmt.Fprint(w, r.URL.Query().Get("id"))
|
||||
})
|
||||
router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
fmt.Fprint(w, "empty path in raw request")
|
||||
})
|
||||
|
||||
ts := httptest.NewServer(router)
|
||||
defer ts.Close()
|
||||
got, err := testutils.RunNucleiTemplateAndGetResults(filePath, ts.URL+"/api/v1/user", debug)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return expectResultsCount(got, 1)
|
||||
return expectResultsCount(got, 2)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ func Parse(request string, inputURL *urlutil.URL, unsafe, disablePathAutomerge b
|
|||
// If path is empty do not tamper input url (see doc)
|
||||
// can be omitted but makes things clear
|
||||
case rawrequest.Path == "":
|
||||
rawrequest.Path = inputURL.GetRelativePath()
|
||||
if !disablePathAutomerge {
|
||||
rawrequest.Path = inputURL.GetRelativePath()
|
||||
}
|
||||
|
||||
// full url provided instead of rel path
|
||||
case strings.HasPrefix(rawrequest.Path, "http") && !unsafe:
|
||||
|
|
Loading…
Reference in New Issue