1717 * members need to be taint-tracked explicitly.
1818 */
1919
20- private import csharp
20+ import csharp
2121private import semmle.code.csharp.commons.Collections
2222private import semmle.code.csharp.dataflow.FlowSteps
2323private import semmle.code.csharp.dataflow.TaintTracking
2424private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
2525
2626/** The `ODataActionParameters` dictionary type, across OData library versions. */
27- private class ODataActionParametersClass extends Class {
27+ class ODataActionParametersClass extends Class {
2828 ODataActionParametersClass ( ) {
2929 this .hasFullyQualifiedName ( "Microsoft.AspNet.OData" , "ODataActionParameters" ) or
3030 this .hasFullyQualifiedName ( "Microsoft.AspNetCore.OData.Formatter" , "ODataActionParameters" ) or
3131 this .hasFullyQualifiedName ( "System.Web.Http.OData" , "ODataActionParameters" )
3232 }
3333}
3434
35- /** An indexer read on an `ODataActionParameters` dictionary, e.g. `parameters["CabFile "]`. */
36- private class ODataActionParameterRead extends ElementAccess {
35+ /** An indexer read on an `ODataActionParameters` dictionary, e.g. `parameters["Foo "]`. */
36+ class ODataActionParameterRead extends ElementAccess {
3737 ODataActionParameterRead ( ) { this .getQualifier ( ) .getType ( ) instanceof ODataActionParametersClass }
3838}
3939
@@ -43,7 +43,7 @@ private predicate isODataParameterValue(Expr e) {
4343}
4444
4545/** The generic `Delta<TStructuralType>` change-tracking class, across OData library versions. */
46- private class DeltaClass extends UnboundGenericClass {
46+ class DeltaClass extends UnboundGenericClass {
4747 DeltaClass ( ) {
4848 this .getNumberOfTypeParameters ( ) = 1 and
4949 (
@@ -58,7 +58,7 @@ private class DeltaClass extends UnboundGenericClass {
5858 * or type-tested to -- directly, or wrapped in a collection (`List<T>`,
5959 * `IEnumerable<T>`, arrays, ...) -- or a type that is tracked by a `Delta<T>`.
6060 */
61- private class ODataBoundType extends ValueOrRefType {
61+ class ODataBoundType extends ValueOrRefType {
6262 ODataBoundType ( ) {
6363 exists ( Cast c | isODataParameterValue ( c .getExpr ( ) ) |
6464 this = c .getTargetType ( ) or
@@ -79,6 +79,22 @@ private class ODataBoundType extends ValueOrRefType {
7979 }
8080}
8181
82+ /** The `Patch`, `Put`, `CopyChangedValues`, and `CopyUnchangedValues` methods on `Delta<T>`. */
83+ class DeltaMutatingMethod extends Method {
84+ DeltaMutatingMethod ( ) {
85+ this .getDeclaringType ( ) instanceof DeltaClass and
86+ this .hasName ( [ "Patch" , "Put" , "CopyChangedValues" , "CopyUnchangedValues" ] )
87+ }
88+ }
89+
90+ /** The `GetInstance` method on `Delta<T>`. */
91+ class DeltaGetInstanceMethod extends Method {
92+ DeltaGetInstanceMethod ( ) {
93+ this .getDeclaringType ( ) instanceof DeltaClass and
94+ this .hasName ( "GetInstance" )
95+ }
96+ }
97+
8298private class CandidateODataMember extends Member {
8399 CandidateODataMember ( ) {
84100 this .isPublic ( ) and
@@ -118,14 +134,6 @@ private class ODataBoundMember extends TaintTracking::TaintedMember, CandidateOD
118134 }
119135}
120136
121- /** The `Patch`, `Put`, `CopyChangedValues`, and `CopyUnchangedValues` methods on `Delta<T>`. */
122- private class DeltaMutatingMethod extends Method {
123- DeltaMutatingMethod ( ) {
124- this .getDeclaringType ( ) instanceof DeltaClass and
125- this .hasName ( [ "Patch" , "Put" , "CopyChangedValues" , "CopyUnchangedValues" ] )
126- }
127- }
128-
129137/**
130138 * A call to `Delta<T>.Patch`/`Put`/`CopyChangedValues`/`CopyUnchangedValues`
131139 * copies the changes tracked by the `Delta<T>` receiver onto its `original`
@@ -141,14 +149,6 @@ private class DeltaMutatingCallTaintStep extends AdditionalTaintStep {
141149 }
142150}
143151
144- /** The `GetInstance` method on `Delta<T>`. */
145- private class DeltaGetInstanceMethod extends Method {
146- DeltaGetInstanceMethod ( ) {
147- this .getDeclaringType ( ) instanceof DeltaClass and
148- this .hasName ( "GetInstance" )
149- }
150- }
151-
152152/** `Delta<T>.GetInstance()` returns the tracked entity, carrying the same taint as the `Delta<T>` itself. */
153153private class DeltaGetInstanceTaintStep extends AdditionalTaintStep {
154154 override predicate step ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
0 commit comments