Skip to content

Commit cfb0a86

Browse files
authored
Merge pull request #16356 from michaelnebel/csharp/aligntelemetryimplementation
C#: Base telemetry Api Source/Sink nodes on abstract classes.
2 parents 5c74beb + 757cf8d commit cfb0a86

27 files changed

+132
-186
lines changed

csharp/ql/lib/semmle/code/csharp/security/dataflow/CodeInjectionQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import csharp
6+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
67
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
78
private import semmle.code.csharp.frameworks.system.codedom.Compiler
89
private import semmle.code.csharp.security.Sanitizers
@@ -16,7 +17,7 @@ abstract class Source extends DataFlow::Node { }
1617
/**
1718
* A data flow sink for user input treated as code vulnerabilities.
1819
*/
19-
abstract class Sink extends DataFlow::ExprNode { }
20+
abstract class Sink extends ApiSinkExprNode { }
2021

2122
/**
2223
* A sanitizer for user input treated as code vulnerabilities.

csharp/ql/lib/semmle/code/csharp/security/dataflow/ConditionalBypassQuery.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import csharp
77
private import semmle.code.csharp.controlflow.Guards
88
private import semmle.code.csharp.controlflow.BasicBlocks
9+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
910
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
1011
private import semmle.code.csharp.frameworks.System
1112
private import semmle.code.csharp.frameworks.system.Net
@@ -14,12 +15,12 @@ private import semmle.code.csharp.security.SensitiveActions
1415
/**
1516
* A data flow source for user-controlled bypass of sensitive method.
1617
*/
17-
abstract class Source extends DataFlow::Node { }
18+
abstract class Source extends ApiSourceNode { }
1819

