Skip to content

Commit 2c061b0

Browse files
committed
Add QLDoc for HostnameSanitizingPrefix
1 parent 7f8a1ae commit 2c061b0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

java/ql/lib/semmle/code/java/security/RequestForgery.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ abstract class RequestForgerySanitizer extends DataFlow::Node { }
6363

6464
private class PrimitiveSanitizer extends RequestForgerySanitizer instanceof SimpleTypeSanitizer { }
6565

66+
/**
67+
* A string constant that contains a prefix which looks like when it is prepended to untrusted
68+
* input, it will restrict the host or entity addressed.
69+
*
70+
* For example, anything containing `?` or `#`, or a slash that doesn't appear to be a protocol
71+
* specifier (e.g. `http://` is not sanitizing), or specifically the string "/".
72+
*/
6673
class HostnameSanitizingPrefix extends InterestingPrefix {
6774
int offset;
6875

6976
HostnameSanitizingPrefix() {
70-
// Matches strings that look like when prepended to untrusted input, they will restrict
71-
// the host or entity addressed: for example, anything containing `?` or `#`, or a slash that
72-
// doesn't appear to be a protocol specifier (e.g. `http://` is not sanitizing), or specifically
73-
// the string "/".
7477
exists(this.getStringValue().regexpFind("([?#]|[^?#:/\\\\][/\\\\])|^/$", 0, offset))
7578
}
7679

0 commit comments

Comments
 (0)