File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
ruby/ql/lib/codeql/ruby/frameworks Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,25 @@ module ActiveSupport {
118
118
result = DataFlow:: Content:: getKnownElementIndex ( mc .getArgument ( i ) ) .serialize ( )
119
119
}
120
120
121
+ /**
122
+ *A flow summary for `Hash#extract!`. This method removes the key/value pairs
123
+ *matching the given keys from the receiver and returns them (as a Hash).
124
+ *
125
+ *Example:
126
+ *
127
+ *```rb
128
+ * hash = { a: 1, b: 2, c: 3, d: 4 }
129
+ * hash.extract!(:a, :b) # => {:a=>1, :b=>2}
130
+ * hash # => {:c=>3, :d=>4}
131
+ *```
132
+ *
133
+ * There is value flow from elements corresponding to keys in the
134
+ * arguments (`:a` and `:b` in the example) to elements in
135
+ * the return value.
136
+ * There is also value flow from any element corresponding to a key _not_
137
+ * mentioned in the arguments to an element in `self`, including elements
138
+ * at unknown keys.
139
+ */
121
140
private class ExtractSummary extends SummarizedCallable {
122
141
MethodCall mc ;
123
142
@@ -137,6 +156,9 @@ module ActiveSupport {
137
156
output = "ReturnValue.Element[" + s + "!]"
138
157
)
139
158
or
159
+ // Argument[self].WithoutElement[:a!, :b!].WithElement[any] means
160
+ // "an element of self whose key is not :a or :b, including elements
161
+ // with unknown keys"
140
162
input =
141
163
"Argument[self]" +
142
164
concat ( int i , string s |
You can’t perform that action at this time.
0 commit comments