Skip to content

Commit d31bfc0

Browse files
committed
add type requirement to the new Uri sanitizers
1 parent 4dae8d0 commit d31bfc0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

csharp/ql/lib/semmle/code/csharp/security/dataflow/UrlRedirectQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class ContainsUrlSanitizer extends Sanitizer {
167167
private predicate isRelativeUrlSanitizer(Guard guard, Expr e, AbstractValue v) {
168168
exists(PropertyAccess access | access = guard |
169169
access.getProperty().getName() = "IsAbsoluteUri" and
170-
// TOOD: type = URL?
170+
access.getQualifier().getType().getFullyQualifiedName() = "System.Uri" and
171171
e = access.getQualifier() and
172172
v.(AbstractValues::BooleanValue).getValue() = false
173173
)
@@ -190,6 +190,7 @@ private predicate isHostComparisonSanitizer(Guard guard, Expr e, AbstractValue v
190190
exists(EqualityOperation comparison | comparison = guard |
191191
exists(PropertyAccess access | access = comparison.getAnOperand() |
192192
access.getProperty().getName() = "Host" and
193+
access.getQualifier().getType().getFullyQualifiedName() = "System.Uri" and
193194
e = access.getQualifier()
194195
) and
195196
if comparison instanceof EQExpr

0 commit comments

Comments
 (0)