Skip to content

Commit 8bf4b55

Browse files
Alvaro Muñozowen-mc
authored andcommitted
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) ```
1 parent 15d5ad7 commit 8bf4b55

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

go/ql/lib/semmle/go/security/SafeUrlFlowCustomizations.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ module SafeUrlFlow {
3535
private class UnsafeUrlMethodEdge extends SanitizerEdge {
3636
UnsafeUrlMethodEdge() { this = any(UnsafeUrlMethod um).getACall().getReceiver() }
3737
}
38+
39+
/** Any slicing of the URL, considered as a sanitizer for safe URL flow. */
40+
private class StringSlicingEdge extends SanitizerEdge {
41+
StringSlicingEdge() { this = any(DataFlow::SliceNode sn) }
42+
}
43+
3844
}

0 commit comments

Comments
 (0)