@@ -662,7 +662,7 @@ private module Cached {
662662 )
663663 } or
664664 deprecated TSplatContent ( int i , Boolean shifted ) { i in [ 0 .. 10 ] } or
665- THashSplatContent ( ConstantValue:: ConstantSymbolValue cv ) or
665+ deprecated THashSplatContent ( ConstantValue:: ConstantSymbolValue cv ) or
666666 TCapturedVariableContent ( VariableCapture:: CapturedVariable v ) or
667667 // Only used by type-tracking
668668 TAttributeName ( string name ) { name = any ( SetterMethodCall c ) .getTargetName ( ) }
@@ -686,24 +686,16 @@ private module Cached {
686686 TUnknownElementContentApprox ( ) or
687687 TKnownIntegerElementContentApprox ( ) or
688688 TKnownElementContentApprox ( string approx ) { approx = approxKnownElementIndex ( _) } or
689- THashSplatContentApprox ( string approx ) { approx = approxKnownElementIndex ( _) } or
690689 TNonElementContentApprox ( Content c ) { not c instanceof Content:: ElementContent } or
691690 TCapturedVariableContentApprox ( VariableCapture:: CapturedVariable v )
692691
693692 cached
694693 newtype TDataFlowType =
695694 TLambdaDataFlowType ( Callable c ) { c = any ( LambdaSelfReferenceNode n ) .getCallable ( ) } or
696- // In order to reduce the set of cons-candidates, we annotate all implicit (hash) splat
697- // creations with the name of the method that they are passed into. This includes
698- // array/hash literals as well (where the name is simply `[]`), because of how they
699- // are modeled (see `Array.qll` and `Hash.qll`).
700- TSynthHashSplatArgumentType ( string methodName ) {
701- methodName = any ( SynthHashSplatArgumentNode n ) .getMethodName ( )
702- } or
703695 TUnknownDataFlowType ( )
704696}
705697
706- class TElementContent = TKnownElementContent or TUnknownElementContent or THashSplatContent ;
698+ class TElementContent = TKnownElementContent or TUnknownElementContent ;
707699
708700import Cached
709701
@@ -1118,18 +1110,6 @@ private module ParameterNodes {
11181110 *
11191111 * by adding read steps out of the synthesized parameter node to the relevant
11201112 * keyword parameters.
1121- *
1122- * In order to avoid redundancy (and improve performance) in cases like
1123- *
1124- * ```rb
1125- * foo(p1: taint(1), p2: taint(2))
1126- * ```
1127- *
1128- * where direct keyword matching is possible, we use a special `HashSplatContent`
1129- * (instead of reusing `KnownElementContent`) when we construct a synthesized hash
1130- * splat argument (`SynthHashSplatArgumentNode`) at the call site, and then only
1131- * add read steps out of this node for actual hash-splat arguments (which will use
1132- * a normal `KnownElementContent`).
11331113 */
11341114 class SynthHashSplatParameterNode extends ParameterNodeImpl , TSynthHashSplatParameterNode {
11351115 private DataFlowCallable callable ;
@@ -1436,24 +1416,7 @@ module ArgumentNodes {
14361416 not cv .isSymbol ( _)
14371417 )
14381418 |
1439- if call instanceof CfgNodes:: ExprNodes:: HashLiteralCfgNode
1440- then
1441- /*
1442- * Needed for cases like
1443- *
1444- * ```rb
1445- * hash = { a: taint, b: safe }
1446- *
1447- * def foo(a:, b:)
1448- * sink(a)
1449- * end
1450- *
1451- * foo(**hash)
1452- * ```
1453- */
1454-
1455- c .isSingleton ( Content:: getElementContent ( cv ) )
1456- else c .isSingleton ( THashSplatContent ( cv ) )
1419+ c .isSingleton ( Content:: getElementContent ( cv ) )
14571420 )
14581421 }
14591422
@@ -1938,11 +1901,8 @@ DataFlowType getNodeType(Node n) {
19381901 result = TLambdaDataFlowType ( c )
19391902 )
19401903 or
1941- result = TSynthHashSplatArgumentType ( n .( SynthHashSplatArgumentNode ) .getMethodName ( ) )
1942- or
19431904 not n instanceof LambdaSelfReferenceNode and
19441905 not mustHaveLambdaType ( n , _) and
1945- not n instanceof SynthHashSplatArgumentNode and
19461906 result = TUnknownDataFlowType ( )
19471907}
19481908
@@ -2168,11 +2128,6 @@ class ContentApprox extends TContentApprox {
21682128 result = "approximated element " + approx
21692129 )
21702130 or
2171- exists ( string s |
2172- this = THashSplatContentApprox ( s ) and
2173- result = "approximated hash-splat position " + s
2174- )
2175- or
21762131 exists ( Content c |
21772132 this = TNonElementContentApprox ( c ) and
21782133 result = c .toString ( )
@@ -2212,8 +2167,6 @@ ContentApprox getContentApprox(Content c) {
22122167 result =
22132168 TKnownElementContentApprox ( approxKnownElementIndex ( c .( Content:: KnownElementContent ) .getIndex ( ) ) )
22142169 or
2215- result = THashSplatContentApprox ( approxKnownElementIndex ( c .( Content:: HashSplatContent ) .getKey ( ) ) )
2216- or
22172170 result = TNonElementContentApprox ( c )
22182171}
22192172
0 commit comments