@@ -662,7 +662,7 @@ private module Cached {
662
662
)
663
663
} or
664
664
deprecated TSplatContent ( int i , Boolean shifted ) { i in [ 0 .. 10 ] } or
665
- THashSplatContent ( ConstantValue:: ConstantSymbolValue cv ) or
665
+ deprecated THashSplatContent ( ConstantValue:: ConstantSymbolValue cv ) or
666
666
TCapturedVariableContent ( VariableCapture:: CapturedVariable v ) or
667
667
// Only used by type-tracking
668
668
TAttributeName ( string name ) { name = any ( SetterMethodCall c ) .getTargetName ( ) }
@@ -686,24 +686,16 @@ private module Cached {
686
686
TUnknownElementContentApprox ( ) or
687
687
TKnownIntegerElementContentApprox ( ) or
688
688
TKnownElementContentApprox ( string approx ) { approx = approxKnownElementIndex ( _) } or
689
- THashSplatContentApprox ( string approx ) { approx = approxKnownElementIndex ( _) } or
690
689
TNonElementContentApprox ( Content c ) { not c instanceof Content:: ElementContent } or
691
690
TCapturedVariableContentApprox ( VariableCapture:: CapturedVariable v )
692
691
693
692
cached
694
693
newtype TDataFlowType =
695
694
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
703
695
TUnknownDataFlowType ( )
704
696
}
705
697
706
- class TElementContent = TKnownElementContent or TUnknownElementContent or THashSplatContent ;
698
+ class TElementContent = TKnownElementContent or TUnknownElementContent ;
707
699
708
700
import Cached
709
701
@@ -1118,18 +1110,6 @@ private module ParameterNodes {
1118
1110
*
1119
1111
* by adding read steps out of the synthesized parameter node to the relevant
1120
1112
* 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`).
1133
1113
*/
1134
1114
class SynthHashSplatParameterNode extends ParameterNodeImpl , TSynthHashSplatParameterNode {
1135
1115
private DataFlowCallable callable ;
@@ -1436,24 +1416,7 @@ module ArgumentNodes {
1436
1416
not cv .isSymbol ( _)
1437
1417
)
1438
1418
|
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 ) )
1457
1420
)
1458
1421
}
1459
1422
@@ -1935,11 +1898,8 @@ DataFlowType getNodeType(Node n) {
1935
1898
result = TLambdaDataFlowType ( c )
1936
1899
)
1937
1900
or
1938
- result = TSynthHashSplatArgumentType ( n .( SynthHashSplatArgumentNode ) .getMethodName ( ) )
1939
- or
1940
1901
not n instanceof LambdaSelfReferenceNode and
1941
1902
not mustHaveLambdaType ( n , _) and
1942
- not n instanceof SynthHashSplatArgumentNode and
1943
1903
result = TUnknownDataFlowType ( )
1944
1904
}
1945
1905
@@ -2165,11 +2125,6 @@ class ContentApprox extends TContentApprox {
2165
2125
result = "approximated element " + approx
2166
2126
)
2167
2127
or
2168
- exists ( string s |
2169
- this = THashSplatContentApprox ( s ) and
2170
- result = "approximated hash-splat position " + s
2171
- )
2172
- or
2173
2128
exists ( Content c |
2174
2129
this = TNonElementContentApprox ( c ) and
2175
2130
result = c .toString ( )
@@ -2209,8 +2164,6 @@ ContentApprox getContentApprox(Content c) {
2209
2164
result =
2210
2165
TKnownElementContentApprox ( approxKnownElementIndex ( c .( Content:: KnownElementContent ) .getIndex ( ) ) )
2211
2166
or
2212
- result = THashSplatContentApprox ( approxKnownElementIndex ( c .( Content:: HashSplatContent ) .getKey ( ) ) )
2213
- or
2214
2167
result = TNonElementContentApprox ( c )
2215
2168
}
2216
2169
0 commit comments