Partial URLs should not sanitize against SSRF

As an example:

```go
	urlPath := ctx.Req.URL.Path
	hash := urlPath[strings.LastIndex(urlPath, "/")+1:]
        req, _ := http.NewRequest("GET", source+hash, nil)
```
This commit is contained in:
Alvaro Muñoz
2022-08-11 16:43:03 +02:00
committed by Owen Mansel-Chan
parent 15d5ad7a66
commit 8bf4b55309

View File

@@ -35,4 +35,10 @@ module SafeUrlFlow {
private class UnsafeUrlMethodEdge extends SanitizerEdge {
UnsafeUrlMethodEdge() { this = any(UnsafeUrlMethod um).getACall().getReceiver() }
}
/** Any slicing of the URL, considered as a sanitizer for safe URL flow. */
private class StringSlicingEdge extends SanitizerEdge {
StringSlicingEdge() { this = any(DataFlow::SliceNode sn) }
}
}