File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
csharp/ql/src/Security Features/CWE-502 Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 13
13
import csharp
14
14
import semmle.code.csharp.security.dataflow.UnsafeDeserialization:: UnsafeDeserialization
15
15
16
- from Call deserializeCall , InstanceMethodSink sink
16
+ from Call deserializeCall , DataFlow :: Node sink
17
17
where
18
18
deserializeCall .getAnArgument ( ) = sink .asExpr ( ) and
19
- not exists (
20
- SafeConstructorTrackingConfig safeConstructorTracking , DataFlow:: PathNode safeCreation ,
21
- DataFlow:: PathNode safeTypeUsage
22
- |
23
- safeConstructorTracking .hasFlowPath ( safeCreation , safeTypeUsage ) and
24
- safeTypeUsage .getNode ( ) .asExpr ( ) .getParent ( ) = deserializeCall
19
+ (
20
+ sink instanceof InstanceMethodSink and
21
+ not exists (
22
+ SafeConstructorTrackingConfig safeConstructorTracking , DataFlow:: PathNode safeCreation ,
23
+ DataFlow:: PathNode safeTypeUsage
24
+ |
25
+ safeConstructorTracking .hasFlowPath ( safeCreation , safeTypeUsage ) and
26
+ safeTypeUsage .getNode ( ) .asExpr ( ) .getParent ( ) = deserializeCall
27
+ )
28
+ or
29
+ sink instanceof ConstructorOrStaticMethodSink and
30
+ deserializeCall .getAnArgument ( ) = sink .asExpr ( )
25
31
)
26
- or
27
- exists ( ConstructorOrStaticMethodSink sink2 | deserializeCall .getAnArgument ( ) = sink2 .asExpr ( ) )
28
32
select deserializeCall ,
29
33
"Unsafe deserializer is used. Make sure the value being deserialized comes from a trusted source."
You can’t perform that action at this time.
0 commit comments