masks 0.12.0 → 0.12.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: 22811283549c975e2550ab8546760831275db1efa68ddfd16ebe1dcfb96278a5
4
- data.tar.gz: 888decf6ea332f751cb446a4e7535313527141ed64086cbf62acc2787d320a9b
3
+ metadata.gz: 421d8bafc01e79df7edd7738c30d85a09919fe62dae16944a0d53278fd93f616
4
+ data.tar.gz: 9671445e035576d9c89b3d4cdffa28b7a6448b29c23201ad791085c3d30cfa2e
5
5
  SHA512:
6
- metadata.gz: 33275896c9010d94818885f7a0a3f71b83f6782af7384cf29fb70d482b03492b8e662f27d6f748e1d9a05f453f5294dc910ca5d1492395c7bc3e0bc57aaaea6f
7
- data.tar.gz: 5fb2c1d80a01a0723c3533bc8861cca4c2d0761e9ef5d4ef21f46de41d611835bf9fefe28ac0bab860b65bb0ee166cf8288fbda1a178644f58dc3a850edaea96
6
+ metadata.gz: 521d775b39d102648c40f513ccb0d23299ee0af608d882a3eba878d2c8d4d0bd1713fd2a245d74bf725416c62b6e85e9fc596ce11343e29708068d4d31ff1817
7
+ data.tar.gz: 535c2e15b8ea0c574a8fca4109e2e6133c0f52991d4764be81ef3a20421142fafe8bb58a6e9d49e3ecc672c168b680e90b7cc73b4412233cab183fffacf65089
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.12.1](https://github.com/masksrb/masks/compare/gem/v0.12.0...gem/v0.12.1) (2026-10-19)
4
+
5
+
6
+ ### Fixes
7
+
8
+ * **client:** a Rails sign-out link followed by a browser that names no site asks before signing out ([c62c6c1](https://github.com/masksrb/masks/commit/c62c6c1854bb2f7a60339468f6db1b408d6786b9))
9
+ * **client:** one Rails guard decides where a sign-out came from, so a POST that names no site is refused and the Sign out page carries everywhere in its address ([ed86c45](https://github.com/masksrb/masks/commit/ed86c45692dc4d8a0614697ccc832fe1358bd58d))
10
+
3
11
  ## [0.12.0](https://github.com/masksrb/masks/compare/gem/v0.11.0...gem/v0.12.0) (2026-10-14)
4
12
 
5
13
 
@@ -4,8 +4,14 @@ module Masks
4
4
  RESTARTED = "masks_restarted_at".freeze
5
5
  RESTART_WITHIN = 60
6
6
  SAME_ORIGIN = %w[same-origin none].freeze
7
+ CONFIRMATION_HEADERS = {
8
+ "Cache-Control" => "no-store",
9
+ "X-Content-Type-Options" => "nosniff",
10
+ "X-Frame-Options" => "DENY",
11
+ "Content-Security-Policy" => "default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'"
12
+ }.freeze
7
13
 
8
- before_action :refuse_cross_site, only: :destroy
14
+ before_action :require_this_site, only: :destroy
9
15
 
10
16
  def show
11
17
  if masks_configured? && (masks_signed_in? || (masks_tokens && masks_refresh!))
@@ -99,20 +105,29 @@ module Masks
99
105
 
100
106
  private
101
107
 
102
- def refuse_cross_site
103
- return if same_origin?
108
+ def require_this_site
109
+ from = provenance
110
+ return if from == :this_site
104
111
 
105
- answer("invalid_request", "that request came from another site", :forbidden, failed: "sign-out")
106
- end
112
+ if from == :elsewhere || request.post? || request.delete?
113
+ return answer("invalid_request", "that request came from another site", :forbidden, failed: "sign-out")
114
+ end
107
115
 
108
- def same_origin?
109
- site = request.headers["Sec-Fetch-Site"].to_s
116
+ return answer("invalid_request", "sign out with a POST from this site", :forbidden) if masks_wants_json?
110
117
 
111
- return false unless site.empty? || SAME_ORIGIN.include?(site)
118
+ @action = logout_path(request.query_parameters.slice("everywhere"))
119
+ response.headers.merge!(CONFIRMATION_HEADERS)
120
+ render :confirm, formats: :html
121
+ end
112
122
 
123
+ def provenance
124
+ site = request.headers["Sec-Fetch-Site"].to_s
113
125
  sent = request.headers["Origin"].to_s
114
126
 
115
- sent.empty? || [ request.base_url, own_origin ].include?(sent)
127
+ return :elsewhere unless site.empty? || SAME_ORIGIN.include?(site)
128
+ return :elsewhere unless sent.empty? || [ request.base_url, own_origin ].include?(sent)
129
+
130
+ site.empty? && sent.empty? ? :unproven : :this_site
116
131
  end
117
132
 
118
133
  def own_origin
@@ -0,0 +1,9 @@
1
+ <% content_for :title, "Sign out" %>
2
+
3
+ <h1>Sign out</h1>
4
+
5
+ <p>Select Sign out to finish signing out.</p>
6
+
7
+ <%= form_with url: @action, method: :post do %>
8
+ <button type="submit">Sign out</button>
9
+ <% end %>
data/lib/masks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Masks
2
- VERSION = "0.12.0".freeze
2
+ VERSION = "0.12.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.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - the masks authors
@@ -42,6 +42,7 @@ files:
42
42
  - app/views/layouts/masks/rails/plain.html.erb
43
43
  - app/views/masks/rails/handshakes/refused.html.erb
44
44
  - app/views/masks/rails/handshakes/show.html.erb
45
+ - app/views/masks/rails/sessions/confirm.html.erb
45
46
  - config/routes.rb
46
47
  - lib/generators/masks/install/install_generator.rb
47
48
  - lib/generators/masks/install/templates/masks.rb.tt