class TCellAgent::Policies::CommandInjectionPolicy

Attributes

enabled[RW]

Public Class Methods

api_identifier() click to toggle source
# File lib/tcell_agent/policies/command_injection_policy.rb, line 6
def self.api_identifier
  'cmdi'
end
new(native_agent, enablements) click to toggle source
# File lib/tcell_agent/policies/command_injection_policy.rb, line 12
def initialize(native_agent, enablements)
  @native_agent = native_agent
  @enabled = enablements['cmdi'] || false
end

Public Instance Methods

block_command?(command, tcell_context) click to toggle source
# File lib/tcell_agent/policies/command_injection_policy.rb, line 17
def block_command?(command, tcell_context)
  return false unless @enabled && tcell_context

  response = @native_agent.apply_cmdi(
    command, tcell_context
  )

  !response['blocked'].nil? && response['blocked']
end