File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
lib/codeql/ruby/frameworks/core
test/query-tests/security/cwe-116/IncompleteSanitization Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,11 @@ class StringSubstitutionCall extends DataFlow::CallNode {
1919 StringSubstitutionCall ( ) {
2020 this .getMethodName ( ) = [ "sub" , "sub!" , "gsub" , "gsub!" ] and
2121 exists ( this .getReceiver ( ) ) and
22- this .getNumberOfArguments ( ) = 2
23- or
24- this .getNumberOfArguments ( ) = 1 and exists ( this .getBlock ( ) )
22+ (
23+ this .getNumberOfArguments ( ) = 2
24+ or
25+ this .getNumberOfArguments ( ) = 1 and exists ( this .getBlock ( ) )
26+ )
2527 }
2628
2729 /**
Original file line number Diff line number Diff line change @@ -268,3 +268,8 @@ def bad_path_sanitizer(p1, p2)
268268 p1 . sub! "/../" , "" # NOT OK
269269 p2 . sub "/../" , "" # NOT OK
270270end
271+
272+ def each_line_sanitizer ( p1 )
273+ p1 . each_line ( "\n " ) do |l | # OK - does no sanitization
274+ end
275+ end
You can’t perform that action at this time.
0 commit comments