Skip to content

Commit f8dbbe0

Browse files
committed
C#/Java: Materialize sink/source/summary predicates to avoid join on input/output before filtering.
1 parent 6e94849 commit f8dbbe0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

csharp/ql/src/Telemetry/ExternalApi.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,21 @@ class ExternalApi extends DotNet::Callable {
8585
}
8686

8787
/** Holds if this API has a supported summary. */
88+
pragma[nomagic]
8889
predicate hasSummary() {
8990
this instanceof SummarizedCallable
9091
or
9192
defaultAdditionalTaintStep(this.getAnInput(), _)
9293
}
9394

9495
/** Holds if this API is a known source. */
96+
pragma[nomagic]
9597
predicate isSource() {
9698
this.getAnOutput() instanceof RemoteFlowSource or sourceNode(this.getAnOutput(), _)
9799
}
98100

99101
/** Holds if this API is a known sink. */
102+
pragma[nomagic]
100103
predicate isSink() { sinkNode(this.getAnInput(), _) }
101104

102105
/** Holds if this API is supported by existing CodeQL libraries, that is, it is either a recognized source or sink or has a flow summary. */

java/ql/src/Telemetry/ExternalApi.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,19 @@ class ExternalApi extends Callable {
7474
}
7575

7676
/** Holds if this API has a supported summary. */
77+
pragma[nomagic]
7778
predicate hasSummary() {
7879
this = any(SummarizedCallable sc).asCallable() or
7980
TaintTracking::localAdditionalTaintStep(this.getAnInput(), _)
8081
}
8182

83+
pragma[nomagic]
8284
predicate isSource() {
8385
this.getAnOutput() instanceof RemoteFlowSource or sourceNode(this.getAnOutput(), _)
8486
}
8587

8688
/** Holds if this API is a known sink. */
89+
pragma[nomagic]
8790
predicate isSink() { sinkNode(this.getAnInput(), _) }
8891

8992
/** Holds if this API is supported by existing CodeQL libraries, that is, it is either a recognized source or sink or has a flow summary. */

0 commit comments

Comments
 (0)