masks 0.14.0 → 0.14.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: b1dc933ca059deb9075d30c697fa91478f46c1507b6809c875434c9456376ede
4
- data.tar.gz: 693307c0cf23a62c380f001315ea904ed3623f03958f3012ea6c15a9d4ddd3f0
3
+ metadata.gz: 2ddbde433a9c9d4b50ce57f69dd6f823915ef9e0220b5d34ea7d6e06f32787c8
4
+ data.tar.gz: 1d2f208f896192f19771044adcdb19761f6d751575e590e5a4843606d6719e64
5
5
  SHA512:
6
- metadata.gz: 7e61ef4dd97667400720a5bf3f83ea4771dc0b8033f6f3f2c1dd3b78d3b412794a35b8dc6f4d7d33e70f14703eceaab595f3003d0d3c4543e85cea2f7417cea4
7
- data.tar.gz: 5afadd951610be34b2950a27681fcbef7b7e923599e3d0a01a6bce3725458c3f9087f964e3c351564c34910eb218773db96aca49902c22e2fa745129a6d339d4
6
+ metadata.gz: c074205f73d0d4d5d52bb3b8639af9ead018bcd0ba28399f3d1fe1d318752340cc027c69b12ad0702034fa387aae1289ec499e1b081a4618561eabc6b8325564
7
+ data.tar.gz: ea5e05c06caefcc46867686f2f072c1489f1dfaaf539a58ed9923632b0a54e2dedd9085b54a4303fd7a4105a8d27e952c0367d74e80fbbedb0c5163da4e9ac67
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.14.1](https://github.com/masksrb/masks/compare/gem/v0.14.0...gem/v0.14.1) (2026-12-06)
4
+
5
+
6
+ ### Fixes
7
+
8
+ * **client:** keys are refetched at most once in thirty seconds, and the avatar proxy serves only images from the issuer ([cbfa63d](https://github.com/masksrb/masks/commit/cbfa63d32d255bb8631dc2049c5ab504bb40e4c4))
9
+
3
10
  ## [0.14.0](https://github.com/masksrb/masks/compare/gem/v0.13.0...gem/v0.14.0) (2026-11-29)
4
11
 
5
12
 
@@ -37,11 +37,21 @@ module Masks
37
37
  def deliver(answer)
38
38
  case answer
39
39
  when Net::HTTPRedirection
40
- redirect_to answer["Location"], allow_other_host: true
40
+ target = answer["Location"].to_s
41
+
42
+ return head(:not_found) unless target.start_with?("#{masks_config.issuer_for(request)}/")
43
+
44
+ redirect_to target, allow_other_host: true
41
45
  when Net::HTTPSuccess
46
+ type = answer["Content-Type"].to_s
47
+
48
+ return head(:not_found) unless type.start_with?("image/")
49
+
42
50
  expires_in 5.minutes, public: false
51
+ response.headers["X-Content-Type-Options"] = "nosniff"
52
+ response.headers["Content-Security-Policy"] = "default-src 'none'; sandbox"
43
53
 
44
- send_data answer.body, type: answer["Content-Type"], disposition: "inline"
54
+ send_data answer.body, type: type, disposition: "inline"
45
55
  else
46
56
  head :not_found
47
57
  end
@@ -9,6 +9,7 @@ module Masks
9
9
  LIFETIME = 3600
10
10
  FIRST_BACKOFF = 5
11
11
  LONGEST_BACKOFF = 60
12
+ KEYS_PATIENCE = 30
12
13
  TTL = LIFETIME
13
14
 
14
15
  def self.normalize(url)
@@ -49,6 +50,16 @@ module Masks
49
50
  end
50
51
 
51
52
  def keys!
53
+ clock = Time.now.to_i
54
+ patient = @lock.synchronize do
55
+ held = @cache[:jwks] ||= { backoff: FIRST_BACKOFF, retry_at: 0 }
56
+ waiting = held[:forced_at] && clock < held[:forced_at] + KEYS_PATIENCE
57
+ held[:forced_at] = clock unless waiting
58
+ waiting
59
+ end
60
+
61
+ return jwks if patient
62
+
52
63
  fetch(:jwks, now: true) { HTTP.get(endpoint("jwks_uri")) }
53
64
  end
54
65
 
data/lib/masks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Masks
2
- VERSION = "0.14.0".freeze
2
+ VERSION = "0.14.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - the masks authors