Class: TCellAgent::Policies::LocalFileInclusion

Inherits:
Policy
  • Object
show all
Defined in:
lib/tcell_agent/policies/local_file_access.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(native_agent, enablements) ⇒ LocalFileInclusion

Returns a new instance of LocalFileInclusion.



12
13
14
15
# File 'lib/tcell_agent/policies/local_file_access.rb', line 12

def initialize(native_agent, enablements)
  @native_agent = native_agent
  @enabled = enablements['local_file_access'] || false
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



10
11
12
# File 'lib/tcell_agent/policies/local_file_access.rb', line 10

def enabled
  @enabled
end

Class Method Details

.api_identifierObject



6
7
8
# File 'lib/tcell_agent/policies/local_file_access.rb', line 6

def self.api_identifier
  'lfi'
end

Instance Method Details

#block_file_access?(path, mode, tcell_context) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
# File 'lib/tcell_agent/policies/local_file_access.rb', line 17

def block_file_access?(path, mode, tcell_context)
  return false unless @native_agent

  response = @native_agent.file_access_apply(
    path, mode, tcell_context
  )

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