Java SSRF query: comment on sanitizing regex

This commit is contained in:
Chris Smowton
2021-04-19 16:33:29 +01:00
parent a665d5d111
commit b25e8671b9

View File

@@ -222,6 +222,10 @@ private class HostnameSanitizingPrefix extends CompileTimeConstantExpr {
int offset;
HostnameSanitizingPrefix() {
// Matches strings that look like when prepended to untrusted input, they will restrict
// the host or entity addressed: for example, anything containing `?` or `#`, or a slash that
// doesn't appear to be a protocol specifier (e.g. `http://` is not sanitizing), or specifically
// the string "/".
exists(
this.getStringValue()
.regexpFind(".*([?#]|[^?#:/\\\\][/\\\\]).*|[/\\\\][^/\\\\].*|^/$", 0, offset)