From 43966ebaeb050d7ff191d354b8686be6e6f7ecb6 Mon Sep 17 00:00:00 2001 From: Ed Minnix Date: Tue, 9 May 2023 19:54:22 -0400 Subject: [PATCH] Change regex used in HostnameSanitizingPrefix --- java/ql/lib/semmle/code/java/security/RequestForgery.qll | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/java/ql/lib/semmle/code/java/security/RequestForgery.qll b/java/ql/lib/semmle/code/java/security/RequestForgery.qll index c454da5f035..f9b98490dfa 100644 --- a/java/ql/lib/semmle/code/java/security/RequestForgery.qll +++ b/java/ql/lib/semmle/code/java/security/RequestForgery.qll @@ -79,10 +79,7 @@ private class HostnameSanitizingPrefix extends InterestingPrefix { // 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) - ) + exists(this.getStringValue().regexpFind("([?#]|[^?#:/\\\\][/\\\\])|^/$", 0, offset)) } override int getOffset() { result = offset }