Skip to content

Commit 1cab177

Browse files
committed
C#: Convert System.Web.HttpUtility flow to CSV format.
1 parent 0e0c3e3 commit 1cab177

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,24 +1965,6 @@ class SystemIOPathFlow extends LibraryTypeDataFlow, SystemIOPathClass {
19651965
}
19661966
}
19671967

1968-
/** Data flow for `System.Web.HttpUtility`. */
1969-
class SystemWebHttpUtilityFlow extends LibraryTypeDataFlow, SystemWebHttpUtility {
1970-
override predicate callableFlow(
1971-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
1972-
boolean preservesValue
1973-
) {
1974-
(
1975-
c = this.getAnHtmlAttributeEncodeMethod() or
1976-
c = this.getAnHtmlEncodeMethod() or
1977-
c = this.getAJavaScriptStringEncodeMethod() or
1978-
c = this.getAnUrlEncodeMethod()
1979-
) and
1980-
source = TCallableFlowSourceArg(0) and
1981-
sink = TCallableFlowSinkReturn() and
1982-
preservesValue = false
1983-
}
1984-
}
1985-
19861968
/**
19871969
* Custom flow through `StringValues` library class.
19881970
*/

csharp/ql/lib/semmle/code/csharp/frameworks/system/Web.qll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,26 @@ class SystemWebHttpUtility extends SystemWebClass {
203203
Method getAnUrlEncodeMethod() { result = this.getAMethod("UrlEncode") }
204204
}
205205

206+
/** Data flow for `System.Web.HttpUtility`. */
207+
private class SystemWebHttpUtilityFlowModelCsv extends SummaryModelCsv {
208+
override predicate row(string row) {
209+
row =
210+
[
211+
"System.Web;HttpUtility;false;HtmlAttributeEncode;(System.String);;Argument[0];ReturnValue;taint",
212+
"System.Web;HttpUtility;false;HtmlAttributeEncode;(System.String,System.IO.TextWriter);;Argument[0];ReturnValue;taint",
213+
"System.Web;HttpUtility;false;HtmlEncode;(System.Object);;Argument[0];ReturnValue;taint",
214+
"System.Web;HttpUtility;false;HtmlEncode;(System.String);;Argument[0];ReturnValue;taint",
215+
"System.Web;HttpUtility;false;HtmlEncode;(System.String,System.IO.TextWriter);;Argument[0];ReturnValue;taint",
216+
"System.Web;HttpUtility;false;JavaScriptStringEncode;(System.String);;Argument[0];ReturnValue;taint",
217+
"System.Web;HttpUtility;false;JavaScriptStringEncode;(System.String,System.Boolean);;Argument[0];ReturnValue;taint",
218+
"System.Web;HttpUtility;false;UrlEncode;(System.Byte[]);;Argument[0];ReturnValue;taint",
219+
"System.Web;HttpUtility;false;UrlEncode;(System.Byte[],System.Int32,System.Int32);;Argument[0];ReturnValue;taint",
220+
"System.Web;HttpUtility;false;UrlEncode;(System.String);;Argument[0];ReturnValue;taint",
221+
"System.Web;HttpUtility;false;UrlEncode;(System.String,System.Text.Encoding);;Argument[0];ReturnValue;taint"
222+
]
223+
}
224+
}
225+
206226
/** The `System.Web.HttpCookie` class. */
207227
class SystemWebHttpCookie extends SystemWebClass {
208228
SystemWebHttpCookie() { this.hasName("HttpCookie") }

0 commit comments

Comments
 (0)