mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Make KernelSystemCall more specific
Test that calls to`system` on modules other than `Kernel` are excluded,
such as in this example:
module Foo
def self.system(*args); end
end
# This is not a call to Kernel.system
Foo.system("bar")
This commit is contained in:
@@ -66,4 +66,23 @@ Open3.pipeline("echo foo")
|
||||
|
||||
<<`EOF`
|
||||
echo foo
|
||||
EOF
|
||||
EOF
|
||||
|
||||
module MockSystem
|
||||
def system(*args)
|
||||
args
|
||||
end
|
||||
|
||||
def self.system(*args)
|
||||
args
|
||||
end
|
||||
end
|
||||
|
||||
class Foo
|
||||
include MockSystem
|
||||
|
||||
def run
|
||||
system("ls")
|
||||
MockSystem.system("ls")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user