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 +4 -4
- data/CHANGELOG.md +7 -0
- data/app/controllers/masks/rails/avatars_controller.rb +12 -2
- data/lib/masks/client/issuer.rb +11 -0
- data/lib/masks/version.rb +1 -1
- 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: 2ddbde433a9c9d4b50ce57f69dd6f823915ef9e0220b5d34ea7d6e06f32787c8
|
|
4
|
+
data.tar.gz: 1d2f208f896192f19771044adcdb19761f6d751575e590e5a4843606d6719e64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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:
|
|
54
|
+
send_data answer.body, type: type, disposition: "inline"
|
|
45
55
|
else
|
|
46
56
|
head :not_found
|
|
47
57
|
end
|
data/lib/masks/client/issuer.rb
CHANGED
|
@@ -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