Skip to content

Commit 4c06fbd

Browse files
committed
Ruby: Sync files and make manual changes.
1 parent 42c7006 commit 4c06fbd

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,21 @@ module Public {
296296
predicate hasProvenance(Provenance provenance) { provenance = "manual" }
297297
}
298298

299-
/** A callable where there is no flow via the callable. */
300-
class NeutralCallable extends SummarizedCallableBase {
299+
/**
300+
* A callable where there is no flow via the callable.
301+
*/
302+
class NeutralSummaryCallable extends NeutralCallable {
303+
NeutralSummaryCallable() { this.getKind() = "summary" }
304+
}
305+
306+
/**
307+
* A callable that has a neutral model.
308+
*/
309+
class NeutralCallable extends NeutralCallableBase {
310+
private string kind;
301311
private Provenance provenance;
302312

303-
NeutralCallable() { neutralSummaryElement(this, provenance) }
313+
NeutralCallable() { neutralElement(this, kind, provenance) }
304314

305315
/**
306316
* Holds if the neutral is auto generated.
@@ -316,6 +326,11 @@ module Public {
316326
* Holds if the neutral has provenance `p`.
317327
*/
318328
predicate hasProvenance(Provenance p) { p = provenance }
329+
330+
/**
331+
* Gets the kind of the neutral.
332+
*/
333+
string getKind() { result = kind }
319334
}
320335
}
321336

@@ -1318,6 +1333,8 @@ module Private {
13181333
/** Gets the string representation of this callable used by `neutral/1`. */
13191334
abstract string getCallableCsv();
13201335

1336+
string getKind() { result = super.getKind() }
1337+
13211338
string toString() { result = super.toString() }
13221339
}
13231340

@@ -1364,6 +1381,7 @@ module Private {
13641381
exists(RelevantNeutralCallable c |
13651382
csv =
13661383
c.getCallableCsv() // Callable information
1384+
+ c.getKind() + ";" // kind
13671385
+ renderProvenanceNeutral(c) // provenance
13681386
)
13691387
}

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@ private import FlowSummaryImpl::Private
1111
private import FlowSummaryImpl::Public
1212
private import codeql.ruby.dataflow.FlowSummary as FlowSummary
1313

14+
/**
15+
* A class of callables that are candidates for flow summary modeling.
16+
*/
1417
class SummarizedCallableBase = string;
1518

19+
/**
20+
* A class of callables that are candidates for neutral modeling.
21+
*/
22+
class NeutralCallableBase = string;
23+
1624
DataFlowCallable inject(SummarizedCallable c) { result.asLibraryCallable() = c }
1725

1826
/** Gets the parameter position representing a callback itself, if any. */
@@ -62,11 +70,11 @@ predicate summaryElement(
6270
}
6371

6472
/**
65-
* Holds if a neutral summary model exists for `c` with provenance `provenance`,
66-
* which means that there is no flow through `c`.
73+
* Holds if a neutral model exists for `c` of kind `kind`
74+
* and with provenance `provenance`.
6775
* Note. Neutral models have not been implemented for Ruby.
6876
*/
69-
predicate neutralSummaryElement(FlowSummary::SummarizedCallable c, string provenance) { none() }
77+
predicate neutralElement(NeutralCallableBase c, string kind, string provenance) { none() }
7078

7179
bindingset[arg]
7280
private SummaryComponent interpretElementArg(string arg) {

0 commit comments

Comments
 (0)