Skip to content

Commit d88f557

Browse files
authored
Merge pull request github#13683 from asgerf/rb/api-graph-noobject
Ruby: exclude Object class from API graph
2 parents e5cc5a1 + d8604ff commit d88f557

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2339
-1195
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/TypeTracker.qll

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ private module Cached {
5555
)
5656
}
5757

58-
pragma[nomagic]
59-
private TypeTracker noContentTypeTracker(boolean hasCall) {
60-
result = MkTypeTracker(hasCall, noContent())
61-
}
58+
/** Gets a type tracker with no content and the call bit set to the given value. */
59+
cached
60+
TypeTracker noContentTypeTracker(boolean hasCall) { result = MkTypeTracker(hasCall, noContent()) }
6261

6362
/** Gets the summary resulting from appending `step` to type-tracking summary `tt`. */
6463
cached
@@ -318,6 +317,8 @@ class StepSummary extends TStepSummary {
318317

319318
/** Provides predicates for updating step summaries (`StepSummary`s). */
320319
module StepSummary {
320+
predicate append = Cached::append/2;
321+
321322
/**
322323
* Gets the summary that corresponds to having taken a forwards
323324
* inter-procedural step from `nodeFrom` to `nodeTo`.
@@ -378,6 +379,35 @@ module StepSummary {
378379
}
379380

380381
deprecated predicate localSourceStoreStep = flowsToStoreStep/3;
382+
383+
/** Gets the step summary for a level step. */
384+
StepSummary levelStep() { result = LevelStep() }
385+
386+
/** Gets the step summary for a call step. */
387+
StepSummary callStep() { result = CallStep() }
388+
389+
/** Gets the step summary for a return step. */
390+
StepSummary returnStep() { result = ReturnStep() }
391+
392+
/** Gets the step summary for storing into `content`. */
393+
StepSummary storeStep(TypeTrackerContent content) { result = StoreStep(content) }
394+
395+
/** Gets the step summary for loading from `content`. */
396+
StepSummary loadStep(TypeTrackerContent content) { result = LoadStep(content) }
397+
398+
/** Gets the step summary for loading from `load` and then storing into `store`. */
399+
StepSummary loadStoreStep(TypeTrackerContent load, TypeTrackerContent store) {
400+
result = LoadStoreStep(load, store)
401+
}
402+
403+
/** Gets the step summary for a step that only permits contents matched by `filter`. */
404+
StepSummary withContent(ContentFilter filter) { result = WithContent(filter) }
405+
406+
/** Gets the step summary for a step that blocks contents matched by `filter`. */
407+
StepSummary withoutContent(ContentFilter filter) { result = WithoutContent(filter) }
408+
409+
/** Gets the step summary for a jump step. */
410+
StepSummary jumpStep() { result = JumpStep() }
381411
}
382412

383413
/**
@@ -540,6 +570,13 @@ module TypeTracker {
540570
* Gets a valid end point of type tracking.
541571
*/
542572
TypeTracker end() { result.end() }
573+
574+
/**
575+
* INTERNAL USE ONLY.
576+
*
577+
* Gets a valid end point of type tracking with the call bit set to the given value.
578+
*/
579+
predicate end = Cached::noContentTypeTracker/1;
543580
}
544581

545582
pragma[nomagic]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
category: majorAnalysis
3+
---
4+
* The API graph library (`codeql.ruby.ApiGraphs`) has been significantly improved, with better support for inheritance,
5+
and data-flow nodes can now be converted to API nodes by calling `.track()` or `.backtrack()` on the node.
6+
API graphs allow for efficient modelling of how a given value is used by the code base, or how values produced by the code base
7+
are consumed by a library. See the documentation for `API::Node` for details and examples.

0 commit comments

Comments
 (0)