File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
ruby/ql/src/queries/security/cwe-078 Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ predicate hasConstantPrefix(DataFlow::Node node) {
37
37
node .asExpr ( ) .getExpr ( ) .( StringlikeLiteral ) .getComponent ( 0 ) instanceof StringTextComponent
38
38
or
39
39
// it is not a constant string argument
40
- exists ( node .asExpr ( ) . getExpr ( ) . getConstantValue ( ) )
40
+ exists ( node .getConstantValue ( ) )
41
41
or
42
42
// not a concatenation that starts with a constant string
43
43
exists ( DataFlow:: ExprNode prefix |
@@ -46,5 +46,13 @@ predicate hasConstantPrefix(DataFlow::Node node) {
46
46
)
47
47
or
48
48
// is a .freeze call on a constant string
49
- node .asExpr ( ) .getExpr ( ) .( ConstantReadAccess ) .getValue ( ) .( MethodCall ) .getMethodName ( ) = "freeze"
49
+ exists ( DataFlow:: CallNode call | node = call and call .getMethodName ( ) = "freeze" |
50
+ hasConstantPrefix ( call .getReceiver ( ) )
51
+ )
52
+ or
53
+ // is a constant read of a constant string
54
+ exists ( DataFlow:: Node constant |
55
+ constant .asExpr ( ) .getExpr ( ) = node .asExpr ( ) .getExpr ( ) .( ConstantReadAccess ) .getValue ( ) and
56
+ hasConstantPrefix ( constant )
57
+ )
50
58
}
You can’t perform that action at this time.
0 commit comments