@@ -662,16 +662,40 @@ module Make<
662662 unsupportedCallable ( callable , _, _, _)
663663 }
664664
665+ private predicate isRelevantSource (
666+ SourceElement e , string output , string kind , Provenance provenance , string model
667+ ) {
668+ e .isSource ( output , kind , provenance , model ) and
669+ (
670+ provenance .isManual ( )
671+ or
672+ provenance .isGenerated ( ) and
673+ not exists ( Provenance p | p .isManual ( ) and e .isSource ( _, kind , p , _) )
674+ )
675+ }
676+
677+ private predicate isRelevantSink (
678+ SinkElement e , string input , string kind , Provenance provenance , string model
679+ ) {
680+ e .isSink ( input , kind , provenance , model ) and
681+ (
682+ provenance .isManual ( )
683+ or
684+ provenance .isGenerated ( ) and
685+ not exists ( Provenance p | p .isManual ( ) and e .isSink ( _, kind , p , _) )
686+ )
687+ }
688+
665689 private predicate summarySpec ( string spec ) {
666690 exists ( SummarizedCallable c |
667691 c .propagatesFlow ( spec , _, _, _)
668692 or
669693 c .propagatesFlow ( _, spec , _, _)
670694 )
671695 or
672- any ( SourceElement s ) . isSource ( spec , _, _, _)
696+ isRelevantSource ( _ , spec , _, _, _)
673697 or
674- any ( SinkElement s ) . isSink ( spec , _, _, _)
698+ isRelevantSink ( _ , spec , _, _, _)
675699 }
676700
677701 import AccessPathSyntax:: AccessPath< summarySpec / 1 >
@@ -1034,7 +1058,7 @@ module Make<
10341058 SourceElement source , SummaryComponentStack s , string kind , string model
10351059 ) {
10361060 exists ( string outSpec |
1037- source . isSource ( outSpec , kind , _, model ) and
1061+ isRelevantSource ( source , outSpec , kind , _, model ) and
10381062 External:: interpretSpec ( outSpec , s )
10391063 )
10401064 }
@@ -1057,7 +1081,7 @@ module Make<
10571081 SinkElement sink , SummaryComponentStack s , string kind , string model
10581082 ) {
10591083 exists ( string inSpec |
1060- sink . isSink ( inSpec , kind , _, model ) and
1084+ isRelevantSink ( sink , inSpec , kind , _, model ) and
10611085 External:: interpretSpec ( inSpec , s )
10621086 )
10631087 }
0 commit comments