@@ -379,8 +379,12 @@ predicate looksLikeResolveClassStep(DataFlow::Node fromNode, DataFlow::Node toNo
379379
380380/** A sink representing an argument of a deserialization method */
381381private class UnsafeTypeSink extends DataFlow:: Node {
382+ MethodCall ma ;
383+
384+ MethodCall getMethodCall ( ) { result = ma }
385+
382386 UnsafeTypeSink ( ) {
383- exists ( MethodCall ma , int i , Expr arg | i > 0 and ma .getArgument ( i ) = arg |
387+ exists ( int i , Expr arg | i > 0 and ma .getArgument ( i ) = arg |
384388 (
385389 ma .getMethod ( ) instanceof ObjectMapperReadMethod
386390 or
@@ -425,6 +429,25 @@ module UnsafeTypeConfig implements DataFlow::ConfigSig {
425429 predicate isAdditionalFlowStep ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
426430 isUnsafeTypeAdditionalTaintStep ( fromNode , toNode )
427431 }
432+
433+ predicate observeDiffInformedIncrementalMode ( ) {
434+ // Since this configuration is for finding sinks to be used in a main
435+ // data-flow configuration, this configuration should only restrict the
436+ // sinks to be found if there are no main-configuration sources in the diff
437+ // range. That's because if there is such a source, we need to report query
438+ // results for it even with sinks outside the diff range.
439+ not UnsafeDeserializationFlow:: hasSourceInDiffRange ( )
440+ }
441+
442+ // The query does not select the sources of this configuration
443+ Location getASelectedSourceLocation ( DataFlow:: Node source ) { none ( ) }
444+
445+ Location getASelectedSinkLocation ( DataFlow:: Node sink ) {
446+ // Match by the surrounding method call since the sink of the overall
447+ // query will be contained in that (see the body of
448+ // `unsafeDeserialization/2`).
449+ result = sink .( UnsafeTypeSink ) .getMethodCall ( ) .getLocation ( )
450+ }
428451}
429452
430453/**
0 commit comments