@@ -383,8 +383,12 @@ predicate looksLikeResolveClassStep(DataFlow::Node fromNode, DataFlow::Node toNo
383383
384384/** A sink representing an argument of a deserialization method */
385385private class UnsafeTypeSink extends DataFlow:: Node {
386+ MethodCall ma ;
387+
388+ MethodCall getMethodCall ( ) { result = ma }
389+
386390 UnsafeTypeSink ( ) {
387- exists ( MethodCall ma , int i , Expr arg | i > 0 and ma .getArgument ( i ) = arg |
391+ exists ( int i , Expr arg | i > 0 and ma .getArgument ( i ) = arg |
388392 (
389393 ma .getMethod ( ) instanceof ObjectMapperReadMethod
390394 or
@@ -429,6 +433,25 @@ module UnsafeTypeConfig implements DataFlow::ConfigSig {
429433 predicate isAdditionalFlowStep ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
430434 isUnsafeTypeAdditionalTaintStep ( fromNode , toNode )
431435 }
436+
437+ predicate observeDiffInformedIncrementalMode ( ) {
438+ // Since this configuration is for finding sinks to be used in a main
439+ // data-flow configuration, this configuration should only restrict the
440+ // sinks to be found if there are no main-configuration sources in the diff
441+ // range. That's because if there is such a source, we need to report query
442+ // results for it even with sinks outside the diff range.
443+ not UnsafeDeserializationFlow:: hasSourceInDiffRange ( )
444+ }
445+
446+ // The query does not select the sources of this configuration
447+ Location getASelectedSourceLocation ( DataFlow:: Node source ) { none ( ) }
448+
449+ Location getASelectedSinkLocation ( DataFlow:: Node sink ) {
450+ // Match by the surrounding method call since the sink of the overall
451+ // query will be contained in that (see the body of
452+ // `unsafeDeserialization/2`).
453+ result = sink .( UnsafeTypeSink ) .getMethodCall ( ) .getLocation ( )
454+ }
432455}
433456
434457/**
0 commit comments