Class: KairosMcp::Daemon::RestrictedShell::BaseArgvValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/kairos_mcp/daemon/restricted_shell/argv_validators.rb

Overview

Base validator: blocks shell metacharacters in all args.

Constant Summary collapse

UNIVERSAL_FORBIDDEN =
/[;&|`$(){}]|\n|\r/

Class Method Summary collapse

Class Method Details

.validate!(argv) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/kairos_mcp/daemon/restricted_shell/argv_validators.rb', line 10

def self.validate!(argv)
  argv.each do |arg|
    if arg.match?(UNIVERSAL_FORBIDDEN)
      raise PolicyViolation, "forbidden character in arg: #{arg.inspect}"
    end
  end
  validate_specific!(argv)
end

.validate_specific!(argv) ⇒ Object



19
20
21
# File 'lib/kairos_mcp/daemon/restricted_shell/argv_validators.rb', line 19

def self.validate_specific!(argv)
  # Override in subclasses
end