@@ -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
@@ -1938,11 +1901,8 @@ DataFlowType getNodeType(Node n) {
1938
1901
result = TLambdaDataFlowType ( c )
1939
1902
)
1940
1903
or
1941
- result = TSynthHashSplatArgumentType ( n .( SynthHashSplatArgumentNode ) .getMethodName ( ) )
1942
- or
1943
1904
not n instanceof LambdaSelfReferenceNode and
1944
1905
not mustHaveLambdaType ( n , _) and
1945
- not n instanceof SynthHashSplatArgumentNode and
1946
1906
result = TUnknownDataFlowType ( )
1947
1907
}
1948
1908
@@ -2168,11 +2128,6 @@ class ContentApprox extends TContentApprox {
2168
2128
result = "approximated element " + approx
2169
2129
)
2170
2130
or
2171
- exists ( string s |
2172
- this = THashSplatContentApprox ( s ) and
2173
- result = "approximated hash-splat position " + s
2174
- )
2175
- or
2176
2131
exists ( Content c |
2177
2132
this = TNonElementContentApprox ( c ) and
2178
2133
result = c .toString ( )
@@ -2212,8 +2167,6 @@ ContentApprox getContentApprox(Content c) {
2212
2167
result =
2213
2168
TKnownElementContentApprox ( approxKnownElementIndex ( c .( Content:: KnownElementContent ) .getIndex ( ) ) )
2214
2169
or
2215
- result = THashSplatContentApprox ( approxKnownElementIndex ( c .( Content:: HashSplatContent ) .getKey ( ) ) )
2216
- or
2217
2170
result = TNonElementContentApprox ( c )
2218
2171
}
2219
2172
0 commit comments