Skip to content

Commit ee188ac

Browse files
committed
Refactor and expand vulnerable call summarization
Replaces the previous query with three new predicates: vulnerableCallModel, publicVulnerableCallModel, and vulnerableCallLocations. These provide more granular exports for iterative model generation, API surface analysis, and direct call site listing, improving flexibility and clarity for downstream analysis. Now outputs fully qualified method names for use in recursive models.
1 parent d8f8926 commit ee188ac

1 file changed

Lines changed: 38 additions & 13 deletions

File tree

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,44 @@
11
/**
2-
* @name Methods that call vulnerable code
3-
* @description Lists all methods that transitively call a vulnerable method,
4-
* useful for generating models or understanding impact.
5-
* @kind problem
6-
* @problem.severity recommendation
7-
* @precision high
2+
* @name Summarize calls to vulnerable methods
3+
* @description Exports methods that transitively call vulnerable methods in a format
4+
* suitable for model generation and iterative dependency analysis.
5+
* @kind table
86
* @id binary/vulnerable-calls-summarize
97
*/
108

119
import VulnerableCalls
1210

13-
from CilMethodExt method, string id, string namespace, string className, string methodName
14-
where
15-
method = getAVulnerableMethod(id) and
16-
method.hasFullyQualifiedName(namespace, className, methodName)
17-
select method,
18-
"Method " + namespace + "." + className + "." + methodName +
19-
" transitively calls vulnerable code (" + id + ")"
11+
/**
12+
* Exports all methods that can reach vulnerable calls.
13+
* Output format matches the vulnerableCallModel extensible predicate for iterative analysis.
14+
*/
15+
query predicate vulnerableCallModel(
16+
string namespace, string className, string methodName, string id
17+
) {
18+
ExportedVulnerableCalls::pathToVulnerableMethod(namespace, className, methodName, id)
19+
}
20+
21+
/**
22+
* Exports only public methods that reach vulnerable calls (for API surface analysis).
23+
*/
24+
query predicate publicVulnerableCallModel(
25+
string namespace, string className, string methodName, string id
26+
) {
27+
ExportedVulnerableCalls::publicPathToVulnerableMethod(namespace, className, methodName, id)
28+
}
29+
30+
/**
31+
* Lists the direct vulnerable call sites with their enclosing method context.
32+
*/
33+
query predicate vulnerableCallLocations(
34+
VulnerableMethodCall call,
35+
string callerNamespace,
36+
string callerClassName,
37+
string callerMethodName,
38+
string targetFqn,
39+
string id
40+
) {
41+
call.getVulnerabilityId() = id and
42+
call.getEnclosingVulnerableMethod().hasFullyQualifiedName(callerNamespace, callerClassName, callerMethodName) and
43+
targetFqn = call.getCallTargetFullyQualifiedName()
44+
}

0 commit comments

Comments
 (0)