where_is_waldo 0.1.13 → 0.1.14

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: d06a950b27e51d7506062dc38518912b7b631a91be886eb29801f01e0ac438ac
4
- data.tar.gz: fb1f82a4742a5099eee4d7a70f9d5445010dc52bd17408cfe2451363c04051a2
3
+ metadata.gz: 55b6e1ced7f3e93a1e415bc0e28d10b15a212ad134e3108f585bea84220a1f10
4
+ data.tar.gz: 6c068bbd05c86ea7c6ba9b2136295f5ef17c02bd19bf9211f8b4ee59a83b17f1
5
5
  SHA512:
6
- metadata.gz: 5bfd8270b07bed9227be801b90b1f354a30a1eeaf748a3b7b7ff0d1a551bb0f3d6685792862f7c8e5676d411ea263b14fe64c67a76be422b0e55055a01672900
7
- data.tar.gz: '053823564618b09793ded991cf679d9017eb3be14c8069bf1d33ee0fbe50d8872b0e004a7d0ab8ac0969a08e3eb4c7b427c562800e2c002fa9ec8c1cc9bd3e22'
6
+ metadata.gz: 9d96b99856186d169d3e6c97f4a032f298158ecb9e8532238c40d98a0fc7388d2a3a4eaa195417fe21064d1babc389b1c083bf85dbdfc20a33f5fb50d223d076
7
+ data.tar.gz: 4f0a4167858defcc5403deb7fafeac5abdb7556af91017fc1e679c952bfb39e067609ca09320353d99663106dba8f0afc9c7740c28642aff3e231057681c6b5f
data/CHANGELOG.md CHANGED
@@ -5,6 +5,27 @@ Notable changes to where_is_waldo. Format loosely follows
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 0.1.14 - 2026-11-06
9
+
10
+ ### Fixed
11
+
12
+ - **Cable connections were rejected in every app using an external identity
13
+ server.** `JwtConnection` resolved the connection's subject with
14
+ `find_by(id: payload["sub"])`. That is correct when `sub` is the application's
15
+ own user id, but an identity server issues a UUID subject, so the lookup
16
+ matched nothing and every connection was refused -- which meant no presence
17
+ and no broadcasting at all.
18
+
19
+ The failure was silent: a rejected connection is indistinguishable from a
20
+ client that never subscribed, and a count of presence rows cannot detect it
21
+ either, since those rows are TTL-transient and zero is also the healthy idle
22
+ state.
23
+
24
+ Resolution now goes through the host application's identity resolver when it
25
+ is in that mode, mapping the subject through `users.identity_id`. An
26
+ application whose presence subject is some other model keeps the
27
+ primary-key lookup, and an application without corebyscott is untouched.
28
+
8
29
  ## 0.1.13 - 2026-11-04
9
30
 
10
31
  ### Documentation
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.14
@@ -50,13 +50,47 @@ module WhereIsWaldo
50
50
  payload = wiw_token_payload
51
51
  reject_unauthorized_connection unless payload
52
52
 
53
- klass = WhereIsWaldo.configuration.subject_class_constant
54
- user = klass&.find_by(id: payload["sub"] || payload[:sub])
53
+ user = wiw_resolve_subject(payload)
55
54
  reject_unauthorized_connection unless user
56
55
 
57
56
  user
58
57
  end
59
58
 
59
+ # `sub` is not always this app's primary key.
60
+ #
61
+ # Under corebyscott's :identity_server mode it is the identity server's
62
+ # UUID, so find_by(id:) matches nothing and EVERY cable connection is
63
+ # rejected -- silently, because a rejected connection is indistinguishable
64
+ # from a client that never subscribed. Core's resolver maps the UUID through
65
+ # users.identity_id, the same path its HTTP auth takes, so cable and request
66
+ # auth cannot disagree about who someone is.
67
+ #
68
+ # Only used when the configured subject IS core's user class. An app whose
69
+ # presence subject is some other model keeps the primary-key lookup, since
70
+ # core's resolver would hand back a user rather than that subject.
71
+ def wiw_resolve_subject(payload)
72
+ klass = WhereIsWaldo.configuration.subject_class_constant
73
+
74
+ if wiw_identity_mode? && klass && klass == wiw_core_user_class
75
+ return ::Corebyscott::IdentityResolver.resolve(payload)
76
+ end
77
+
78
+ klass&.find_by(id: payload["sub"] || payload[:sub])
79
+ end
80
+
81
+ def wiw_identity_mode?
82
+ defined?(::Corebyscott::IdentityResolver) &&
83
+ ::Corebyscott.respond_to?(:config) &&
84
+ ::Corebyscott.config.respond_to?(:auth_mode) &&
85
+ ::Corebyscott.config.auth_mode.to_s == "identity_server"
86
+ end
87
+
88
+ def wiw_core_user_class
89
+ return nil unless ::Corebyscott.config.respond_to?(:user_class_constant)
90
+
91
+ ::Corebyscott.config.user_class_constant
92
+ end
93
+
60
94
  # Optional container scoping from the JWT's `cid` claim. nil when the app
61
95
  # doesn't scope tokens to a container, or corebyscott isn't present.
62
96
  def wiw_container
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_is_waldo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Gibson
@@ -79,6 +79,20 @@ dependencies:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 7.2.1
82
+ - !ruby/object:Gem::Dependency
83
+ name: bundler-audit
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.9'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.9'
82
96
  - !ruby/object:Gem::Dependency
83
97
  name: redis
84
98
  requirement: !ruby/object:Gem::Requirement