@@ -759,8 +759,8 @@ module Private {
759
759
}
760
760
761
761
pragma [ nomagic]
762
- private ParamNode summaryArgParam0 ( DataFlowCall call , ArgNode arg ) {
763
- exists ( ParameterPosition ppos , SummarizedCallable sc |
762
+ private ParamNode summaryArgParam0 ( DataFlowCall call , ArgNode arg , SummarizedCallable sc ) {
763
+ exists ( ParameterPosition ppos |
764
764
argumentPositionMatch ( call , arg , ppos ) and
765
765
viableParam ( call , sc , ppos , result )
766
766
)
@@ -774,9 +774,9 @@ module Private {
774
774
* or expects contents.
775
775
*/
776
776
pragma [ nomagic]
777
- predicate prohibitsUseUseFlow ( ArgNode arg ) {
777
+ predicate prohibitsUseUseFlow ( ArgNode arg , SummarizedCallable sc ) {
778
778
exists ( ParamNode p , Node mid , ParameterPosition ppos , Node ret |
779
- p = summaryArgParam0 ( _, arg ) and
779
+ p = summaryArgParam0 ( _, arg , sc ) and
780
780
p .isParameterOf ( _, ppos ) and
781
781
summaryLocalStep ( p , mid , true ) and
782
782
summaryLocalStep ( mid , ret , true ) and
@@ -788,9 +788,11 @@ module Private {
788
788
}
789
789
790
790
bindingset [ ret]
791
- private ParamNode summaryArgParam ( ArgNode arg , ReturnNodeExt ret , OutNodeExt out ) {
791
+ private ParamNode summaryArgParam (
792
+ ArgNode arg , ReturnNodeExt ret , OutNodeExt out , SummarizedCallable sc
793
+ ) {
792
794
exists ( DataFlowCall call , ReturnKindExt rk |
793
- result = summaryArgParam0 ( call , arg ) and
795
+ result = summaryArgParam0 ( call , arg , sc ) and
794
796
ret .getKind ( ) = pragma [ only_bind_into ] ( rk ) and
795
797
out = pragma [ only_bind_into ] ( rk ) .getAnOutNode ( call )
796
798
)
@@ -803,9 +805,9 @@ module Private {
803
805
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
804
806
* be useful to include in the exposed local data-flow/taint-tracking relations.
805
807
*/
806
- predicate summaryThroughStepValue ( ArgNode arg , Node out ) {
808
+ predicate summaryThroughStepValue ( ArgNode arg , Node out , SummarizedCallable sc ) {
807
809
exists ( ReturnKind rk , ReturnNode ret , DataFlowCall call |
808
- summaryLocalStep ( summaryArgParam0 ( call , arg ) , ret , true ) and
810
+ summaryLocalStep ( summaryArgParam0 ( call , arg , sc ) , ret , true ) and
809
811
ret .getKind ( ) = pragma [ only_bind_into ] ( rk ) and
810
812
out = getAnOutNode ( call , pragma [ only_bind_into ] ( rk ) )
811
813
)
@@ -818,8 +820,8 @@ module Private {
818
820
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
819
821
* be useful to include in the exposed local data-flow/taint-tracking relations.
820
822
*/
821
- predicate summaryThroughStepTaint ( ArgNode arg , Node out ) {
822
- exists ( ReturnNodeExt ret | summaryLocalStep ( summaryArgParam ( arg , ret , out ) , ret , false ) )
823
+ predicate summaryThroughStepTaint ( ArgNode arg , Node out , SummarizedCallable sc ) {
824
+ exists ( ReturnNodeExt ret | summaryLocalStep ( summaryArgParam ( arg , ret , out , sc ) , ret , false ) )
823
825
}
824
826
825
827
/**
@@ -829,9 +831,9 @@ module Private {
829
831
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
830
832
* be useful to include in the exposed local data-flow/taint-tracking relations.
831
833
*/
832
- predicate summaryGetterStep ( ArgNode arg , ContentSet c , Node out ) {
834
+ predicate summaryGetterStep ( ArgNode arg , ContentSet c , Node out , SummarizedCallable sc ) {
833
835
exists ( Node mid , ReturnNodeExt ret |
834
- summaryReadStep ( summaryArgParam ( arg , ret , out ) , c , mid ) and
836
+ summaryReadStep ( summaryArgParam ( arg , ret , out , sc ) , c , mid ) and
835
837
summaryLocalStep ( mid , ret , _)
836
838
)
837
839
}
@@ -843,9 +845,9 @@ module Private {
843
845
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
844
846
* be useful to include in the exposed local data-flow/taint-tracking relations.
845
847
*/
846
- predicate summarySetterStep ( ArgNode arg , ContentSet c , Node out ) {
848
+ predicate summarySetterStep ( ArgNode arg , ContentSet c , Node out , SummarizedCallable sc ) {
847
849
exists ( Node mid , ReturnNodeExt ret |
848
- summaryLocalStep ( summaryArgParam ( arg , ret , out ) , mid , _) and
850
+ summaryLocalStep ( summaryArgParam ( arg , ret , out , sc ) , mid , _) and
849
851
summaryStoreStep ( mid , c , ret )
850
852
)
851
853
}
@@ -929,14 +931,20 @@ module Private {
929
931
private class SummarizedCallableExternal extends SummarizedCallable {
930
932
SummarizedCallableExternal ( ) { summaryElement ( this , _, _, _, _) }
931
933
932
- private predicate relevantSummaryElement ( AccessPath inSpec , AccessPath outSpec , string kind ) {
933
- summaryElement ( this , inSpec , outSpec , kind , false )
934
- or
934
+ private predicate relevantSummaryElementGenerated (
935
+ AccessPath inSpec , AccessPath outSpec , string kind
936
+ ) {
935
937
summaryElement ( this , inSpec , outSpec , kind , true ) and
936
938
not summaryElement ( this , _, _, _, false ) and
937
939
not this .clearsContent ( _, _)
938
940
}
939
941
942
+ private predicate relevantSummaryElement ( AccessPath inSpec , AccessPath outSpec , string kind ) {
943
+ summaryElement ( this , inSpec , outSpec , kind , false )
944
+ or
945
+ this .relevantSummaryElementGenerated ( inSpec , outSpec , kind )
946
+ }
947
+
940
948
override predicate propagatesFlow (
941
949
SummaryComponentStack input , SummaryComponentStack output , boolean preservesValue
942
950
) {
@@ -951,7 +959,7 @@ module Private {
951
959
)
952
960
}
953
961
954
- override predicate isAutoGenerated ( ) { summaryElement ( this , _, _, _, true ) }
962
+ override predicate isAutoGenerated ( ) { this . relevantSummaryElementGenerated ( _, _, _) }
955
963
}
956
964
957
965
/** Holds if component `c` of specification `spec` cannot be parsed. */
0 commit comments