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 {
118118 result = DataFlow:: Content:: getKnownElementIndex ( mc .getArgument ( i ) ) .serialize ( )
119119 }
120120
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+ */
121140 private class ExtractSummary extends SummarizedCallable {
122141 MethodCall mc ;
123142
@@ -137,6 +156,9 @@ module ActiveSupport {
137156 output = "ReturnValue.Element[" + s + "!]"
138157 )
139158 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"
140162 input =
141163 "Argument[self]" +
142164 concat ( int i , string s |
You can’t perform that action at this time.
0 commit comments