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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85905d22093388e09e56afd089dcd870c3d33d066c51c8d0b4bb27beb1567a00
4
- data.tar.gz: d2053f3a5655d02bf059d4876d268985017b675d49a7284aba7fb8f1f23aa2fa
3
+ metadata.gz: 6d4058b109f43e27c16dd253fad646852a4a8e50384def456bba81c999f12fca
4
+ data.tar.gz: 7cefef2d44178f325a513f5bd442729289426ec346e0c65fa3e89d3c16b30c59
5
5
  SHA512:
6
- metadata.gz: f961c33f024b36c00bd48f9c5356c311a81a08ebd6c1131f2e7a2a9f25d7810b29eae1d305530a95c87e131cdeb428c42f859f0170d88041274dc9443b9be41f
7
- data.tar.gz: e3cba73cd5fde5af8368888a20668175f7ef8d47bca2755eab2837ceefaca1ec198c57e6ff06107dad7045e119ea00c0c42943d48773b110344dd8168635313e
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-informant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel López Prat