|
|
|
|
@@ -6,156 +6,300 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import csharp
|
|
|
|
|
private import semmle.code.csharp.dataflow.ExternalFlow
|
|
|
|
|
|
|
|
|
|
/** A class representing a Service */
|
|
|
|
|
class ServiceClass extends Class {
|
|
|
|
|
ServiceClass() { this.getBaseClass+().getQualifiedName() = "ServiceStack.Service" }
|
|
|
|
|
private class ServiceClass extends Class {
|
|
|
|
|
ServiceClass() {
|
|
|
|
|
this.getBaseClass+().hasQualifiedName("ServiceStack", "Service") or
|
|
|
|
|
this.getABaseInterface+().hasQualifiedName("ServiceStack", "IService")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Get a method that handles incoming requests */
|
|
|
|
|
Method getARequestMethod() {
|
|
|
|
|
result = this.getAMethod(["Post", "Get", "Put", "Delete", "Any", "Option", "Head"])
|
|
|
|
|
exists(string name |
|
|
|
|
|
result = this.getAMethod(name) and
|
|
|
|
|
name.regexpMatch("(Get|Post|Put|Delete|Any|Option|Head|Patch)(Async|Json|Xml|Jsv|Csv|Html|Protobuf|Msgpack|Wire)?")
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Top-level Request DTO types */
|
|
|
|
|
class RequestDTO extends Class {
|
|
|
|
|
RequestDTO() {
|
|
|
|
|
this.getABaseInterface().getQualifiedName() =
|
|
|
|
|
["ServiceStack.IReturn", "ServieStack.IReturnVoid"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Top-level Response DTO types */
|
|
|
|
|
class ResponseDTO extends Class {
|
|
|
|
|
ResponseDTO() {
|
|
|
|
|
exists(RequestDTO req, ConstructedGeneric respInterface |
|
|
|
|
|
req.getABaseInterface() = respInterface and
|
|
|
|
|
respInterface.getUndecoratedName() = "IReturn" and
|
|
|
|
|
respInterface.getATypeArgument() = this
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
private class RequestDTO extends Class {
|
|
|
|
|
RequestDTO() { this.getABaseInterface+().hasQualifiedName("ServiceStack", "IReturn") }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Flow sources for the ServiceStack framework */
|
|
|
|
|
module Sources {
|
|
|
|
|
private import semmle.code.csharp.security.dataflow.flowsources.Remote
|
|
|
|
|
private import semmle.code.csharp.commons.Collections
|
|
|
|
|
|
|
|
|
|
/** Types involved in a RequestDTO. Recurse through props and collection types */
|
|
|
|
|
private predicate involvedInRequest(RefType c) {
|
|
|
|
|
c instanceof RequestDTO
|
|
|
|
|
or
|
|
|
|
|
exists(RefType parent, RefType propType | involvedInRequest(parent) |
|
|
|
|
|
(propType = parent.getAProperty().getType() or propType = parent.getAField().getType()) and
|
|
|
|
|
if propType instanceof CollectionType
|
|
|
|
|
then
|
|
|
|
|
c = propType.(ConstructedGeneric).getATypeArgument() or
|
|
|
|
|
c = propType.(ArrayType).getElementType()
|
|
|
|
|
else c = propType
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remote flow sources for ServiceStack
|
|
|
|
|
*
|
|
|
|
|
* Assumes all nested fields/properties on request DTOs are tainted, which is
|
|
|
|
|
* an overapproximation and may lead to FPs depending on how Service Stack app
|
|
|
|
|
* is configured.
|
|
|
|
|
* Remote flow sources for ServiceStack. Parameters of well-known `request` methods.
|
|
|
|
|
*/
|
|
|
|
|
class ServiceStackSource extends RemoteFlowSource {
|
|
|
|
|
private class ServiceStackSource extends RemoteFlowSource {
|
|
|
|
|
ServiceStackSource() {
|
|
|
|
|
// Parameters are sources. In practice only interesting when they are string/primitive typed.
|
|
|
|
|
exists(ServiceClass service |
|
|
|
|
|
service.getARequestMethod().getAParameter() = this.asParameter()
|
|
|
|
|
)
|
|
|
|
|
or
|
|
|
|
|
// Field/property accesses on RequestDTOs and request involved types
|
|
|
|
|
// involved types aren't necessarily only from requests so may lead to FPs...
|
|
|
|
|
exists(RefType reqType | involvedInRequest(reqType) |
|
|
|
|
|
reqType.getAProperty().getAnAccess() = this.asExpr() or
|
|
|
|
|
reqType.getAField().getAnAccess() = this.asExpr()
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override string getSourceType() { result = "ServiceStack request DTO field" }
|
|
|
|
|
override string getSourceType() { result = "ServiceStack request parameter" }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Flow Sinks for the ServiceStack framework */
|
|
|
|
|
module Sinks {
|
|
|
|
|
private import semmle.code.csharp.security.dataflow.flowsinks.ExternalLocationSink
|
|
|
|
|
|
|
|
|
|
/** RemoteFlow sinks for service stack */
|
|
|
|
|
class ServiceStackRemoteRequestParameter extends ExternalLocationSink {
|
|
|
|
|
ServiceStackRemoteRequestParameter() {
|
|
|
|
|
exists(MethodCall mc |
|
|
|
|
|
mc.getTarget().getQualifiedName() in [
|
|
|
|
|
"ServiceStack.IRestClient.Get", "ServiceStack.IRestClient.Put",
|
|
|
|
|
"ServiceStack.IRestClient.Post", "ServiceStack.IRestClient.Delete",
|
|
|
|
|
"ServiceStack.IRestClient.Patch", "ServiceStack.IRestClient.Send",
|
|
|
|
|
"ServiceStack.IRestClientAsync.GetAsync", "ServiceStack.IRestClientAsync.DeleteAsync",
|
|
|
|
|
"ServiceStack.IRestClientAsync.PutAsync", "ServiceStack.IRestClientAsync.PostAsync",
|
|
|
|
|
"ServiceStack.IRestClientAsync.PatchAsync",
|
|
|
|
|
"ServiceStack.IRestClientAsync.CustomMethodAsync"
|
|
|
|
|
] and
|
|
|
|
|
this.asExpr() = mc.getAnArgument()
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
private class ServiceStackRemoteSinkModelCsv extends SinkModelCsv {
|
|
|
|
|
override predicate row(string row) {
|
|
|
|
|
row =
|
|
|
|
|
[
|
|
|
|
|
// IRestClient
|
|
|
|
|
"ServiceStack;IRestClient;true;Send;(System.String,System.String,System.Object);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;IRestClient;true;Patch;(System.String,System.Object);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClient;true;Post;(System.String,System.Object);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClient;true;Put;(System.String,System.Object);;Argument[1];remote",
|
|
|
|
|
// IRestClientSync
|
|
|
|
|
"ServiceStack;IRestClientSync;true;CustomMethod;(System.String,ServiceStack.IReturnVoid);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;CustomMethod;(System.String,System.Object);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;CustomMethod;(System.String,ServiceStack.IReturn<TResponse>);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Delete;(ServiceStack.IReturnVoid);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Delete;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Delete;(ServiceStack.IReturn<TResponse>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Get;(ServiceStack.IReturnVoid);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Get;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Get;(ServiceStack.IReturn<TResponse>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Patch;(ServiceStack.IReturnVoid);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Patch;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Patch;(ServiceStack.IReturn<TResponse>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Post;(ServiceStack.IReturnVoid);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Post;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Post;(ServiceStack.IReturn<TResponse>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Put;(ServiceStack.IReturnVoid);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Put;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientSync;true;Put;(ServiceStack.IReturn<TResponse>);;Argument[0];remote",
|
|
|
|
|
// IRestGateway
|
|
|
|
|
"ServiceStack;IRestGateway;true;Delete;(ServiceStack.IReturn<T>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGateway;true;Get;(ServiceStack.IReturn<T>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGateway;true;Post;(ServiceStack.IReturn<T>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGateway;true;Put;(ServiceStack.IReturn<T>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGateway;true;Send;(ServiceStack.IReturn<T>);;Argument[0];remote",
|
|
|
|
|
// IOneWayClient
|
|
|
|
|
"ServiceStack;IOneWayClient;true;SendAllOneWay;(System.Collections.Generic.IEnumerable<System.Object>);;Element of Argument[1];remote",
|
|
|
|
|
"ServiceStack;IOneWayClient;true;SendOneWay;(System.String,System.Object);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IOneWayClient;true;SendOneWay;(System.Object);;Argument[0];remote",
|
|
|
|
|
// IServiceGateway
|
|
|
|
|
"ServiceStack;IServiceGateway;true;Publish;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IServiceGateway;true;PublishAll;(System.Collections.Generic.IEnumerable<System.Object>);;Element of Argument[0];remote",
|
|
|
|
|
"ServiceStack;IServiceGateway;true;Send;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IServiceGateway;true;SendAll;(System.Collections.Generic.IEnumerable<System.Object>);;Element of Argument[0];remote",
|
|
|
|
|
// IRestClientAsync
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;CustomMethodAsync;(System.String,ServiceStack.IReturnVoid,System.Threading.CancellationToken);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;CustomMethodAsync;(System.String,System.Object,System.Threading.CancellationToken);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;CustomMethodAsync;(System.String,ServiceStack.IReturn<TResponse>,System.Threading.CancellationToken);;Argument[1];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;DeleteAsync;(ServiceStack.IReturnVoid,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;DeleteAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;DeleteAsync;(ServiceStack.IReturn<TResponse>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;GetAsync;(ServiceStack.IReturnVoid,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;GetAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;GetAsync;(ServiceStack.IReturn<TResponse>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PatchAsync;(ServiceStack.IReturnVoid,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PatchAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PatchAsync;(ServiceStack.IReturn<TResponse>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PostAsync;(ServiceStack.IReturnVoid,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PostAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PostAsync;(ServiceStack.IReturn<TResponse>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PutAsync;(ServiceStack.IReturnVoid,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PutAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestClientAsync;true;PutAsync;(ServiceStack.IReturn<TResponse>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
// IRestGatewayAsync
|
|
|
|
|
"ServiceStack;IRestGatewayAsync;true;DeleteAsync;(ServiceStack.IReturn<T>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGatewayAsync;true;GetAsync;(ServiceStack.IReturn<T>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGatewayAsync;true;PostAsync;(ServiceStack.IReturn<T>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGatewayAsync;true;PutAsync;(ServiceStack.IReturn<T>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IRestGatewayAsync;true;SendAsync;(ServiceStack.IReturn<T>,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
// IServiceGatewayAsync
|
|
|
|
|
"ServiceStack;IServiceGatewayAsync;true;PublishAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IServiceGatewayAsync;true;PublishAllAsync;(System.Collections.Generic.IEnumerable<System.Object>,System.Threading.CancellationToken);;Element of Argument[0];remote",
|
|
|
|
|
"ServiceStack;IServiceGatewayAsync;true;SendAsync;(System.Object,System.Threading.CancellationToken);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;IServiceGatewayAsync;true;SendAllAsync;(System.Collections.Generic.IEnumerable<System.Object>,System.Threading.CancellationToken);;Element of Argument[0];remote",
|
|
|
|
|
// ServiceClientBase
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Publish;(T);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Publish;(ServiceStack.Messaging.IMessage<T>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Delete;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Get;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Patch;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Post;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Put;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Head;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Head;(ServiceStack.IReturn);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;CustomMethod;(System.String,System.String,System.Object);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;CustomMethodAsync;(System.String,System.String,System.Object,System.Threading.CancellationToken);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;DownloadBytes;(System.String,System.String,System.Object);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;DownloadBytesAsync;(System.String,System.String,System.Object);;Argument[2];remote",
|
|
|
|
|
// ServiceClientBase
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Publish;(T);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Publish;(ServiceStack.Messaging.IMessage<T>);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Delete;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Get;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Patch;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Post;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Put;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Head;(System.Object);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;Head;(ServiceStack.IReturn);;Argument[0];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;CustomMethod;(System.String,System.String,System.Object);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;CustomMethodAsync;(System.String,System.String,System.Object,System.Threading.CancellationToken);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;DownloadBytes;(System.String,System.String,System.Object);;Argument[2];remote",
|
|
|
|
|
"ServiceStack;ServiceClientBase;true;DownloadBytesAsync;(System.String,System.String,System.Object);;Argument[2];remote"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** SQLi support for the ServiceStack framework */
|
|
|
|
|
module SQL {
|
|
|
|
|
private import semmle.code.csharp.security.dataflow.SqlInjectionQuery
|
|
|
|
|
|
|
|
|
|
/** SQLi sinks for ServiceStack */
|
|
|
|
|
class ServiceStackSink extends Sink {
|
|
|
|
|
ServiceStackSink() {
|
|
|
|
|
exists(MethodCall mc, Method m, int p |
|
|
|
|
|
(mc.getTarget() = m.getAnOverrider*() or mc.getTarget() = m.getAnImplementor*()) and
|
|
|
|
|
sqlSinkParam(m, p) and
|
|
|
|
|
mc.getArgument(p) = this.asExpr()
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
private class ServiceStackSqlSinkModelCsv extends SinkModelCsv {
|
|
|
|
|
override predicate row(string row) {
|
|
|
|
|
row =
|
|
|
|
|
[
|
|
|
|
|
// SqlExpression<T>
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeAnd;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeFrom;(System.String);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeGroupBy;(System.String);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeHaving;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeOr;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeOrderBy;(System.String);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeSelect;(System.String,System.Boolean);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeSelect;(System.String);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;SqlExpression<>;true;UnsafeWhere;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
// IUntypedSqlExpression
|
|
|
|
|
"ServiceStack.OrmLite;IUntypedSqlExpression;true;UnsafeAnd;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;IUntypedSqlExpression;true;UnsafeFrom;(System.String);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;IUntypedSqlExpression;true;UnsafeOr;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;IUntypedSqlExpression;true;UnsafeSelect;(System.String);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.OrmLite;IUntypedSqlExpression;true;UnsafeWhere;(System.String,System.Object[]);;Argument[0];sql",
|
|
|
|
|
// OrmLiteReadApi
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ExecuteNonQuery;(System.Data.IDbConnection,System.String);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ExecuteNonQuery;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ExecuteNonQuery;(System.Data.IDbConnection,System.String,System.Action<System.Data.IDbCommand>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ExecuteNonQuery;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Exists;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Dictionary;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Lookup;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Lookup;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;KeyValuePairs;(System.Data.IDbConnection,System.String,System.System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Scalar;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Scalar;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Select;(System.Data.IDbConnection,System.Type,System.String,System.Object);;Argument[2];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Select;(System.Data.IDbConnection,System.String);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Select;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Select;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Select;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SelectLazy;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SelectNonDefaults;(System.Data.IDbConnection,System.String,T);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Single;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Single;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlColumn;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlColumn;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlColumn;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlList;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlList;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlList;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlList;(System.Data.IDbConnection,System.String,System.Action<System.Data.IDbCommand>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlScalar;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlScalar;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;SqlScalar;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Column;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;Column;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ColumnDistinct;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ColumnDistinct;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ColumnLazy;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApi;false;ColumnLazy;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
// OrmLiteReadExpressionsApi
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadExpressionsApi;false;RowCount;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadExpressionsApi;false;RowCount;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>);;Argument[1];sql",
|
|
|
|
|
// OrmLiteReadExpressionsApiAsync
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadExpressionsApiAsync;false;RowCountAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
// OrmLiteReadApiAsync
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ColumnAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ColumnAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ColumnDistinctAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ColumnDistinctAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;DictionaryAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ExecuteNonQueryAsync;(System.Data.IDbConnection,System.String,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ExecuteNonQueryAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ExecuteNonQueryAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ExistsAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;KeyValuePairsAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;KeyValuePairsAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;LookupAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;LookupAsync;(System.Data.IDbCommand,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;LookupAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ScalarAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;ScalarAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SelectAsync;(System.Data.IDbConnection,System.Type,System.String,System.Object,System.Threading.CancellationToken);;Argument[2];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SelectAsync;(System.Data.IDbConnection,System.String,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SelectAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SelectAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SelectAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SelectNonDefaultsAsync;(System.Data.IDbConnection,System.String,T,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SingleAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SingleAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlColumnAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlColumnAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlColumnAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlListAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlListAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlListAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlListAsync;(System.Data.IDbConnection,System.String,System.Action<System.Data.IDbCommand>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlScalarAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlScalarAsync;(System.Data.IDbConnection,System.String,System.Collections.Generic.IEnumerable<System.Data.IDbDataParameter>,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteReadApiAsync;false;SqlScalarAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
// Write API
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteWriteApi;false;ExecuteSql;(System.Data.IDbConnection,System.String);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteWriteApi;false;ExecuteSql;(System.Data.IDbConnection,System.String,System.Object);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteWriteApi;false;ExecuteSql;(System.Data.IDbConnection,System.String,System.Collections.Generic.Dictionary<System.String,System.Object>);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteWriteApiAsync;false;ExecuteSqlAsync;(System.Data.IDbConnection,System.String,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
"ServiceStack.OrmLite;OrmLiteWriteApiAsync;false;ExecuteSqlAsync;(System.Data.IDbConnection,System.String,System.Object,System.Threading.CancellationToken);;Argument[1];sql",
|
|
|
|
|
// Redis API
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;Custom;(System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecCachedLua;(System.String,System.Func<System.String,T>);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLua;(System.String,System.String[],System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLua;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLuaAsInt;(System.String,System.String[],System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLuaAsInt;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLuaAsList;(System.String,System.String[],System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLuaAsList;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLuaAsString;(System.String,System.String[],System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;ExecLuaAsString;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClient;true;LoadLuaScript;(System.String);;Argument[0];sql",
|
|
|
|
|
// IRedisClientAsync
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;CustomAsync;(System.Object[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;CustomAsync;(System.Object[],System.Threading.CancellationToken);;Element of Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecCachedLuaAsync;(System.String,System.Func<System.String,System.Threading.Tasks.ValueTask<T>>,System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsync;(System.String,System.String[],System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsync;(System.String,System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsync;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsIntAsync;(System.String,System.String[],System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsIntAsync;(System.String,System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsIntAsync;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsStringAsync;(System.String,System.String[],System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsStringAsync;(System.String,System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsStringAsync;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsListAsync;(System.String,System.String[],System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsListAsync;(System.String,System.String[],System.Threading.CancellationToken);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;ExecLuaAsListAsync;(System.String,System.String[]);;Argument[0];sql",
|
|
|
|
|
"ServiceStack.Redis;IRedisClientAsync;true;LoadLuaScriptAsync;(System.String,System.Threading.CancellationToken);;Argument[0];sql"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private predicate sqlSinkParam(Method m, int p) {
|
|
|
|
|
exists(RefType cls | cls = m.getDeclaringType() |
|
|
|
|
|
// if using the typed query builder api, only need to worry about Unsafe variants
|
|
|
|
|
cls.getQualifiedName() =
|
|
|
|
|
["ServiceStack.OrmLite.SqlExpression", "ServiceStack.OrmLite.IUntypedSqlExpression"] and
|
|
|
|
|
m.getName().matches("Unsafe%") and
|
|
|
|
|
p = 0
|
|
|
|
|
or
|
|
|
|
|
// Read api - all string typed 1st params are potential sql sinks. They should be templates, not directly user controlled.
|
|
|
|
|
cls.getQualifiedName() =
|
|
|
|
|
[
|
|
|
|
|
"ServiceStack.OrmLite.OrmLiteReadApi", "ServiceStack.OrmLite.OrmLiteReadExpressionsApi",
|
|
|
|
|
"ServiceStack.OrmLite.OrmLiteReadApiAsync",
|
|
|
|
|
"ServiceStack.OrmLite.OrmLiteReadExpressionsApiAsync"
|
|
|
|
|
] and
|
|
|
|
|
m.getParameter(p).getType() instanceof StringType and
|
|
|
|
|
p = 1
|
|
|
|
|
or
|
|
|
|
|
// Write API - only 2 methods that take string
|
|
|
|
|
cls.getQualifiedName() =
|
|
|
|
|
["ServiceStack.OrmLite.OrmLiteWriteApi", "ServiceStack.OrmLite.OrmLiteWriteApiAsync"] and
|
|
|
|
|
m.getName() = ["ExecuteSql", "ExecuteSqlAsync"] and
|
|
|
|
|
p = 1
|
|
|
|
|
or
|
|
|
|
|
// NoSQL sinks in redis client. TODO should these be separate query?
|
|
|
|
|
cls.getQualifiedName() = "ServiceStack.Redis.IRedisClient" and
|
|
|
|
|
(
|
|
|
|
|
m.getName() = ["Custom", "LoadLuaScript"]
|
|
|
|
|
or
|
|
|
|
|
m.getName().matches("%Lua%") and not m.getName().matches("%Sha%")
|
|
|
|
|
) and
|
|
|
|
|
p = 0
|
|
|
|
|
// TODO
|
|
|
|
|
// ServiceStack.OrmLite.OrmLiteUtils.SqlColumn - what about other similar classes?
|
|
|
|
|
// couldn't find CustomSelect
|
|
|
|
|
// need to handle "PreCreateTable", "PostCreateTable", "PreDropTable", "PostDropTable"
|
|
|
|
|
)
|
|
|
|
|
private class ServiceStackXssSummaryModelCsv extends SummaryModelCsv {
|
|
|
|
|
override predicate row(string row) {
|
|
|
|
|
row =
|
|
|
|
|
[
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.String,System.String);;Argument[0];ReturnValue;taint",
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.Object,System.String,System.Net.HttpStatusCode);;Argument[0];ReturnValue;taint",
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.Object,System.String);;Argument[0];ReturnValue;taint",
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.Object,System.Net.HttpStatusCode);;Argument[0];ReturnValue;taint",
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.Object);;Argument[0];ReturnValue;taint",
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.IO.Stream,System.String);;Argument[0];ReturnValue;taint",
|
|
|
|
|
"ServiceStack;HttpResult;false;HttpResult;(System.Byte[],System.String);;Argument[0];ReturnValue;taint"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -166,14 +310,21 @@ module XSS {
|
|
|
|
|
/** XSS sinks for ServiceStack */
|
|
|
|
|
class XssSink extends Sink {
|
|
|
|
|
XssSink() {
|
|
|
|
|
exists(ServiceClass service, ReturnStmt r |
|
|
|
|
|
this.asExpr() = r.getExpr() and
|
|
|
|
|
r.getEnclosingCallable() = service.getARequestMethod()
|
|
|
|
|
)
|
|
|
|
|
or
|
|
|
|
|
exists(ObjectCreation oc |
|
|
|
|
|
oc.getType().hasQualifiedName("ServiceStack.HttpResult") and
|
|
|
|
|
this.asExpr() = oc.getArgument(0)
|
|
|
|
|
exists(ServiceClass service, Method m, Expr e |
|
|
|
|
|
service.getARequestMethod() = m and
|
|
|
|
|
this.asExpr() = e and
|
|
|
|
|
(
|
|
|
|
|
exists(ReturnStmt r |
|
|
|
|
|
e = r.getExpr() and
|
|
|
|
|
r.getEnclosingCallable() = m
|
|
|
|
|
)
|
|
|
|
|
or
|
|
|
|
|
e = m.getExpressionBody()
|
|
|
|
|
) and
|
|
|
|
|
(
|
|
|
|
|
e.getType() instanceof StringType or
|
|
|
|
|
e.getType().hasQualifiedName("ServiceStack", "HttpResult")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|