Skip to content

Commit f00b62d

Browse files
committed
C#: Convert System.Uri flow to CSV format.
1 parent 90baef8 commit f00b62d

File tree

2 files changed

+17
-46
lines changed

2 files changed

+17
-46
lines changed

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

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -499,51 +499,6 @@ private module FrameworkDataFlowAdaptor {
499499
}
500500
}
501501

502-
/** Data flow for `System.Uri`. */
503-
class SystemUriFlow extends LibraryTypeDataFlow, SystemUriClass {
504-
override predicate callableFlow(
505-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
506-
boolean preservesValue
507-
) {
508-
(
509-
this.constructorFlow(source, sink, c)
510-
or
511-
this.methodFlow(source, sink, c)
512-
or
513-
exists(Property p |
514-
this.propertyFlow(p) and
515-
source = TCallableFlowSourceQualifier() and
516-
sink = TCallableFlowSinkReturn() and
517-
c = p.getGetter()
518-
)
519-
) and
520-
preservesValue = false
521-
}
522-
523-
private predicate constructorFlow(CallableFlowSource source, CallableFlowSink sink, Constructor c) {
524-
c = this.getAMember() and
525-
c.getParameter(0).getType() instanceof StringType and
526-
source = TCallableFlowSourceArg(0) and
527-
sink = TCallableFlowSinkReturn()
528-
}
529-
530-
private predicate methodFlow(
531-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationMethod m
532-
) {
533-
m = this.getAMethod("ToString") and
534-
source = TCallableFlowSourceQualifier() and
535-
sink = TCallableFlowSinkReturn()
536-
}
537-
538-
private predicate propertyFlow(Property p) {
539-
p = this.getPathAndQueryProperty()
540-
or
541-
p = this.getQueryProperty()
542-
or
543-
p = this.getOriginalStringProperty()
544-
}
545-
}
546-
547502
/** Data flow for `System.IO.StringReader`. */
548503
class SystemIOStringReaderFlow extends LibraryTypeDataFlow, SystemIOStringReaderClass {
549504
override predicate callableFlow(

csharp/ql/lib/semmle/code/csharp/frameworks/System.qll

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class SystemBooleanStruct extends BoolType {
9292
}
9393
}
9494

95-
/** Data flow for `System.Boolean` */
95+
/** Data flow for `System.Boolean`. */
9696
private class SystemBoolean32FlowModelCsv extends SummaryModelCsv {
9797
override predicate row(string row) {
9898
row =
@@ -553,6 +553,22 @@ class SystemUriClass extends SystemClass {
553553
}
554554
}
555555

556+
/** Data flow for `System.Uri`. */
557+
private class SystemUriFlowModelCsv extends SummaryModelCsv {
558+
override predicate row(string row) {
559+
row =
560+
[
561+
"System;Uri;false;ToString;();;Argument[-1];ReturnValue;taint",
562+
"System;Uri;false;Uri;(System.String);;Argument[0];ReturnValue;taint",
563+
"System;Uri;false;Uri;(System.String,System.Boolean);;Argument[0];ReturnValue;taint",
564+
"System;Uri;false;Uri;(System.String,System.UriKind);;Argument[0];ReturnValue;taint",
565+
"System;Uri;false;get_OriginalString;();;Argument[-1];ReturnValue;taint",
566+
"System;Uri;false;get_PathAndQuery;();;Argument[-1];ReturnValue;taint",
567+
"System;Uri;false;get_Query;();;Argument[-1];ReturnValue;taint",
568+
]
569+
}
570+
}
571+
556572
/** The `System.ValueType` class. */
557573
class SystemValueTypeClass extends SystemClass {
558574
SystemValueTypeClass() { this.hasName("ValueType") }

0 commit comments

Comments
 (0)