hubssolib 3.8.2 → 4.0.2

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: 6b90f9617fc1a625f402510ee5497d4d357f914d7f35284e6c1e25b62ae07f4b
4
- data.tar.gz: 450ead4d1423e6b42fd6a0aba65fdf043d6c5e3a6c3dc1b7b04412b2fcd4e65c
3
+ metadata.gz: f56f69bd23843c0ff1575651e4a01eb111f121363ad046c0e3356ec14bdb5dcf
4
+ data.tar.gz: f05e756267b131d91d3e3d71752781a33050cbd8b903cbe61d213614d229fe3d
5
5
  SHA512:
6
- metadata.gz: 1a03c285659733df8dd98c93faaf458549229c8a096cba58c797c04139788bddf2592c2a12b99a5c87d02ffac4a936db703317d4957ec48d25790a21eb3ddadb
7
- data.tar.gz: b392255f66a678625bab09ec613d69f77ab8cf60818764fcc4b2b55028e317854e24e8125a527ccac598b6845ba10f794524ffa82579a2f5ef30258fafbba887
6
+ metadata.gz: c3fb0fe6bd80d59959116218cddb8d328e0cfeddd1de858ad352eb7fa3bf439237510a63695a057dd5d488bfd2a8027921f683b50ea7161343daf3983cd75fa8
7
+ data.tar.gz: e637ddc3a7d73ad9892d8d17176d464485a501c6c60a045bb54551fb6bb2d5bc2c32dca9f80bceccba7c51b76216d664e40efcbc94a3116427f46e33f5854441
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 4.0.0, 4.0.1 and 4.0.2, 24-Jul-2026
2
+
3
+ * Despite the major version bump, this is a maintenance release for client apps. Integration for all Hub features including the Hub Trust mechanism is unchanged.
4
+ * If you do not use Hub Trust features at all, then this is also only a maintenance release for the Hub app itself and nothing more is needed to run the entire Hub assembly.
5
+ * If you do use Hub Trust features, then note that the way in which you launch the Trust Server, which previously auto-launched with the Hub app but was prone to being killed or otherwise terminating without warning, has changed. In a manner similar to the separately-launched and reliable Session server, the Trust server must be separately launched. This is done with a Rake task so that the Trust server has full access to the Hub app environment.
6
+
7
+ 4.0.1 just updated Gemspec metadata without any other changes. In the spirit of "third time lucky", 4.0.2 fixes a last minute bug that crept in due to a rogue Undo.
8
+
1
9
  ## 3.8.2, 17-May-2025
2
10
 
3
11
  * General maintenance update.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubssolib (3.8.2)
4
+ hubssolib (4.0.1)
5
5
  base64 (~> 0.2)
6
6
  drb (~> 2.2)
7
7
 
@@ -85,9 +85,9 @@ GEM
85
85
  base64 (0.3.0)
86
86
  bigdecimal (4.1.2)
87
87
  builder (3.3.0)
88
- concurrent-ruby (1.3.6)
88
+ concurrent-ruby (1.3.8)
89
89
  connection_pool (3.0.2)
90
- crass (1.0.6)
90
+ crass (1.0.7)
91
91
  date (3.5.1)
92
92
  debug (1.11.1)
93
93
  irb (~> 1.10)
@@ -97,11 +97,11 @@ GEM
97
97
  doggo (1.4.0)
98
98
  rspec-core (~> 3.13)
99
99
  drb (2.2.3)
100
- erb (6.0.4)
100
+ erb (6.0.6)
101
101
  erubi (1.13.1)
102
- globalid (1.3.0)
102
+ globalid (1.4.0)
103
103
  activesupport (>= 6.1)
104
- i18n (1.14.8)
104
+ i18n (1.15.2)
105
105
  concurrent-ruby (~> 1.0)
106
106
  io-console (0.8.2)
107
107
  irb (1.18.0)
@@ -109,24 +109,24 @@ GEM
109
109
  prism (>= 1.3.0)
110
110
  rdoc (>= 4.0.0)
111
111
  reline (>= 0.4.2)
112
- json (2.19.5)
112
+ json (2.21.1)
113
113
  logger (1.7.0)
114
- loofah (2.25.1)
114
+ loofah (2.25.2)
115
115
  crass (~> 1.0.2)
116
116
  nokogiri (>= 1.12.0)
117
- mail (2.9.0)
117
+ mail (2.9.1)
118
118
  logger
119
119
  mini_mime (>= 0.1.1)
120
120
  net-imap
121
121
  net-pop
122
122
  net-smtp
123
- marcel (1.1.0)
123
+ marcel (1.2.1)
124
124
  mini_mime (1.1.5)
