Class: KairosMcp::Daemon::RestrictedShell::XelatexArgvValidator

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

Overview

Xelatex: require -no-shell-escape, block shell-escape.

Constant Summary collapse

FORBIDDEN_FLAGS =
%w[--shell-escape -shell-escape --enable-write18].freeze

Constants inherited from BaseArgvValidator

BaseArgvValidator::UNIVERSAL_FORBIDDEN

Class Method Summary collapse

Methods inherited from BaseArgvValidator

validate!

Class Method Details

.validate_specific!(argv) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'lib/kairos_mcp/daemon/restricted_shell/argv_validators.rb', line 101

def self.validate_specific!(argv)
  argv.each do |arg|
    FORBIDDEN_FLAGS.each do |f|
      raise PolicyViolation, "xelatex #{f} forbidden" if arg == f
    end
  end
  unless argv.include?('-no-shell-escape')
    raise PolicyViolation, 'xelatex requires -no-shell-escape'
  end
end