rservicebus2 0.2.20 → 0.2.25
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae906c0d751849d9f4843a7b8ca164398597fd9f7fd88a6673b7d4851e2f1672
|
4
|
+
data.tar.gz: e0b563cf71559ff0565af68132bb31035e292098cf9f2716b086b6293daa8481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69c1d0ff2b0c93f087dd5a9daf57040f132e0d3e513ef591b608c35f7ef350daa7ac0e5640d72e254f5358e12cb09d23c517cc8c61018d53eb2b9beee5c82f45
|
7
|
+
data.tar.gz: e26625aa44347b9f604fa6f64f9344cca6509fe952240439092c96252c458d910ac620331554aa93914aaf51d3feb895912e53eb1c3ad2014dc3e7eca8bab33e
|
data/lib/rservicebus2.rb
CHANGED
@@ -23,6 +23,7 @@ require 'rservicebus2/config'
|
|
23
23
|
require 'rservicebus2/endpointmapping'
|
24
24
|
require 'rservicebus2/statistic_manager'
|
25
25
|
require 'rservicebus2/audit'
|
26
|
+
require 'rservicebus2/yaml_safe_loader'
|
26
27
|
|
27
28
|
require 'rservicebus2/message'
|
28
29
|
require 'rservicebus2/message/subscription'
|
@@ -140,10 +140,8 @@ module RServiceBus2
|
|
140
140
|
next if file_path.end_with?('.')
|
141
141
|
|
142
142
|
msg_name = get_msg_name(file_path)
|
143
|
-
|
144
|
-
|
145
|
-
)
|
146
|
-
|
143
|
+
YamlSafeLoader.instance.add_permitted_class(msg_name
|
144
|
+
.gsub(/(?<=_|^)(\w)/) { Regexp.last_match(1).upcase }.gsub(/(?:_)(\w)/, '\1'))
|
147
145
|
if File.directory?(file_path)
|
148
146
|
load_handlers_from_second_level_path(msg_name, file_path)
|
149
147
|
next
|
@@ -4,22 +4,9 @@ require 'csv'
|
|
4
4
|
|
5
5
|
# Helper functions
|
6
6
|
module RServiceBus2
|
7
|
-
DEFAULT_PERMITTED_CLASSES = 'RServiceBus2::Message,Time,UUIDTools::UUID'
|
8
|
-
|
9
|
-
def self.permitted_classes
|
10
|
-
permitted_classes_string = get_value('PERMITTED_CLASSES', DEFAULT_PERMITTED_CLASSES)
|
11
|
-
CSV.parse(permitted_classes_string)[0]
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.add_to_permitted_classes(string)
|
15
|
-
ENV['PERMITTED_CLASSES'] = permitted_classes
|
16
|
-
.push(string)
|
17
|
-
.uniq
|
18
|
-
.to_csv
|
19
|
-
end
|
20
|
-
|
21
7
|
def self.safe_load(body)
|
22
|
-
YAML.safe_load(body, permitted_classes:
|
8
|
+
# YAML.safe_load(body, permitted_classes: Module.constants)
|
9
|
+
YamlSafeLoader.instance.load(body)
|
23
10
|
end
|
24
11
|
|
25
12
|
def self.convert_dto_to_hash(obj)
|
@@ -52,6 +39,8 @@ module RServiceBus2
|
|
52
39
|
end
|
53
40
|
|
54
41
|
def self.create_anonymous_class(name_for_class)
|
42
|
+
Module.const_get(name_for_class)
|
43
|
+
rescue NameError
|
55
44
|
new_anonymous_class = Class.new(Object)
|
56
45
|
Object.const_set(name_for_class, new_anonymous_class)
|
57
46
|
Object.const_get(name_for_class).new
|
data/lib/rservicebus2/host.rb
CHANGED
@@ -146,7 +146,8 @@ module RServiceBus2
|
|
146
146
|
process_path(file_path)
|
147
147
|
|
148
148
|
file_processed += 1
|
149
|
-
RServiceBus2.log "Processed #{file_processed} of #{file_list.length}
|
149
|
+
RServiceBus2.log "Processed #{file_processed} of #{file_list.length}."
|
150
|
+
RServiceBus2.log "Allow system tick #{self.class.name}"
|
150
151
|
|
151
152
|
break if file_processed >= max_files_processed
|
152
153
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
# YamlSafeLoader
|
7
|
+
class YamlSafeLoader
|
8
|
+
include Singleton
|
9
|
+
|
10
|
+
DEFAULT_PERMITTED_CLASSES = 'RServiceBus2::Message,RServiceBus2::ErrorMessage,Time,UUIDTools::UUID,YamlSafeLoader,' \
|
11
|
+
'URI::Generic,URI::RFC3986_Parser,Symbol,Regexp'
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
string = "#{RServiceBus2.get_value('PERMITTED_CLASSES_BASE', DEFAULT_PERMITTED_CLASSES)}," \
|
15
|
+
"#{RServiceBus2.get_value('PERMITTED_CLASSES', '')}"
|
16
|
+
@permitted_classes = CSV.parse(string)[0].reject { |c| c.to_s.rstrip.empty? }
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_permitted_class(string)
|
20
|
+
@permitted_classes << string
|
21
|
+
@permitted_classes.uniq!
|
22
|
+
end
|
23
|
+
|
24
|
+
def load(body)
|
25
|
+
YAML.safe_load(body, permitted_classes: @permitted_classes)
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Irvine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: beanstalk-client
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/rservicebus2/test/bus.rb
|
166
166
|
- lib/rservicebus2/transporter.rb
|
167
167
|
- lib/rservicebus2/usermessage/withpayload.rb
|
168
|
+
- lib/rservicebus2/yaml_safe_loader.rb
|
168
169
|
homepage: http://rubygems.org/gems/rservicebus2
|
169
170
|
licenses:
|
170
171
|
- LGPL-3.0
|