|
1 | 1 | /** |
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 |
8 | 6 | * @id binary/vulnerable-calls-summarize |
9 | 7 | */ |
10 | 8 |
|
11 | 9 | import VulnerableCalls |
12 | 10 |
|
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