Class: TCellAgent::Policies::CommandInjectionPolicy
- Defined in:
- lib/tcell_agent/policies/command_injection_policy.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
Class Method Summary collapse
Instance Method Summary collapse
- #block_command?(command, tcell_context) ⇒ Boolean
-
#initialize(native_agent, enablements) ⇒ CommandInjectionPolicy
constructor
A new instance of CommandInjectionPolicy.
Constructor Details
#initialize(native_agent, enablements) ⇒ CommandInjectionPolicy
Returns a new instance of CommandInjectionPolicy.
12 13 14 15 |
# 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 |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
10 11 12 |
# File 'lib/tcell_agent/policies/command_injection_policy.rb', line 10 def enabled @enabled end |
Class Method Details
.api_identifier ⇒ Object
6 7 8 |
# File 'lib/tcell_agent/policies/command_injection_policy.rb', line 6 def self.api_identifier 'cmdi' end |
Instance Method Details
#block_command?(command, tcell_context) ⇒ Boolean
17 18 19 20 21 22 23 24 25 |
# 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 |