class TCellAgent::Policies::PatchesPolicy

Attributes

enabled[RW]

Public Class Methods

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

Public Instance Methods

block_request?(appsensor_meta) click to toggle source
# File lib/tcell_agent/policies/patches_policy.rb, line 17
def block_request?(appsensor_meta)
  return false unless @enabled

  quick_check_response = @native_agent.apply_suspicious_quick_check(appsensor_meta)

  if quick_check_response == 1
    response = @native_agent.apply_patches(appsensor_meta)
    return !response['apply_response'].nil? && response['apply_response']['status'] == 'Blocked'
  end

  quick_check_response == 2
end