omniauth-openai 0.1.0 → 0.1.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: c4510db682d5cc881cd21ff66a13b91f19c59e70f2c34e23c38e24b9b7d954d4
4
- data.tar.gz: 8e4c7ae32887385fc221e700af78787e87b017369eb5de1acb1f0e5efa5c2806
3
+ metadata.gz: 318769cec5741c9c2399dffa5a35a3dc46472dfcf52cd4eef37ed4374fdf2d92
4
+ data.tar.gz: d18f557f18208db6170317f7097aba09d47a5719c68c70f16fe5ed92c570fba8
5
5
  SHA512:
6
- metadata.gz: 73c540a83c85e9fa03f71d1be70d1ea2c811273cc1d9c8e744b66b60a3d81e9b3de17649509a998042e5de63dae8656c3828d2a68143695d635e4a6dc0ca9cbc
7
- data.tar.gz: 73a11709ac1f2366346b311a2ce2c8c6e26a9cbfd6eb5d2e837bc7cbb871522c0d59d3b3ac7346ab84319e3e1a3a23a4a0e33534d85a605b38bf0e9a4baf6540
6
+ metadata.gz: a355610041faf896eb6f2cda99499536300ffe84cc8debcd1ce2837f2024a8e8130963b9d60e3921502937a1f63b4cac7ff2b20d5425b4f18e82e6749521ea39
7
+ data.tar.gz: 57fc775c74251b55bcb0ae6aa88c559090d7b9ff376ee2bf3c130289e6a4676d8594a4839309829527733a130523570dc88b6b8379ba7f35dbc5e7f898215f95
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 - 2026-10-02
4
+
5
+ ### Fixed
6
+
7
+ - A key set response that is not a JSON Web Key Set (an HTML error page
8
+ served with 200, say) fails the sign-in without being cached, so one bad
9
+ answer from the issuer no longer breaks sign-in until the cache expires.
10
+ - Reject an ID token whose `sub` is empty or not a string; ruby-jwt's
11
+ required-claims check only confirms the claim exists.
12
+
13
+ ### Verified
14
+
15
+ - A full sign-in against the live `auth.openai.com` (public client, PKCE,
16
+ nonce): OpenAI accepts the authorize request, returns the nonce in the ID
17
+ token, sends `aud` as a one-item list without `azp`, and marks the email
18
+ verified.
19
+
3
20
  ## 0.1.0 - 2026-10-01
4
21
 
5
22
  First release: Sign in with ChatGPT for OmniAuth and Devise, with PKCE, a
data/README.md CHANGED
@@ -105,6 +105,17 @@ bundle exec rake test
105
105
  JWT_VERSION="~> 2.10" bundle update jwt && bundle exec rake test
106
106
  ```
107
107
 
108
+ ## Releasing
109
+
110
+ Bump `OmniAuth::OpenAI::VERSION`, add a `CHANGELOG.md` entry, then:
111
+
112
+ ```sh
113
+ bundle exec rake test
114
+ gem build omniauth-openai.gemspec
115
+ gem push omniauth-openai-X.Y.Z.gem --otp CODE
116
+ git tag -a vX.Y.Z -m "omniauth-openai X.Y.Z" && git push github main vX.Y.Z
117
+ ```
118
+
108
119
  ## License
109
120
 
110
121
  MIT
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module OpenAI
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
@@ -125,6 +125,7 @@ module OmniAuth
125
125
  leeway: options.leeway
126
126
  )
127
127
 
128
+ verify_subject(claims)
128
129
  verify_authorized_party(claims)
129
130
  verify_nonce(claims, expected_nonce)
130
131
  claims
@@ -132,6 +133,14 @@ module OmniAuth
132
133
  raise CallbackError.new(:invalid_id_token, e.message)
133
134
  end
134
135
 
136
+ # ruby-jwt's required_claims checks only that sub is present. Accounts are
137
+ # keyed on it, so it must be a real identifier.
138
+ def verify_subject(claims)
139
+ return if claims["sub"].is_a?(String) && !claims["sub"].strip.empty?
140
+
141
+ raise CallbackError.new(:invalid_id_token, "The ID token has no subject")
142
+ end
143
+
135
144
  # OpenID Connect Core 3.1.3.7: a token for several audiences must name
136
145
  # this client as the party it was issued to.
137
146
  def verify_authorized_party(claims)
@@ -147,9 +156,16 @@ module OmniAuth
147
156
  raise CallbackError.new(:invalid_id_token, "The ID token nonce did not match")
148
157
  end
149
158
 
159
+ # A response that is not a key set raises before KeySet stores it, so
160
+ # one bad answer from the issuer cannot be cached as the keys.
150
161
  def signing_keys(kid_not_found: false)
151
162
  key_set.fetch(kid_not_found: kid_not_found) do
152
- client.request(:get, options.jwks_uri).parsed
163
+ jwks = client.request(:get, options.jwks_uri).parsed
164
+ unless jwks.is_a?(Hash) && jwks["keys"].is_a?(Array)
165
+ raise CallbackError.new(:invalid_id_token, "The issuer's key set is not a JSON Web Key Set")
166
+ end
167
+
168
+ jwks
153
169
  end
154
170
  end
155
171
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ajay Krishnan