1920
/**
2021
* A data flow sink for user-controlled bypass of sensitive method.
2122
*/
22-
abstract class Sink extends DataFlow::ExprNode {
23+
abstract class Sink extends ApiSinkExprNode {
2324
/** Gets the 'MethodCall' which is considered sensitive. */
2425
abstract MethodCall getSensitiveMethodCall();
2526
}

csharp/ql/lib/semmle/code/csharp/security/dataflow/ExposureOfPrivateInformationQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import csharp
6+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
67
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
78
private import semmle.code.csharp.security.dataflow.flowsinks.ExternalLocationSink
89
private import semmle.code.csharp.security.PrivateData
@@ -15,7 +16,7 @@ abstract class Source extends DataFlow::ExprNode { }
1516
/**
1617
* A data flow sink for private information flowing unencrypted to an external location.
1718
*/
18-
abstract class Sink extends DataFlow::ExprNode { }
19+
abstract class Sink extends ApiSinkExprNode { }
1920

2021
/**
2122
* A sanitizer for private information flowing unencrypted to an external location.

csharp/ql/lib/semmle/code/csharp/security/dataflow/HardcodedCredentialsQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ private import semmle.code.csharp.frameworks.Moq
99
private import semmle.code.csharp.frameworks.system.web.Security
1010
private import semmle.code.csharp.frameworks.system.security.cryptography.X509Certificates
1111
private import semmle.code.csharp.frameworks.Test
12+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
1213

1314
/**
1415
* A data flow source for hard coded credentials.
@@ -18,7 +19,7 @@ abstract class Source extends DataFlow::ExprNode { }
1819
/**
1920
* A data flow sink for hard coded credentials.
2021
*/
21-
abstract class Sink extends DataFlow::ExprNode {
22+
abstract class Sink extends ApiSinkExprNode {
2223
/**
2324
* Gets a description of this sink, including a placeholder for the sink and a placeholder for
2425
* the supplementary element.

csharp/ql/lib/semmle/code/csharp/security/dataflow/LDAPInjectionQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import csharp
7+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
78
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
89
private import semmle.code.csharp.frameworks.system.DirectoryServices
910
private import semmle.code.csharp.frameworks.system.directoryservices.Protocols
@@ -18,7 +19,7 @@ abstract class Source extends DataFlow::Node { }
1819
/**
1920
* A data flow sink for unvalidated user input that is used to construct LDAP queries.
2021
*/
21-
abstract class Sink extends DataFlow::ExprNode { }
22+
abstract class Sink extends ApiSinkExprNode { }
2223

2324
/**
2425
* A sanitizer for unvalidated user input that is used to construct LDAP queries.

csharp/ql/lib/semmle/code/csharp/security/dataflow/LogForgingQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import csharp
6+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
67
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
78
private import semmle.code.csharp.frameworks.System
89
private import semmle.code.csharp.frameworks.system.text.RegularExpressions
@@ -18,7 +19,7 @@ abstract class Source extends DataFlow::Node { }
1819
/**
1920
* A data flow sink for untrusted user input used in log entries.
2021
*/
21-
abstract class Sink extends DataFlow::ExprNode { }
22+
abstract class Sink extends ApiSinkExprNode { }
2223

2324
/**
2425
* A sanitizer for untrusted user input used in log entries.

csharp/ql/lib/semmle/code/csharp/security/dataflow/MissingXMLValidationQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import csharp
7+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
78
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
89
private import semmle.code.csharp.frameworks.system.Xml
910
private import semmle.code.csharp.security.Sanitizers
@@ -18,7 +19,7 @@ abstract class Source extends DataFlow::Node { }
1819
* A data flow sink for untrusted user input processed as XML without validation against a known
1920
* schema.
2021
*/
21-
abstract class Sink extends DataFlow::ExprNode {
22+
abstract class Sink extends ApiSinkExprNode {
2223
/** Gets a string describing the reason why this is a sink. */
2324
abstract string getReason();
2425
}

csharp/ql/lib/semmle/code/csharp/security/dataflow/ReDoSQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import csharp
77
private import semmle.code.csharp.dataflow.DataFlow2
8+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
89
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
910
private import semmle.code.csharp.frameworks.system.text.RegularExpressions
1011
private import semmle.code.csharp.security.Sanitizers
@@ -17,7 +18,7 @@ abstract class Source extends DataFlow::Node { }
1718
/**
1819
* A data flow sink for untrusted user input used in dangerous regular expression operations.
1920
*/
20-
abstract class Sink extends DataFlow::ExprNode { }
21+
abstract class Sink extends ApiSinkExprNode { }
2122

2223
/**
2324
* A sanitizer for untrusted user input used in dangerous regular expression operations.

csharp/ql/lib/semmle/code/csharp/security/dataflow/RegexInjectionQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import csharp
7+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
78
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
89
private import semmle.code.csharp.frameworks.system.text.RegularExpressions
910
private import semmle.code.csharp.security.Sanitizers
@@ -16,7 +17,7 @@ abstract class Source extends DataFlow::Node { }
1617
/**
1718
* A data flow sink for untrusted user input used to construct regular expressions.
1819
*/
19-
abstract class Sink extends DataFlow::ExprNode { }
20+
abstract class Sink extends ApiSinkExprNode { }
2021

2122
/**
2223
* A sanitizer for untrusted user input used to construct regular expressions.

csharp/ql/lib/semmle/code/csharp/security/dataflow/ResourceInjectionQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import csharp
6+
private import semmle.code.csharp.security.dataflow.flowsinks.FlowSinks
67
private import semmle.code.csharp.security.dataflow.flowsources.FlowSources
78
private import semmle.code.csharp.frameworks.system.Data
89
private import semmle.code.csharp.security.Sanitizers
@@ -15,7 +16,7 @@ abstract class Source extends DataFlow::Node { }
1516
/**
1617
* A data flow sink for untrusted user input used in resource descriptors.
1718
*/
18-
abstract class Sink extends DataFlow::ExprNode { }
19+
abstract class Sink extends ApiSinkExprNode { }
1920

2021
/**
2122
* A sanitizer for untrusted user input used in resource descriptors.

0 commit comments

Comments
 (0)