keycardai-oauth 0.9.2 → 0.10.0

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: 73096603402556204c3aa921c4821cbb250b662d957c6ead112dd28658dd303b
4
- data.tar.gz: 53a912a76ea3194c4a78273ad494b6cde5e06591bbb429b0a310ea6bd401baa3
3
+ metadata.gz: fbe4dc737a7a8ab30d17ac738620e62878c16f2f4fa25ad2821cef9d82e635cf
4
+ data.tar.gz: 41f9295086fd2fca1d23c7513d40fb5f689a86ffc3ad2c5c312ec035a38ca2e2
5
5
  SHA512:
6
- metadata.gz: f61479a708c6423eed6139eccedea61332023e16edc1bbacf1424908492db43b5535c85550b700ffdbaf3648e0ad0859406652cfa4abbda3b03ba5925e75952f
7
- data.tar.gz: 269c4b3ae7318f44b532beaab189352c00e57ebd942b6960ef6c5122f5c1cec0ea828706c0139a39498c3a15358b9764ae45169f1e56c5b4ab1ddbdf41bcae2a
6
+ metadata.gz: 7166b568c0176d7d9e73b8985c44640d71158f6abf4c3fb5e5d16767b0d4c616c19bd18420a4500de201b20d7ea0a371fc37b23ac9dda50efb3ab2541b0968e2
7
+ data.tar.gz: dbeba673528ec8fbca7e82d82910c3170f133b6e498ca11b87192a384719c5b28ecc04adc4809c7ed24076498f4e3c26e076039707c14e4b3ec03ea03b99565c
data/CHANGELOG.md CHANGED
@@ -15,6 +15,20 @@ the loopback flow (RFC 8252), JWT signing and verification with a caching JWKS
15
15
  keyring, the three application credentials (ClientSecret with multi-zone,
16
16
  WebIdentity, WorkloadIdentity with pluggable token sources), and AccessContext.
17
17
 
18
+ ## 0.10.0-keycardai-oauth (2026-11-25)
19
+
20
+
21
+ - fix(keycardai-oauth)!: reject request client IDs with Basic token exchange (#78)
22
+ - * fix(keycardai-oauth)!: reject request client IDs with Basic token exchange
23
+ - Co-Authored-By: Larry Osakwe <larry@keycard.ai>
24
+ - * test(keycardai-oauth): cover request assertion precedence with workload identity
25
+ - Co-Authored-By: Larry Osakwe <larry@keycard.ai>
26
+ - * fix(keycardai-oauth): keep the Basic client_id guard on the prepared exchange path
27
+ - ---------
28
+ - Co-authored-by: devin-ai-keycard <devin-ai@keycard.ai>
29
+ Co-authored-by: Larry Osakwe <larry@keycard.ai>
30
+ Co-authored-by: Larry Osakwe <23560354+Larry-Osakwe@users.noreply.github.com>
31
+
18
32
  ## 0.9.2-keycardai-oauth (2026-11-25)
19
33
 
20
34
 
@@ -56,6 +56,7 @@ module Keycardai
56
56
  # token endpoint and, for a multi-zone credential, that zone's client
57
57
  # authentication. Defaults to the client's issuer.
58
58
  # @return [TokenResponse]
59
+ # @raise [ConfigurationError] when the request sets client_id with HTTP Basic
59
60
  # @raise [OAuthError] an RFC 6749 §5.2 error response (invalid_grant,
60
61
  # invalid_target, invalid_scope, unauthorized_client, ...)
61
62
  # @raise [HTTPError, ProtocolError, NetworkError]
@@ -112,14 +113,27 @@ module Keycardai
112
113
  raise ArgumentError, "client_assertion_type is required when client_assertion is set" if assertion && !type
113
114
  end
114
115
 
116
+ # An explicit client_assertion authenticates the client on its own, so
117
+ # the credential adds no Basic header and prepares no assertion.
115
118
  def post_exchange(subject_token, overrides, issuer)
116
119
  params = { "grant_type" => GrantType::TOKEN_EXCHANGE, "subject_token" => subject_token,
117
120
  "subject_token_type" => TokenType::ACCESS_TOKEN }.merge(overrides)
121
+ return post_token_request(params, issuer: issuer, authorization: nil) if overrides["client_assertion"]
122
+
118
123
  authorization = @credential&.authorization_header(issuer: issuer)
119
- params = with_assertion(params, issuer) if @credential && !authorization && !overrides["client_assertion"]
124
+ reject_client_id_with_basic(overrides, authorization)
125
+ params = with_assertion(params, issuer) if @credential && !authorization
120
126
  post_token_request(params, issuer: issuer, authorization: authorization)
121
127
  end
122
128
 
129
+ # A request client_id never travels beside HTTP Basic: fail before any
130
+ # HTTP request, including discovery.
131
+ def reject_client_id_with_basic(overrides, authorization)
132
+ return unless overrides.key?("client_id") && authorization&.match?(/\ABasic\s/i)
133
+
134
+ raise ConfigurationError, "token exchange client_id cannot be sent with HTTP Basic"
135
+ end
136
+
123
137
  def with_assertion(params, issuer)
124
138
  prepared = @credential.prepare_token_exchange_request(
125
139
  subject_token: params.fetch("subject_token"), resource: params["resource"],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Keycardai
4
4
  module OAuth
5
- VERSION = "0.9.2"
5
+ VERSION = "0.10.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycardai-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keycard