zuora_connect 2.0.35 → 2.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c3c6b7ac935c55509c6e6a17119ae886704a3a53aab7cf68d4f632d41941160
4
- data.tar.gz: 6797088f6387e6ed51ffce504653a087e8a902b142dc166d9dc09fc4759d6d51
3
+ metadata.gz: ec4f417ea781c1789f8905c8cdb151c0a78d4618f14e7a862e350087455291a7
4
+ data.tar.gz: f83ae2e442291a687fabee9bad24166f8ac1c85fe050f873196102088f8e9118
5
5
  SHA512:
6
- metadata.gz: fd5ee82d006aa5383af74246b5668f3ef8457596d3192b920147ef26389ff090d6d1a81078a1ca5c9c4210e5cfdb74e9f050c1a39d9faa8aba19eed42d67557c
7
- data.tar.gz: 622acfefb244129ef4c493ac6723df3d7ca564076744908524cbb9af9b6f306f9663a69b6fcba3c13104b1426b8eb0224a4ffecc360074391f3446dedbd540fa
6
+ metadata.gz: 756176debe1e03eb0e40559fcedcf463f0459299a349903e386e3acceb628751138f37a78c930a481fb1f4e763500508887ff9f77d1108d62138949bf05935cb
7
+ data.tar.gz: 8be3d81dae05302104544f97cc8a39c50933fba6c2f9c8ab9452c14d6c76a90ea8430d24522ce0af082fdb9c1b3a01996543c29e1f92c044a21d363a114f2a2f
@@ -851,13 +851,7 @@ module ZuoraConnect
851
851
  while !response["nextPage"].blank?
852
852
  url = login.rest_endpoint(response["nextPage"].split('/v1/').last)
853
853
  ZuoraConnect.logger.debug("Fetch Catalog URL #{url}")
854
- output_json, response = login.rest_call(:debug => false, :url => url, :errors => [ZuoraAPI::Exceptions::ZuoraAPISessionError], :timeout_retry => true)
855
- ZuoraConnect.logger.debug("Fetch Catalog Response Code #{response.code}")
856
-
857
- if !output_json['success'] =~ (/(true|t|yes|y|1)$/i) || output_json['success'].class != TrueClass
858
- ZuoraConnect.logger.error("Fetch Catalog DATA #{output_json.to_json}")
859
- raise ZuoraAPI::Exceptions::ZuoraAPIError.new("Error Getting Catalog: #{output_json}")
860
- end
854
+ output_json, response = login.rest_call(:debug => false, :url => url, :timeout_retry => true)
861
855
 
862
856
  output_json["products"].each do |product|
863
857
  ActiveRecord::Base.connection.execute('UPDATE "public"."zuora_connect_app_instances" SET "catalog_mapping" = jsonb_set("catalog_mapping", \'{tmp, %s}\', \'%s\') where "id" = %s' % [product["id"], {"productId" => product["id"]}.to_json.gsub("'", "''"), self.id])
@@ -1,7 +1,16 @@
1
1
  redis_url = ENV["REDIS_URL"].present? ? ENV["REDIS_URL"] : defined?(Rails.application.secrets.redis) ? Rails.application.secrets.redis : 'redis://localhost:6379/1'
2
2
  resque_url = ENV["RESQUE_URL"].present? ? ENV["RESQUE_URL"] : defined?(Rails.application.secrets.resque) ? Rails.application.secrets.resque : 'redis://localhost:6379/1'
3
- flash_url = ENV["FLASH_URL"].present? ? ENV["FLASH_URL"] : defined?(Rails.application.secrets.flash) ? Rails.application.secrets.flash : 'redis://localhost:6379/1'
3
+ flash_url = ENV["FLASH_URL"].present? ? ENV["FLASH_URL"] : defined?(Rails.application.secrets.flash) ? Rails.application.secrets.flash : nil
4
4
  browser_urls = {}
5
+ class RedisFlash
6
+ def self.current
7
+ @current ||= Redis.new()
8
+ end
9
+ def self.current=(redis)
10
+ @current = redis
11
+ end
12
+ end
13
+
5
14
  if defined?(Redis.current)
