Skip to content

Commit eb7e401

Browse files
committed
C#: Re-factor ThreadUnsafeICryptoTransformLambda to use the new API.
1 parent e3cbeba commit eb7e401

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.ql

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,20 @@ import csharp
1818
import ParallelSink
1919
import ICryptoTransform
2020

21-
class NotThreadSafeCryptoUsageIntoParallelInvokeConfig extends TaintTracking::Configuration {
22-
NotThreadSafeCryptoUsageIntoParallelInvokeConfig() {
23-
this = "NotThreadSafeCryptoUsageIntoParallelInvokeConfig"
24-
}
25-
26-
override predicate isSource(DataFlow::Node source) {
21+
module NotThreadSafeCryptoUsageIntoParallelInvokeConfig implements DataFlow::ConfigSig {
22+
predicate isSource(DataFlow::Node source) {
2723
source instanceof LambdaCapturingICryptoTransformSource
2824
}
2925

30-
override predicate isSink(DataFlow::Node sink) { sink instanceof ParallelSink }
26+
predicate isSink(DataFlow::Node sink) { sink instanceof ParallelSink }
3127
}
3228

33-
from Expr e, string m, LambdaExpr l, NotThreadSafeCryptoUsageIntoParallelInvokeConfig config
29+
module NotThreadSafeCryptoUsageIntoParallelInvoke =
30+
TaintTracking::Global<NotThreadSafeCryptoUsageIntoParallelInvokeConfig>;
31+
32+
from Expr e, string m, LambdaExpr l
3433
where
35-
config.hasFlow(DataFlow::exprNode(l), DataFlow::exprNode(e)) and
34+
NotThreadSafeCryptoUsageIntoParallelInvoke::flow(DataFlow::exprNode(l), DataFlow::exprNode(e)) and
3635
m =
3736
"A $@ seems to be used to start a new thread is capturing a local variable that either implements 'System.Security.Cryptography.ICryptoTransform' or has a field of this type."
3837
select e, m, l, "lambda expression"

0 commit comments

Comments
 (0)