brainzlab-rails 0.1.2 → 0.1.4
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 +4 -4
- data/lib/brainzlab/rails/collectors/base.rb +10 -5
- data/lib/brainzlab/rails/railtie.rb +7 -0
- data/lib/brainzlab/rails/version.rb +1 -1
- data/lib/brainzlab-rails.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88aab646104299f6a6a52df59282b0bff9286265cda2c0ae746d98a2a70a9f24
|
|
4
|
+
data.tar.gz: 0f5d3658c45f116ca9b09ef3b923e48d03438557ce6f6c75f745a61e1f974fb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce68fe4c77462c3a5b5423e1844bd21791a512e9815d5418da1420da62e3b018083912cb3810f9f5255e360b8586cb6cc654a5a27a03b98a8b8dc3e214294faf
|
|
7
|
+
data.tar.gz: 9f8bff7bc23e19925fe1b5331d0f4a6488e0f47582efc49dcae0b6b4fce019c57b4bb2eb8441e38fa6ac1a46f586ca6629a505202ac92a4907e0230623e5d49e
|
|
@@ -108,16 +108,21 @@ module BrainzLab
|
|
|
108
108
|
|
|
109
109
|
# Sanitize sensitive data from params
|
|
110
110
|
def sanitize_params(params)
|
|
111
|
-
|
|
111
|
+
# Handle ActionController::Parameters or Hash
|
|
112
|
+
hash = if defined?(::ActionController::Parameters) && params.is_a?(::ActionController::Parameters)
|
|
113
|
+
params.to_unsafe_h
|
|
114
|
+
elsif params.is_a?(Hash)
|
|
115
|
+
params
|
|
116
|
+
else
|
|
117
|
+
return {}
|
|
118
|
+
end
|
|
112
119
|
|
|
113
120
|
sensitive_keys = %w[password password_confirmation token api_key secret]
|
|
114
|
-
|
|
121
|
+
hash.transform_keys(&:to_s).each_with_object({}) do |(key, value), result|
|
|
115
122
|
if sensitive_keys.any? { |sk| key.downcase.include?(sk) }
|
|
116
123
|
result[key] = '[FILTERED]'
|
|
117
|
-
elsif value.is_a?(Hash)
|
|
124
|
+
elsif value.is_a?(Hash) || (defined?(::ActionController::Parameters) && value.is_a?(::ActionController::Parameters))
|
|
118
125
|
result[key] = sanitize_params(value)
|
|
119
|
-
elsif value.is_a?(ActionController::Parameters)
|
|
120
|
-
result[key] = sanitize_params(value.to_unsafe_h)
|
|
121
126
|
else
|
|
122
127
|
result[key] = value
|
|
123
128
|
end
|
|
@@ -7,6 +7,13 @@ module BrainzLab
|
|
|
7
7
|
class Railtie < ::Rails::Railtie
|
|
8
8
|
config.brainzlab_rails = ActiveSupport::OrderedOptions.new
|
|
9
9
|
|
|
10
|
+
# Include view helpers in Action View
|
|
11
|
+
initializer 'brainzlab_rails.view_helpers' do
|
|
12
|
+
ActiveSupport.on_load(:action_view) do
|
|
13
|
+
include BrainzLab::Rails::ViewHelpers
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
10
17
|
# Initialize after Rails and BrainzLab SDK are configured
|
|
11
18
|
initializer 'brainzlab_rails.setup', after: :load_config_initializers do |app|
|
|
12
19
|
# Configure from Rails config if provided
|
data/lib/brainzlab-rails.rb
CHANGED
|
@@ -30,6 +30,9 @@ require_relative 'brainzlab/rails/analyzers/n_plus_one_detector'
|
|
|
30
30
|
require_relative 'brainzlab/rails/analyzers/slow_query_analyzer'
|
|
31
31
|
require_relative 'brainzlab/rails/analyzers/cache_efficiency'
|
|
32
32
|
|
|
33
|
+
# View helpers for JS SDK integration
|
|
34
|
+
require_relative 'brainzlab/rails/view_helpers'
|
|
35
|
+
|
|
33
36
|
# Railtie for auto-initialization
|
|
34
37
|
require_relative 'brainzlab/rails/railtie' if defined?(::Rails::Railtie)
|
|
35
38
|
|