6
15
  Redis.current = Redis.new(:id => "#{ZuoraConnect::Telegraf.full_process_name(process_name: 'Redis')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
7
16
  browser_urls['Redis'] = { "url" => redis_url }
@@ -13,7 +22,7 @@ if defined?(Redis.current)
13
22
  Resque.redis = Redis.current
14
23
  end
15
24
  end
16
- if defined?(RedisFlash)
25
+ if defined?(flash_url.present?)
17
26
  RedisFlash.current = Redis.new(:id => "#{ZuoraConnect::Telegraf.full_process_name(process_name: 'Flash')}", :url => flash_url, :timeout => 6, :reconnect_attempts => 2)
18
27
  browser_urls['Flash'] = { "url" => flash_url }
19
28
  end
@@ -0,0 +1,21 @@
1
+ module ZuoraConnect
2
+ class BadMultipartFormDataSanitizer
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ if env['CONTENT_TYPE'] =~ /multipart\/form-data/
9
+ begin
10
+ Rack::Multipart.parse_multipart(env)
11
+ rescue EOFError => ex
12
+ # set content-type to multipart/form-data without the boundary part
13
+ # to handle the case where empty content is submitted
14
+ env['CONTENT_TYPE'] = 'multipart/form-data'
15
+ end
16
+ end
17
+
18
+ @app.call(env)
19
+ end
20
+ end
21
+ end
@@ -7,7 +7,6 @@ module Resque
7
7
  module Plugins
8
8
  module CustomLogger
9
9
  def before_perform(*args)
10
- Rails.logger.with_fields = { trace_id: SecureRandom.uuid, name: "RailsWorker"} if Rails.logger.class.to_s == 'Ougai::Logger' && ZuoraConnect.configuration.json_logging
11
10
  case args.class.to_s
12
11
  when "Array"
13
12
  if args.first.class == Hash
@@ -18,6 +17,8 @@ module Resque
18
17
  when "Hash"
19
18
  data = args.merge({:worker_class => self.to_s})
20
19
  end
20
+ Rails.logger.with_fields = {job: data, trace_id: SecureRandom.uuid, name: "RailsWorker"} if Rails.logger.class.to_s == 'Ougai::Logger' && ZuoraConnect.configuration.json_logging
21
+
21
22
  data = {:msg => 'Starting job', :job => data}
22
23
 
23
24
  app_instance_id = data.dig(:job, 'app_instance_id')
@@ -263,7 +263,17 @@ module ZuoraConnect
263
263
  client_describe, response = zuora_client.rest_call(url: zuora_client.rest_endpoint("genesis/user/info").gsub('v1/', ''), session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic, headers: zuora_client.class == ZuoraAPI::Oauth ? {} : {'Authorization' => "ZSession-a3N2w #{zuora_client.get_session(prefix: false, auth_type: :basic)}"})
264
264
  session["ZuoraCurrentUserInfo"] = client_describe
265
265
 
266
- raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.") if zuora_entity_id != identity['entityId']
266
+ if zuora_entity_id != identity['entityId']
267
+ if zuora_tenant_id.to_s == "10548"
268
+ render "zuora_connect/static/error_handled", :locals => {
269
+ :title => "Security Testing",
270
+ :message => "Ya we know it you"
271
+ }, :layout => false
272
+ return
273
+ else
274
+ raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.")
275
+ end
276
+ end
267
277
  end
268
278
 
269
279
  #Find matching app instances.
@@ -1,6 +1,7 @@
1
1
  require 'middleware/metrics_middleware'
2
2
  require 'middleware/request_id_middleware'
3
3
  require 'middleware/json_parse_errors'
4
+ require 'middleware/bad_multipart_form_data_sanitizer'
4
5
 
5
6
  module ZuoraConnect
6
7
  class Railtie < Rails::Railtie
@@ -26,6 +27,7 @@ module ZuoraConnect
26
27
  initializer "zuora_connect.configure_rails_initialization" do |app|
27
28
  app.middleware.insert_after Rack::Sendfile, ZuoraConnect::MetricsMiddleware
28
29
  app.middleware.insert_after ActionDispatch::RequestId, ZuoraConnect::RequestIdMiddleware
30
+ app.middleware.insert_before Rack::Runtime, ZuoraConnect::BadMultipartFormDataSanitizer
29
31
  app.config.middleware.use ZuoraConnect::JsonParseErrors
30
32
  end
31
33
 
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "2.0.35"
2
+ VERSION = "2.0.36"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.35
4
+ version: 2.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-20 00:00:00.000000000 Z
11
+ date: 2020-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -340,6 +340,7 @@ files:
340
340
  - lib/logging/connect_formatter.rb
341
341
  - lib/metrics/influx/point_value.rb
342
342
  - lib/metrics/net.rb
343
+ - lib/middleware/bad_multipart_form_data_sanitizer.rb
343
344
  - lib/middleware/json_parse_errors.rb
344
345
  - lib/middleware/metrics_middleware.rb
345
346
  - lib/middleware/request_id_middleware.rb