Add comment for new url concatenation sanitizer

This commit is contained in:
Sauyon Lee
2020-04-02 02:16:40 -07:00
parent 3c02b3ab74
commit e27947e280

View File

@@ -55,6 +55,8 @@ private predicate concatenationHasHostnameSanitizingSubstring(StringOps::Concate
exists(StringOps::ConcatenationLeaf lf | lf = cat.getALeaf() |
lf.getStringValue().regexpMatch(".*([?#]|[^?#:/\\\\][/\\\\]).*|[/\\\\][^/\\\\].*")
or
// this deals with cases such as `Sprintf("%s/%s", hostname, taint)`, which should be safe as
// long as `hostname` is not user-controlled
lf.getStringValue() = "/" and
exists(lf.getPreviousLeaf())
or