Files
codeql/ruby/ql/test/query-tests/security/cwe-502/oj-global-options/OjGlobalOptions.rb
2021-10-15 11:47:28 +02:00

17 lines
416 B
Ruby

require "oj"
class UsersController < ActionController::Base
# GOOD - Oj.load is safe when any mode other than :object is set globally
def route0
json_data = params[:key]
object = Oj.load json_data
end
# BAD - the safe mode set globally is overridden with an unsafe mode passed as
# a call argument
def route1
json_data = params[:key]
object = Oj.load json_data, mode: :object
end
end