Sha256: 7e11da5aff49cac6d5424606ea5402e9e1624357d0f857016a2c83944c0b08e4
Contents?: true
Size: 713 Bytes
Versions: 6778
Compression:
Stored size: 713 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Security # This cop checks for the use of `Kernel#eval` and `Binding#eval`. # # @example # # # bad # # eval(something) # binding.eval(something) class Eval < Cop MSG = 'The use of `eval` is a serious security risk.'.freeze def_node_matcher :eval?, <<-PATTERN (send {nil? (send nil? :binding)} :eval $!str ...) PATTERN def on_send(node) eval?(node) do |code| return if code.dstr_type? && code.recursive_literal? add_offense(node, location: :selector) end end end end end end
Version data entries
6,778 entries across 6,772 versions & 24 rubygems