125
125
  mini_portile2 (2.8.9)
126
126
  minitest (6.0.6)
127
127
  drb (~> 2.0)
128
128
  prism (~> 1.5)
129
- net-imap (0.6.4)
129
+ net-imap (0.6.6)
130
130
  date
131
131
  net-protocol
132
132
  net-pop (0.1.2)
@@ -136,16 +136,13 @@ GEM
136
136
  net-smtp (0.5.1)
137
137
  net-protocol
138
138
  nio4r (2.7.5)
139
- nokogiri (1.19.3)
139
+ nokogiri (1.19.4)
140
140
  mini_portile2 (~> 2.8.2)
141
141
  racc (~> 1.4)
142
- pp (0.6.3)
142
+ pp (0.6.4)
143
143
  prettyprint
144
144
  prettyprint (0.2.0)
145
145
  prism (1.9.0)
146
- psych (5.3.1)
147
- date
148
- stringio
149
146
  racc (1.8.1)
150
147
  rack (3.2.6)
151
148
  rack-session (2.1.2)
@@ -173,8 +170,8 @@ GEM
173
170
  activesupport (>= 5.0.0)
174
171
  minitest
175
172
  nokogiri (>= 1.6)
176
- rails-html-sanitizer (1.7.0)
177
- loofah (~> 2.25)
173
+ rails-html-sanitizer (1.7.1)
174
+ loofah (~> 2.25, >= 2.25.2)
178
175
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
179
176
  railties (8.1.3)
180
177
  actionpack (= 8.1.3)
@@ -186,9 +183,14 @@ GEM
186
183
  tsort (>= 0.2)
187
184
  zeitwerk (~> 2.6)
188
185
  rake (13.4.2)
189
- rdoc (7.2.0)
186
+ rbs (4.0.3)
187
+ logger
188
+ prism (>= 1.6.0)
189
+ tsort
190
+ rdoc (8.0.0)
190
191
  erb
191
- psych (>= 4.0.0)
192
+ prism (>= 1.6.0)
193
+ rbs (>= 4.0.0)
192
194
  tsort
193
195
  reline (0.6.3)
194
196
  io-console (~> 0.5)
@@ -212,7 +214,6 @@ GEM
212
214
  simplecov_json_formatter (~> 0.1)
213
215
  simplecov-html (0.13.2)
214
216
  simplecov_json_formatter (0.1.4)
215
- stringio (3.2.0)
216
217
  thor (1.5.0)
217
218
  timeout (0.6.1)
218
219
  tsort (0.2.0)
@@ -220,11 +221,11 @@ GEM
220
221
  concurrent-ruby (~> 1.0)
221
222
  uri (1.1.1)
222
223
  useragent (0.16.11)
223
- websocket-driver (0.8.0)
224
+ websocket-driver (0.8.2)
224
225
  base64
225
226
  websocket-extensions (>= 0.1.0)
226
227
  websocket-extensions (0.1.5)
227
- zeitwerk (2.7.5)
228
+ zeitwerk (2.8.2)
228
229
 
229
230
  PLATFORMS
230
231
  ruby
data/README.md CHANGED
@@ -30,18 +30,17 @@ Include in a project by adding this to your `Gemfile`:
30
30
  gem 'hubssolib', '~> 3.0', require: 'hub_sso_lib'
31
31
  ```
32
32
 
33
- ### The DRb server
33
+ ### The DRb Session Server
34
34
 
35
- The Hub DRb server consists of a small wrapper Ruby script which does most of its work using the Hub gem. To run the server, you need to first specify a DRb connection URI in the `HUB_CONNECTION_URI` environment variable. Usually, this is a Unix domain socket and so lives in a location of your choice in the local filesystem. Run the server by running `ruby` on the `hub_sso_server.rb` file in the Hub archive. For example:
35
+ The Hub DRb Session Server consists of a small wrapper Ruby script which does most of its work using the Hub gem. The server needs to know the DRb connection URI that works for your system. A Unix-domain socket using a socket file `~/.hub_drb` is chosen as the default, but can override this with the `HUB_CONNECTION_URI` environment variable. If you specify a custom URI, note that it _MUST_ start with `drbunix:`; the Session Server must not be run on an IP port for security reasons.
36
+
37
+ The server Ruby script has its own `Gemfile`, so after a `bundle install` inside the folder where `hub_sso_server.rb` lives, run with something like this:
36
38
 
37
39
  ```sh
