Skip to content

Commit 564c76c

Browse files
committed
Address review comments
1 parent 08dc6d7 commit 564c76c

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

ql/lib/codeql/ruby/dataflow/FlowSummary.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ module SummaryComponent {
1818

1919
predicate argument = SC::argument/1;
2020

21+
predicate content = SC::content/1;
22+
2123
/** Gets a summary component that represents a qualifier. */
2224
SummaryComponent qualifier() { result = argument(-1) }
2325

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

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,37 +63,51 @@ predicate sourceElement(AstNode n, string output, string kind) { none() }
6363
*/
6464
predicate sinkElement(AstNode n, string input, string kind) { none() }
6565

66-
/** Gets the summary component for specification component `c`, if any. */
66+
/**
67+
* Gets the summary component for specification component `c`, if any.
68+
*
69+
* This covers all the Ruby-specific components of a flow summary, and
70+
* is currently restricted to `"BlockArgument"`.
71+
*/
6772
SummaryComponent interpretComponentSpecific(string c) {
6873
c = "BlockArgument" and
6974
result = FlowSummary::SummaryComponent::block()
7075
}
7176

72-
class SourceOrSinkElement = AstNode;
73-
7477
/** Gets the return kind corresponding to specification `"ReturnValue"`. */
7578
NormalReturnKind getReturnValueKind() { any() }
7679

77-
/** An entity used to interpret a source/sink specification. */
78-
class InterpretNode extends AstNode {
79-
/** Gets the element that this node corresponds to, if any. */
80-
SourceOrSinkElement asElement() { none() }
80+
/**
81+
* All definitions in this module are required by the shared implementation
82+
* (for source/sink interpretation), but they are unused for Ruby, where
83+
* we rely on API graphs instead.
84+
*/
85+
private module UnusedSourceSinkInterpretation {
86+
class SourceOrSinkElement = AstNode;
8187

82-
/** Gets the data-flow node that this node corresponds to, if any. */
83-
Node asNode() { none() }
88+
/** An entity used to interpret a source/sink specification. */
89+
class InterpretNode extends AstNode {
90+
/** Gets the element that this node corresponds to, if any. */
91+
SourceOrSinkElement asElement() { none() }
8492

85-
/** Gets the call that this node corresponds to, if any. */
86-
DataFlowCall asCall() { none() }
93+
/** Gets the data-flow node that this node corresponds to, if any. */
94+
Node asNode() { none() }
8795

88-
/** Gets the callable that this node corresponds to, if any. */
89-
DataFlowCallable asCallable() { none() }
96+
/** Gets the call that this node corresponds to, if any. */
97+
DataFlowCall asCall() { none() }
9098

91-
/** Gets the target of this call, if any. */
92-
Callable getCallTarget() { none() }
93-
}
99+
/** Gets the callable that this node corresponds to, if any. */
100+
DataFlowCallable asCallable() { none() }
101+
102+
/** Gets the target of this call, if any. */
103+
Callable getCallTarget() { none() }
104+
}
94105

95-
/** Provides additional sink specification logic required for attributes. */
96-
predicate interpretOutputSpecific(string c, InterpretNode mid, InterpretNode node) { none() }
106+
/** Provides additional sink specification logic. */
107+
predicate interpretOutputSpecific(string c, InterpretNode mid, InterpretNode node) { none() }
108+
109+
/** Provides additional source specification logic. */
110+
predicate interpretInputSpecific(string c, InterpretNode mid, InterpretNode node) { none() }
111+
}
97112

98-
/** Provides additional sink specification logic required for attributes. */
99-
predicate interpretInputSpecific(string c, InterpretNode mid, InterpretNode n) { none() }
113+
import UnusedSourceSinkInterpretation

0 commit comments

Comments
 (0)