rails-informant 0.7.0 → 0.7.1
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/app/controllers/rails_informant/browser_reports_controller.rb +10 -10
- 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: 6d4058b109f43e27c16dd253fad646852a4a8e50384def456bba81c999f12fca
|
|
4
|
+
data.tar.gz: 7cefef2d44178f325a513f5bd442729289426ec346e0c65fa3e89d3c16b30c59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1bf1bec5c0b667a8c0b57242bc8f47d27feba3db00bd35fe2c091446e267ff567cd6ce35bdff9b4cf050ac1cf940edb166d4b45f93048ee9041c0081bb6eed0b
|
|
7
|
+
data.tar.gz: 2280af8c61cd35735c879d7b8f12a0cfd744a16a27dfb760b6a0a7c8bffb93cbc5a75af01adc4c19ddcc2e257fc61f57630d04e6b12be78a3f0df8db9f5abbe1
|
|
@@ -13,21 +13,13 @@ module RailsInformant
|
|
|
13
13
|
def self.increment(...) = BrowserReportsController.cache_store.increment(...)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
class_attribute :schema_warning_logged, default: false
|
|
16
|
+
class_attribute :schema_warning_logged, default: false, instance_accessor: false
|
|
17
17
|
|
|
18
18
|
include SecurityHeaders
|
|
19
19
|
|
|
20
20
|
# Parameter wrapping would parse the body before the size check.
|
|
21
21
|
wrap_parameters false
|
|
22
22
|
|
|
23
|
-
# Instrumentation parses a JSON body and logs it as Parameters before any
|
|
24
|
-
# callback runs, so a declared oversize body is refused ahead of it.
|
|
25
|
-
def process_action(...)
|
|
26
|
-
return head :content_too_large if request.content_length.to_i > MAX_BODY_BYTES
|
|
27
|
-
|
|
28
|
-
super
|
|
29
|
-
end
|
|
30
|
-
|
|
31
23
|
before_action :verify_same_origin!
|
|
32
24
|
rate_limit to: 30, within: 1.minute, store: LiveCacheStore, with: -> { head :too_many_requests }
|
|
33
25
|
before_action :require_browser_schema!
|
|
@@ -54,6 +46,14 @@ module RailsInformant
|
|
|
54
46
|
|
|
55
47
|
private
|
|
56
48
|
|
|
49
|
+
# Instrumentation parses a JSON body and logs it as Parameters before any
|
|
50
|
+
# callback runs, so a declared oversize body is refused ahead of it.
|
|
51
|
+
def process_action(...)
|
|
52
|
+
return head :content_too_large if request.content_length.to_i > MAX_BODY_BYTES
|
|
53
|
+
|
|
54
|
+
super
|
|
55
|
+
end
|
|
56
|
+
|
|
57
57
|
# Browsers set both headers and pages cannot forge them. Without
|
|
58
58
|
# Sec-Fetch-Site (older browsers), Origin must name this app exactly.
|
|
59
59
|
def verify_same_origin!
|
|
@@ -65,7 +65,7 @@ module RailsInformant
|
|
|
65
65
|
def require_browser_schema!
|
|
66
66
|
return if RailsInformant.browser_schema_ready?
|
|
67
67
|
|
|
68
|
-
unless schema_warning_logged
|
|
68
|
+
unless self.class.schema_warning_logged
|
|
69
69
|
self.class.schema_warning_logged = true
|
|
70
70
|
Rails.logger.warn "[RailsInformant] Browser reports rejected: run `bin/rails generate rails_informant:browser` and migrate to add the browser capture columns"
|
|
71
71
|
end
|