clowk 0.6.0 → 0.6.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: 1593747e0040a0056565a40b2bf1699d8242af1d253751ce3ea5c86949ff1f7a
4
- data.tar.gz: 33147a1e6f88c7970d52bf33403566c09309315c53b8e080416aaece4f1ecc2a
3
+ metadata.gz: 1aad1a920ab61f2ff4a89d52ceede9e30edf63a92f2fa5cb60e99eb3032f5a39
4
+ data.tar.gz: a701bfc46f4c2ae7c2bc57d731ab9a9ff4dde4dc454fc0634e8b1d6a08603b80
5
5
  SHA512:
6
- metadata.gz: 0cf89e539def821193dd451c8902e581423f103acd8881ce67d7eadb9cfd9e2e69302a265769679eb5a906593a89253f4781cf625546ee3bbd3d8d012d15584a
7
- data.tar.gz: f4993722c5349f80a7a10f39cff94d3b76b4909b700272f23458bca7d227fa263258c78b01cf511e2cb5d30640dae84a991fd686939fc4fbfcd2cee7b2e5e757
6
+ metadata.gz: bd7bb4bc6f95eb20c9cdabbb5f7e1dd1664f5d2566b895bd0e7466c46821ee7262b25bea0ced1aaf21e4ae8fa858ada4b28161d5517d7241f8ec31607ef5cae8
7
+ data.tar.gz: e0d6c2d830d16cc85c003c114240e0b2270f7de8288d85f1eb4b5d564613d8681c1d484a37fcf36a76908f44f6e9d3b9579d2890d4e3abf4cc84917375c2d03e
@@ -291,7 +291,22 @@ module Clowk
291
291
  store.read(clowk_status_cache_key)&.deep_symbolize_keys
292
292
  end
293
293
 
294
+ # A TTL of zero means "never trust a cached status", so there is nothing to
295
+ # write anywhere — the read side already discards whatever is there
296
+ # (clowk_session_status_fresh? is false without a positive TTL).
297
+ #
298
+ # The guard used to sit below the session branch and cover only the external
299
+ # cache, so an app that set the TTL to zero — to guarantee a genuinely fresh
300
+ # check before a destructive action — still had the full status payload
301
+ # written into its session on every single request, and never read back.
302
+ # That is write-only weight in a cookie with 4096 bytes to live in, and it
303
+ # ends as ActionDispatch::Cookies::CookieOverflow on whichever request
304
+ # happens to add a flash message.
294
305
  def clowk_write_cached_session_status(status)
306
+ ttl = Clowk.config.session_status_ttl.to_i
307
+
308
+ return unless ttl.positive?
309
+
295
310
  if clowk_session_store
296
311
  clowk_session_store[Clowk.config.session_key] = stored_session.merge(
297
312
  "session_status" => status,
@@ -301,10 +316,9 @@ module Clowk
301
316
  return
302
317
  end
303
318
 
304
- ttl = Clowk.config.session_status_ttl.to_i
305
319
  store = clowk_status_cache
306
320
 
307
- return unless store && ttl.positive?
321
+ return unless store
308
322
 
309
323
  store.write(clowk_status_cache_key, status, expires_in: ttl)
310
324
  end
data/lib/clowk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clowk
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clowk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clowk