Skip to content

Commit fd3738b

Browse files
committed
Refactor to using SourceNode::getSourceType
1 parent 31d4d0c commit fd3738b

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

csharp/ql/src/Security Features/CWE-089/SqlInjection.ql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@
1414
import csharp
1515
import semmle.code.csharp.security.dataflow.SqlInjectionQuery
1616
import SqlInjection::PathGraph
17-
import semmle.code.csharp.security.dataflow.flowsources.Remote
18-
import semmle.code.csharp.security.dataflow.flowsources.Local
17+
import semmle.code.csharp.security.dataflow.flowsources.FlowSources
1918

20-
string getSourceType(DataFlow::Node node) {
21-
result = node.(RemoteFlowSource).getSourceType()
22-
or
23-
result = node.(LocalFlowSource).getSourceType()
24-
}
19+
string getSourceType(DataFlow::Node node) { result = node.(SourceNode).getSourceType() }
2520

2621
from SqlInjection::PathNode source, SqlInjection::PathNode sink
2722
where SqlInjection::flowPath(source, sink)

csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
*/
1313

1414
import csharp
15-
import semmle.code.csharp.security.dataflow.flowsources.Remote
16-
import semmle.code.csharp.security.dataflow.flowsources.Local
15+
import semmle.code.csharp.security.dataflow.flowsources.FlowSources
1716
import semmle.code.csharp.frameworks.Format
1817
import FormatString::PathGraph
1918

@@ -31,11 +30,7 @@ module FormatStringConfig implements DataFlow::ConfigSig {
3130

3231
module FormatString = TaintTracking::Global<FormatStringConfig>;
3332

34-
string getSourceType(DataFlow::Node node) {
35-
result = node.(RemoteFlowSource).getSourceType()
36-
or
37-
result = node.(LocalFlowSource).getSourceType()
38-
}
33+
string getSourceType(DataFlow::Node node) { result = node.(SourceNode).getSourceType() }
3934

4035
from FormatString::PathNode source, FormatString::PathNode sink
4136
where FormatString::flowPath(source, sink)

0 commit comments

Comments
 (0)