Files
codeql/ql/test/library-tests/frameworks/Eval.rb
Harry Maclean 95e50cedad Add query for Code Injection
This query finds cases where user input flows to an argument to `eval`
or `send`, which can execute arbitrary Ruby code.
2021-09-20 11:35:45 +01:00

24 lines
242 B
Ruby

# Uses of eval and send
eval("raise \"error\"")
send("raise", "error")
a = []
a.send("raise", "error")
class Foo
def eval(x)
x + 1
end
def send(*args)
2
end
def run
eval("exit 1")
end
end
Foo.new.send("exit", 1)