Class: JavascriptValidationHook

Inherits:
Mumukit::Hook
  • Object
show all
Defined in:
lib/validation_hook.rb

Instance Method Summary collapse

Instance Method Details

#validate!(request) ⇒ Object

Raises:

  • (Mumukit::RequestValidationError)


2
3
4
5
6
7
# File 'lib/validation_hook.rb', line 2

def validate!(request)
  matches = request_matches?(request) do |it|
    it =~ /(^|\W+)(require|process|os|fs|eval|cluster|v8|vm|tty|tls|root|global|crypto|stream|events)(\W+|$)/
  end
  raise Mumukit::RequestValidationError, "You can not use #{$2} here" if matches
end