38
- HUB_CONNECTION_URI="drbunix:/home/username/sockets/.hub_drb"
39
- export HUB_CONNECTION_URI
40
- ruby /home/username/hubssolib/hub_sso_server.rb &
40
+ HUB_CONNECTION_URI="drbunix:/home/username/sockets/.hub_drb" \
41
+ bundle exec ruby /home/username/hubssolib/server/hub_sso_server.rb &
41
42
  ```
42
43
 
43
- The default is to use a file `.hub_drb` in the root of the current user's home directory. If you specify a custom URI, note that it _MUST_ start with `drbunix:`; the hub server must not be run on an IP port for security reasons.
44
-
45
44
  ### The Hub application
46
45
 
47
46
  Finally you can install the Hub application using whatever mechanism you prefer to application installation. See ample documentation elsewhere on the Web for information on installing Ruby On Rails applications — Hub itself contains the default rails README file with quite a lot of information in it.
@@ -472,16 +471,24 @@ $ bundle exec rails c
472
471
 
473
472
  The trust mechanism involves a fair amount of effort on the integrating app's side but it can be very useful if you have a site where, despite your best efforts, sometimes spam/bot accounts manage to get inside and try to flood the system with spam. It's just one of many different potential protection and mitigation mechanisms that your site might choose to employ.
474
473
 
475
- **SERVER NOTE:** The Trust DRb server runs inside the Hub application, which runs using Puma as a server by default. The Trust server is started within the Hub application's `puma.rb` configuration file, because it needs to make sure it runs once, after booting, and is not destroyed by worker fork teardown/standup. If you aren't going to use Puma, you'll need to find a way to set this up; you'll want code akin to this in `app/hub/config/application.rb`:
474
+ ### The DRb Trust Server
476
475
 
477
- ```ruby
478
- if defined? Rails::Server
479
- Rails::Application::Finisher.initializer 'uk.org.pond.hubssolib.trustserver' do
480
- Thread.new do
481
- HubSsoLib::Trust.launch_server()
482
- end
483
- end
484
- end
476
+ In a similar fashion to the DRb Session Server, there is a Trust Server which must be launched so that applications using the mechanism describe above have something to "talk" to (with the underlying mechanics taken care of by the Hub gem). In Hub v3, this was managed by the Hub app itself but process management and lifecycles can be complex in a Rails app and the approach was unreliable. Since Hub v4 there is a much more reliable, separately-launched command, just like with the Session Server.
477
+
478
+ Untrusted action data is stored in the Hub app database and the Hub app will send notification e-mails out to moderators for each untrusted action event, so the DRb Trust Server is run via a Rake task that's part of the Hub app and uses its configured environment. The same environment variables that you pass to launch the Hub application should therefore be passed to the Rake task. As a bare minimum, make sure that `HUB_PATH_PREFIX` is set to the full URL needed to access the root path of the Hub application's web interface, as this is used when generating URLs in notification e-mails.
479
+
480
+ The default location of the Unix-domain DRb server socket is `~/.hub_trust_drb` but you can override it with `HUB_TRUST_CONNECTION_URI`. As with the Session Server, if you specify a custom URI, note that it _MUST_ start with `drbunix:`; the Trust Server must not be run on an IP port for security reasons.
481
+
482
+ ```sh
483
+ HUB_TRUST_CONNECTION_URI="drbunix:/home/username/sockets/.hub_trust_drb" \
484
+ HUB_PATH_PREFIX="https://www.example.com/hub" \
485
+ bundle exec bin/rails hub_trust:server &
485
486
  ```
486
487
 
487
- ...but that only works if the code would be run once and never torn down (a one-process server setup). There are many different Ruby web server approaches and it's not possible to be more specific; you just need to read the documentation about lifecycles and callbacks for the server you choose.
488
+ You can silence `$stdout` with `HUB_QUIET_SERVER=yes`, or if wishing to instead capture output to log files, the Rails `log` folder is a good place to put them:
489
+
490
+ ```sh
491
+ HUB_TRUST_CONNECTION_URI="drbunix:/home/username/sockets/.hub_trust_drb" \
492
+ HUB_PATH_PREFIX="https://www.example.com/hub" \
493
+ bundle exec bin/rails hub_trust:server 1>> "log/trust_server_stdout.log" 2>> "logs/trust_server_stderr.log" &
494
+ ```
data/hubssolib.gemspec CHANGED
@@ -4,13 +4,15 @@ spec = Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = 'hubssolib'
6
6
 
7
- s.version = '3.8.2'
7
+ s.version = '4.0.2'
8
8
  s.author = 'Andrew Hodgkinson and others'
9
9
  s.email = 'ahodgkin@rowing.org.uk'
10
10
  s.homepage = 'http://pond.org.uk/'
