rservicebus2 0.2.21 → 0.2.22
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: bdf786cee730fd3a1cb0ecb384d566ead93171cfa566b2b23bff09ab4dc75116
|
4
|
+
data.tar.gz: 4f8d812c2cf83ce2c1c561038d6d7b545afdb4e8ba5db414554fda52e19eb3d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3787ed00c7dd8947ae2e1b000f3953afb34ceb8ffce6925f9c97a3d7ce67cf8d10e2e0d7989da8b7abee110a608066a8e1f95acb752665376beb811a0636d519
|
7
|
+
data.tar.gz: c8f21f22ea7132ecdf43d6a14c681f68071def8e611ab91e1388fa2dbeaf38ad02c2e89ce9ded75551e444ade20eea54d0493f9252fee2dca2e5cab2fd6c3891
|
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,URI::Generic,URI::RFC3986_Parser,Symbol,Regexp'
|
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)
|
@@ -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,33 @@
|
|
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,Time,UUIDTools::UUID,YamlSafeLoader,' \
|
11
|
+
'URI::Generic,URI::RFC3986_Parser,Symbol,Regexp'
|
12
|
+
|
13
|
+
def init
|
14
|
+
return unless @permitted_classes.nil?
|
15
|
+
|
16
|
+
string = "#{RServiceBus2.get_value('PERMITTED_CLASSES_BASE', DEFAULT_PERMITTED_CLASSES)}," \
|
17
|
+
"#{RServiceBus2.get_value('PERMITTED_CLASSES', '')}"
|
18
|
+
@permitted_classes = CSV.parse(string)[0].reject { |c| c.to_s.rstrip.empty? }
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_permitted_class(string)
|
22
|
+
init
|
23
|
+
|
24
|
+
@permitted_classes << string
|
25
|
+
@permitted_classes.uniq!
|
26
|
+
end
|
27
|
+
|
28
|
+
def load(body)
|
29
|
+
init
|
30
|
+
|
31
|
+
YAML.safe_load(body, permitted_classes: @permitted_classes)
|
32
|
+
end
|
33
|
+
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.22
|
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-01 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
|