lib/contrast/agent/protect/rule/cmd_injection.rb in contrast-agent-3.11.0 vs lib/contrast/agent/protect/rule/cmd_injection.rb in contrast-agent-3.12.0
- old
+ new
@@ -12,11 +12,11 @@
module Protect
module Rule
# The Ruby implementation of the Protect Command Injection rule.
class CmdInjection < Contrast::Agent::Protect::Rule::BaseService
include Contrast::Components::Interface
- access_component :logging
+ access_component :app_context, :logging
NAME = 'cmd-injection'
CHAINED_COMMAND_CHARS = /[;&|<>]/.cs__freeze
def name
@@ -27,11 +27,11 @@
return nil unless infilter?(context)
ia_results = gather_ia_results(context)
return nil if ia_results.empty?
- if Contrast::Agent::FeatureState.instance.in_new_process?
+ if APP_CONTEXT.in_new_process?
logger.trace('Running cmd-injection infilter within new process - creating new context')
context = Contrast::Agent::RequestContext.new(context.request.rack_request)
Contrast::Agent::REQUEST_TRACKER.update_current_context(context)
end
@@ -142,10 +142,10 @@
# application. This check determines if that hardening has been
# enabled.
# @return [Boolean] if the agent should report all command
# executions.
def report_any_command_execution?
- Contrast::Agent::FeatureState.instance.report_any_command_execution?
+ PROTECT.report_any_command_execution?
end
end
end
end
end