standard_id 0.55.0 → 0.55.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: 1b6e3c72dcbb1a915c4927a4f0607b13d6f66c791240e20825698b490b0f13a1
4
- data.tar.gz: 9606c37fbf368616167772d7a32fdadc7b4abb16758c9041b7041694b697ffb4
3
+ metadata.gz: 79b115262b448690a7d1429716da8b36e6422be79e9406868684a3744e0cf3e8
4
+ data.tar.gz: a43dc5ed9ea2ff5bd5317809f79c9326d1df14a2115f63e631090a7fe15042cd
5
5
  SHA512:
6
- metadata.gz: b31012a34cc04b983d754b506f13d227a046dd5a33a53774b071d2822e4d51aba4745d685a25f0d84c7c55b7c37e79378351a4efbc556b91831368095282d7d4
7
- data.tar.gz: e0ad4c58dfeb705e5824da097c12b6a00b6d60450f0c248a3f0a1874fe912f5549ecebfdbd1dd199aa6810af6668fea7f8562c6ee7dad0b076f29635e36ffd44
6
+ metadata.gz: a184a92b4a8f865db6e4fd4f05cbaa9e44d1156407ed61d30530ee6379269cc9cc3da0d9f64b800c7fc44461abc28d2df44ebe2d4562a6dbde96d0f69a106ec7
7
+ data.tar.gz: abc3fe5d187c94408406cfeba9e27a699f5542b30a1979c268c7b5fe7d2986ea29b56dcb6d4b8399b8e0df3a7ed56271951a49eec9a25076d5cd568a1a30b9c5
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.55.1] - 2026-10-23
11
+
12
+ ### Fixed
13
+
14
+ - **`credential.password.reset_completed` from `POST /auth/password/reset` carries a
15
+ loaded credential again.** The reset's row lock dropped the preloaded
16
+ `credential → identifier → account`, so under strict loading a subscriber that walked
17
+ `event[:credential].credential.identifier` raised, silently, since the publish is
18
+ rescued. The chain is now preloaded again before the event is published.
19
+ - **A `reset_completed` subscriber that raises is now reported via `Rails.error`**
20
+ (`handled: true, source: "standard_id"`) as well as logged, on both the API reset and
21
+ the web reset form, so it reaches the host's error tracker. The reset still succeeds.
22
+
10
23
  ## [0.55.0] - 2026-10-22
11
24
 
12
25
  ### Added
@@ -46,7 +46,7 @@ module StandardId
46
46
  private
47
47
 
48
48
  # The reset has already happened, so a failing subscriber must not turn
49
- # it into an error page; log and carry on, as Session does for
49
+ # it into an error page; report and carry on, as Session does for
50
50
  # SESSION_REVOKED.
51
51
  def publish_reset_completed(account)
52
52
  StandardId::Events.publish(
@@ -55,6 +55,7 @@ module StandardId
55
55
  account: account
56
56
  )
57
57
  rescue StandardError => e
58
+ Rails.error.report(e, handled: true, source: "standard_id")
58
59
  logger = StandardId.logger
59
60
  return unless logger.respond_to?(:error)
60
61
 
@@ -95,11 +95,14 @@ module StandardId
95
95
 
96
96
  private
97
97
 
98
+ CREDENTIAL_ASSOCIATIONS = { credential: { identifier: :account } }.freeze
99
+ private_constant :CREDENTIAL_ASSOCIATIONS
100
+
98
101
  def find_credential(token)
99
102
  return nil if token.blank?
100
103
 
101
104
  StandardId::PasswordCredential
102
- .includes(credential: { identifier: :account })
105
+ .includes(CREDENTIAL_ASSOCIATIONS)
103
106
  .find_by_token_for(:password_reset, token.to_s)
104
107
  end
105
108
 
@@ -126,14 +129,23 @@ module StandardId
126
129
  end
127
130
 
128
131
  # The reset has already happened, so a failing subscriber must not turn
129
- # it into an error; log and carry on, as Web::ResetPasswordConfirmForm does.
132
+ # it into an error; report and carry on, as Web::ResetPasswordConfirmForm
133
+ # does.
134
+ #
135
+ # lock! reloaded the credential, dropping what find_credential
136
+ # preloaded, so load it again: under strict loading a subscriber that
137
+ # walks credential.identifier would otherwise raise.
130
138
  def publish_reset_completed(account, password_credential)
139
+ ActiveRecord::Associations::Preloader.new(
140
+ records: [password_credential], associations: CREDENTIAL_ASSOCIATIONS
141
+ ).call
131
142
  StandardId::Events.publish(
132
143
  StandardId::Events::CREDENTIAL_PASSWORD_RESET_COMPLETED,
133
144
  credential: password_credential,
134
145
  account: account
135
146
  )
136
147
  rescue StandardError => e
148
+ Rails.error.report(e, handled: true, source: "standard_id")
137
149
  logger = StandardId.logger
138
150
  return unless logger.respond_to?(:error)
139
151
 
@@ -1,3 +1,3 @@
1
1
  module StandardId
2
- VERSION = "0.55.0"
2
+ VERSION = "0.55.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.0
4
+ version: 0.55.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaryl Sim