Skip to content

Commit e908b09

Browse files
committed
C#: Always use PathNode in a path-problem query.
1 parent eddc528 commit e908b09

29 files changed

+91
-82
lines changed

csharp/ql/src/Security Features/CWE-022/TaintedPath.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1818

1919
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
2020
where c.hasFlowPath(source, sink)
21-
select sink, source, sink,
22-
"$@ flows to here and is used in a path.", source, "User-provided value"
21+
select sink.getNode(), source, sink,
22+
"$@ flows to here and is used in a path.", source.getNode(), "User-provided value"

csharp/ql/src/Security Features/CWE-022/ZipSlip.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1717

1818
from TaintTrackingConfiguration zipTaintTracking, DataFlow::PathNode source, DataFlow::PathNode sink
1919
where zipTaintTracking.hasFlowPath(source, sink)
20-
select sink, source, sink,
21-
"Unsanitized zip archive $@, which may contain '..', is used in a file system operation.", source, "item path"
20+
select sink.getNode(), source, sink,
21+
"Unsanitized zip archive $@, which may contain '..', is used in a file system operation.", source.getNode(), "item path"

csharp/ql/src/Security Features/CWE-078/CommandInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1818

1919
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
2020
where c.hasFlowPath(source, sink)
21-
select sink, source, sink,
22-
"$@ flows to here and is used in a command.", source, "User-provided value"
21+
select sink.getNode(), source, sink,
22+
"$@ flows to here and is used in a command.", source.getNode(), "User-provided value"

csharp/ql/src/Security Features/CWE-078/StoredCommandInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {
2525

2626
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
2727
where c.hasFlowPath(source, sink)
28-
select sink, source, sink,
29-
"$@ flows to here and is used in a command.", source, "Stored user-provided value"
28+
select sink.getNode(), source, sink,
29+
"$@ flows to here and is used in a command.", source.getNode(), "Stored user-provided value"

csharp/ql/src/Security Features/CWE-079/StoredXSS.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {
2121
}
2222
}
2323

24-
from StoredTaintTrackingConfiguration c, StoredFlowSource source, Sink sink, string explanation
25-
where c.hasFlow(source, sink)
24+
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink, string explanation
25+
where c.hasFlowPath(source, sink)
2626
and
27-
if exists(sink.explanation())
28-
then explanation = ": " + sink.explanation() + "."
27+
if exists(sink.getNode().(Sink).explanation())
28+
then explanation = ": " + sink.getNode().(Sink).explanation() + "."
2929
else explanation = "."
30-
select sink, source.getPathNode(c), sink.getPathNode(c),
31-
"$@ flows to here and is written to HTML or JavaScript" + explanation, source, "Stored user-provided value"
30+
select sink.getNode(), source, sink,
31+
"$@ flows to here and is written to HTML or JavaScript" + explanation, source.getNode(), "Stored user-provided value"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ class StoredTaintTrackingConfiguration extends SqlInjection::TaintTrackingConfig
2323

2424
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
2525
where c.hasFlowPath(source, sink)
26-
select sink, source, sink,
27-
"$@ flows to here and is used in an SQL query.", source, "Stored user-provided value"
26+
select sink.getNode(), source, sink,
27+
"$@ flows to here and is used in an SQL query.", source.getNode(), "Stored user-provided value"

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import csharp
1414
import semmle.code.csharp.security.dataflow.SqlInjection::SqlInjection
1515
import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1616

17-
from TaintTrackingConfiguration c, RemoteFlowSource source, Sink sink
18-
where c.hasFlow(source, sink)
19-
select sink, source.getPathNode(c), sink.getPathNode(c),
20-
"Query might include code from $@.", source, ("this " + source.getSourceType())
17+
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
18+
where c.hasFlowPath(source, sink)
19+
select sink.getNode(), source, sink,
20+
"Query might include code from $@.", source, ("this " + source.getNode().(RemoteFlowSource).getSourceType())

csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1515

1616
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
1717
where c.hasFlowPath(source, sink)
18-
select sink, source, sink,
19-
"$@ flows to here and is used in an LDAP query.", source, "User-provided value"
18+
select sink.getNode(), source, sink,
19+
"$@ flows to here and is used in an LDAP query.", source.getNode(), "User-provided value"

csharp/ql/src/Security Features/CWE-090/StoredLDAPInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {
2222

2323
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
2424
where c.hasFlowPath(source, sink)
25-
select sink, source, sink,
26-
"$@ flows to here and is used in an LDAP query.", source, "Stored user-provided value"
25+
select sink.getNode(), source, sink,
26+
"$@ flows to here and is used in an LDAP query.", source.getNode(), "Stored user-provided value"

csharp/ql/src/Security Features/CWE-094/CodeInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1717

1818
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
1919
where c.hasFlowPath(source, sink)
20-
select sink, source, sink,
21-
"$@ flows to here and is compiled as code.", source, "User-provided value"
20+
select sink.getNode(), source, sink,
21+
"$@ flows to here and is compiled as code.", source.getNode(), "User-provided value"

0 commit comments

Comments
 (0)