Class: RuboCop::Cop::Paraxial::System
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Paraxial::System
- Defined in:
- lib/rubocop/cop/paraxial/system.rb
Constant Summary collapse
- MSG =
'`system` causes remote code execution if called on user input.'
- RESTRICT_ON_SEND =
Restrict the cop to only the ‘puts` method
%i[system].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rubocop/cop/paraxial/system.rb', line 15 def on_send(node) return unless in_app_directory?(node) system_call?(node) do add_offense(node.loc.selector, message: MSG) end end |
#puts_call?(node) ⇒ Object
11 12 13 |
# File 'lib/rubocop/cop/paraxial/system.rb', line 11 def_node_matcher :system_call?, <<~PATTERN (send nil? :system ...) PATTERN |