11
11
  s.summary = 'Cross-application single sign-on support library.'
12
12
  s.license = 'MIT'
13
13
 
14
+ s.metadata["source_code_uri"] = "https://gitlab.riscosopen.org/website/hubssolib"
15
+
14
16
  s.description = <<-EOF
15
17
  The Hub SSO Library supports single sign-on across multiple Rails
16
18
  applications on the same host. The Hub application provides account
data/lib/hub_sso_lib.rb CHANGED
@@ -927,37 +927,12 @@ module HubSsoLib
927
927
  return File.exist?(path)
928
928
  end
929
929
 
930
- # Start the trust server. This should only ever be called by the Hub Rails
931
- # application, which implements HubSsoLib::Trust::Server.
932
- #
933
- def self.launch_server
934
- uri = self.get_trust_server_connection_uri()
935
- already_running = self.already_running?
936
-
937
- unless ENV['HUB_QUIET_SERVER'] == 'yes'
938
- message = unless already_running
939
- "Trust server: Starting at #{ uri }"
940
- else
941
- "Trust server: Already running at at #{ uri }"
942
- end
943
-
944
- puts message
945
- end
946
-
947
- unless already_running
948
- loop do
949
- DRb.start_service(uri, ::HubSsoLib::Trust::Server.new)
950
- DRb.thread.join # Keep the thread alive...
951
- end # ...but auto-restart if e.g. DRb.stop_service() is invoked
952
- end
953
- end
954
-
955
930
  # Obtain a connection to the trust server. This is called by any client
956
931
  # code that needs to talk to the server which must, at the time called, be
957
932
  # running via startup within the Hub Rails application.
958
933
  #
959
- # The returned object is an instance of ::HubSsoLib::Trust::Server, which
960
- # is defined inside the Hub Rails application. See there for details.
934
+ # The returned object is an instance of ::HubSsoLib::Trust::ActionManager,
935
+ # which is defined inside the Hub Rails application. See there for details.
961
936
  #
962
937
  def self.get_trust_object
963
938
  HUB_MUTEX.synchronize do
@@ -972,6 +947,57 @@ module HubSsoLib
972
947
 
973
948
  return @@trust_object
974
949
  end
950
+
951
+ module Server
952
+ def hubssolib_launch_trust_server
953
+ ::HubSsoLib::Trust::Server::Runner.run
954
+ end
955
+
956
+ class Runner
957
+ QUEUE = ::Queue.new
958
+
959
+ def self.run
960
+ uri = ::HubSsoLib::Trust.get_trust_server_connection_uri()
961
+ already_running = ::HubSsoLib::Trust.already_running?
962
+
963
+ unless ENV['HUB_QUIET_SERVER'] == 'yes'
964
+ message = unless already_running
965
+ "Trust server: Starting at #{ uri }"
966
+ else
967
+ "Trust server: Already running at at #{ uri }"
968
+ end
969
+
970
+ puts message
971
+ end
972
+
973
+ Signal.trap('INT' ) { QUEUE << :INT }
974
+ Signal.trap('TERM') { QUEUE << :TERM }
975
+
976
+ DRb.start_service(uri, ::HubApp::Trust::ActionManager.new, { :safe_level => 1 })
977
+
978
+ QUEUE.pop
979
+
980
+ self.shutdown()
981
+ exit
982
+
983
+ rescue => e
984
+ Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
985
+ raise
986
+ end
987
+
988
+ def self.shutdown
989
+ unless ENV['HUB_QUIET_SERVER'] == 'yes'
990
+ puts "Server: Graceful shutdown..."
991
+ end
992
+
993
+ DRb.stop_service
994
+
995
+ unless ENV['HUB_QUIET_SERVER'] == 'yes'
996
+ puts "Server: ...completed."
997
+ end
998
+ end
999
+ end # Runner class
1000
+ end # Server module
975
1001
  end
976
1002
 
977
1003
  #######################################################################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubssolib
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.2
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hodgkinson and others
@@ -143,7 +143,8 @@ files:
143
143
  homepage: http://pond.org.uk/
144
144
  licenses:
145
145
  - MIT
146
- metadata: {}
146
+ metadata:
147
+ source_code_uri: https://gitlab.riscosopen.org/website/hubssolib
147
148
  rdoc_options: []
148
149
  require_paths:
149
150
  - lib
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  - !ruby/object:Gem::Version
159
160
  version: '0'
160
161
  requirements: []
161
- rubygems_version: 4.0.10
162
+ rubygems_version: 4.0.16
162
163
  specification_version: 4
163
164
  summary: Cross-application single sign-on support library.
164
165
  test_files: []