Skip to content

Commit 253c658

Browse files
committed
C#: Tolerate missing call targets in LogMessageSink
1 parent f0e20fa commit 253c658

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsinks/ExternalLocationSink.qll

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ private class ExternalModelSink extends ExternalLocationSink {
2727
*/
2828
class LogMessageSink extends ExternalLocationSink {
2929
LogMessageSink() {
30-
this.getExpr() = any(LoggerType i).getAMethod().getACall().getAnArgument()
31-
or
30+
this.getExpr() = any(LoggerType i).getAMethod().getACall().getAnArgument() or
31+
this.getExpr() =
32+
any(MethodCall call | call.getQualifier().getType() instanceof LoggerType).getAnArgument() or
3233
this.getExpr() =
3334
any(ExtensionMethodCall call |
3435
call.getTarget().(ExtensionMethod).getExtendedType() instanceof LoggerType

csharp/ql/test/library-tests/standalone/externalLocationSink/externalLocationSink.expected

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#select
2+
| standalone.cs:20:20:20:20 | access to parameter s | standalone.cs:20:20:20:20 | access to parameter s |
3+
| standalone.cs:25:28:25:32 | "abc" | standalone.cs:25:28:25:32 | "abc" |
24
compilationErrors
35
| standalone.cs:16:12:16:18 | CS0104: 'ILogger' is an ambiguous reference between 'A.ILogger' and 'B.ILogger' |
46
methodCalls

0 commit comments

Comments
 (0)