mumuki-javascript-runner 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a4a4e866fb702c176bcc075c039f147e773a9289251430106f6bdb3baf895e3
4
- data.tar.gz: 30ed0dec052be2274099624d062ccaa087c27ea62ae586563fe54039cb072021
3
+ metadata.gz: ec3828b95e23b39b3306bcb2a507cde9acbf3d98d444e9dd5bb95cf3c648a915
4
+ data.tar.gz: b286fa2b2764f084c4f1763cfabcace5e4a975403039d40d89ed20adf4872264
5
5
  SHA512:
6
- metadata.gz: 28b7216bd532615a59599a0e7bf6704532a212c18268f578f24669fd49ab950af578f59ae1ef7e34c889ca8a67f1303eab790f86cfadbbc28747ef1945328854
7
- data.tar.gz: d9504c226a9a77ae7e373eb8a6a4dba0fe1c8245f7d8dbc740926e972e980ee399fe7d1732c850ce855326c2315b96cee061a61b0e393a95a46b2955f3c7face
6
+ metadata.gz: d717df05b3e3dd99882730c368c13a753264d63bd6c8ded6b60eb13f90feef16a301b5ac240b9ac5bc67bb7b812f3222fbdb680b243da3bbc9c397f711b56e3a
7
+ data.tar.gz: e27e945d2adbe2720a3204a87f9a70ebc180eb26b2ae61bebb0ed9103dd81af91308529835ee4bd9e82baebe8e8de57d0ae1c56d209427a4ee7caceb285e43af
@@ -9,6 +9,7 @@ end
9
9
 
10
10
  require_relative './version'
11
11
  require_relative './metadata_hook'
12
+ require_relative './validation_hook'
12
13
  require_relative './test_hook'
13
14
  require_relative './expectations_hook'
14
15
  require_relative './query_hook'
@@ -0,0 +1,18 @@
1
+ class JavascriptValidationHook < Mumukit::Hook
2
+ def validate!(request)
3
+ matches = request_matches?(request) do |it|
4
+ it =~ /\W*(require|process|os|fs|eval|cluster|v8|vm|tty|tls|root|global|crypto|stream|events)\W*/
5
+ end
6
+ raise Mumukit::RequestValidationError, "You can not use #{$1} here" if matches
7
+ end
8
+
9
+ private
10
+
11
+ def request_matches?(request, &block)
12
+ [
13
+ request.content,
14
+ request.extra,
15
+ request.query
16
+ ].compact.any?(&block)
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module JavascriptVersionHook
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-javascript-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -106,6 +106,7 @@ files:
106
106
  - lib/metadata_hook.rb
107
107
  - lib/query_hook.rb
108
108
  - lib/test_hook.rb
109
+ - lib/validation_hook.rb
109
110
  - lib/version.rb
110
111
  homepage: http://github.com/mumuki/mumuki-javascript-server
111
112
  licenses:
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  version: '0'
128
129
  requirements: []
129
130
  rubyforge_project:
130
- rubygems_version: 2.7.6
131
+ rubygems_version: 2.7.7
131
132
  signing_key:
132
133
  specification_version: 4
133
134
  summary: Javascript Runner for Mumuki