Skip to content

Commit 6d5f903

Browse files
committed
Minor fixes to XSS:
Only want returns in request methods Also care about non-string 1st args to HttpResult e.g. streams
1 parent 7d47bff commit 6d5f903

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

csharp/ql/src/semmle/code/csharp/frameworks/ServiceStack.qll

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,12 @@ module XSS {
127127

128128
class XssExpr extends Expr {
129129
XssExpr() {
130-
exists(ReturnStmt r |
131-
(
132-
r.getExpr().getType() instanceof StringType
133-
)
134-
|
135-
this = r.getExpr()
130+
exists(ServiceClass service, ReturnStmt r |
131+
this = r.getExpr() and
132+
r.getEnclosingCallable() = service.getARequestMethod()
136133
) or
137134
exists(ObjectCreation oc |
138-
oc.getType().hasName("HttpResult") and
139-
oc.getAnArgument().getType() instanceof StringType
140-
|
135+
oc.getType().hasQualifiedName("ServiceStack.HttpResult") and
141136
this = oc.getArgument(0)
142137
)
143138
}

0 commit comments

Comments
 (0)