doorkeeper-openid_connect 2.1.0 → 2.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: 8eba70212cad992603afa10fe0f3ae1db4461c03938897418e8659f6a95c64bb
4
- data.tar.gz: 74cc66dd6b502f6897428d36173f8faa0b68293dd456b99d7d80343714b2bb54
3
+ metadata.gz: 6d2169dd8252fbb6b88daa2d0a0b3dafcf2ffceb9b479f988b577f3dbac798ec
4
+ data.tar.gz: a15881f9ac2fce9a88665838c117cad1819a07cdafc056432efbbda9c4683d42
5
5
  SHA512:
6
- metadata.gz: 751bf66f9a2a58009f787a13c50d9a22a9f7b76117c8fbf1062e22896237ef7d8b66778e4834d59092fa7cdc623f48850b4e61eb796ba36f035418f3d4a39512
7
- data.tar.gz: 1df8e6e7c4600a43e81833f5dcc3a210d99d4003a7f8a5bcde2ae53b8df662ced2147e7961d022b13a20607692f9147c44c7eee31704fd2ef11f289b0dd1ddac
6
+ metadata.gz: 0304a7aef5d379f271f4c1dd508367189159a015b8123a01ffc39b5517936dc5b883f164956c622d7ac09c35d9de2b2b9ec991d5f9b6abb9384fc76f4dcf2294
7
+ data.tar.gz: 97d4abfbd930912622a1f38dfe4f3e43394f0cfd33c7c8248dc3672ae41511558eadcad1e386dd8a9b96b8387b26fb11c7546a3dd5968519b09aa03bb279e1c5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ Upgrading? [Migration from Old Versions](https://github.com/doorkeeper-gem/doork
4
4
 
5
5
  - Add entry here
6
6
 
7
+ ## v2.1.1 (2026-11-24))
8
+
9
+ - **Security:** Leave it to Doorkeeper whether an earlier access token can stand in for the resource owner's consent on a `prompt=none` request. Since v1.10.0 such a request was answered with an authorization code (or, on the implicit flow, with tokens) for any client with a matching earlier token, public clients included — which Doorkeeper itself has refused since 5.6.6 (CVE-2023-34246). It now fails with `consent_required` for a public client, and wherever else Doorkeeper asks for consent again: when `custom_access_token_attributes` is configured (Doorkeeper >= 5.7), and on Doorkeeper 6.0 for a client known only from its metadata document or an earlier token issued for another `resource` (RFC 8707). Confidential clients are otherwise unaffected
10
+ - A public client that relies on `prompt=none` for silent re-authentication now receives `consent_required`. To keep such a client silent, exempt it from consent with Doorkeeper's `skip_authorization`
11
+
7
12
  ## v2.1.0 (2026-10-20)
8
13
 
9
14
  - [#401] Fix `max_age` reauthentication loop when `auth_time_from_session` returns a String — parse it as a timestamp instead of falling through to `to_i` (same class of bug as [#248]) — and treat a future auth_time as stale (60 s clock-skew leeway)
@@ -13,6 +13,20 @@ module Doorkeeper
13
13
  def pre_auth_param_fields
14
14
  super.append(:nonce)
15
15
  end
16
+
17
+ # Issue #63: on a `prompt=none` request, an earlier token whose scopes
18
+ # cover more than the request asks for matches as well, not only one
19
+ # with exactly the requested scopes.
20
+ #
21
+ # This widens the match and nothing else. Doorkeeper consults it from
22
+ # #can_authorize_response?, after its own conditions on the client, so
23
+ # those apply to the wider token exactly as they do to an exact one. Do
24
+ # not move this into an override of #skip_authorization? or of
25
+ # #can_authorize_response? itself: either one answers in Doorkeeper's
26
+ # place and lets a public client through without consent.
27
+ def matching_token?
28
+ super || oidc_prompt_none_matching_token?
29
+ end
16
30
  end
17
31
  end
18
32
  end
@@ -34,13 +34,16 @@ module Doorkeeper
34
34
  def handle_oidc_prompt_none!(prompt_values, owner)
35
35
  raise Errors::InvalidRequest if (prompt_values - ["none"]).any?
36
36
  raise Errors::LoginRequired unless owner
37
- raise Errors::ConsentRequired if oidc_consent_required?(owner)
38
37
 
39
- # Issue #63: if an active token already covers the requested scopes
40
- # (a non-strict superset, including the exact-match case), force
41
- # auto-issue rather than rendering the consent form — `prompt=none`
42
- # forbids any interactive UI (OIDC Core §3.1.2.1).
43
- @_oidc_prompt_none_skip_authorization = true if oidc_matching_subset_token?(owner)
38
+ # Issue #63: from here on, an earlier token covering more than the
39
+ # requested scopes counts as a matching token as well (see
40
+ # AuthorizationsExtension#matching_token?), so that a client
41
+ # re-authorizing with a narrower scope is not held up by a consent
42
+ # form `prompt=none` forbids. This does not decide that consent
43
+ # can be skipped; Doorkeeper does, with its own conditions.
44
+ @_oidc_prompt_none = true
45
+
46
+ raise Errors::ConsentRequired if oidc_consent_required?(owner)
44
47
  end
45
48
 
46
49
  def handle_oidc_prompt_login!(owner)
@@ -4,14 +4,50 @@ module Doorkeeper
4
4
  module OpenidConnect
5
5
  module Helpers
6
6
  module Controller
7
- # Decides whether an already-issued access token can satisfy the
8
- # current authorization request, so `prompt=none` can succeed (or
9
- # consent can be skipped) without interactive UI.
7
+ # Answers whether a `prompt=none` request can go through without the
8
+ # consent form, and widens what counts as a matching token for such a
9
+ # request (issue #63).
10
+ #
11
+ # Whether an earlier token may stand in for the resource owner's
12
+ # consent is Doorkeeper's decision, and nothing here makes it on
13
+ # Doorkeeper's behalf. Doorkeeper refuses it for public clients
14
+ # (CVE-2023-34246: the client's identity cannot be proven, and
15
+ # another application may be receiving its redirect URI, RFC 8252
16
+ # §8.6), and keeps adding conditions of the same kind — custom
17
+ # access token attributes, clients known only from a metadata
18
+ # document. This module asks Doorkeeper instead of repeating them:
19
+ # a copy that falls behind is a consent bypass.
10
20
  module TokenMatching
11
21
  private
12
22
 
13
- def oidc_consent_required?(owner)
14
- !skip_authorization? && !matching_token? && !oidc_matching_subset_token?(owner)
23
+ # Whether Doorkeeper is going to show the consent form — it calls
24
+ # the same two predicates from
25
+ # AuthorizationsController#render_success. `prompt=none` forbids any
26
+ # interactive UI (OIDC Core §3.1.2.1), so the request has to fail
27
+ # with `consent_required` instead.
28
+ #
29
+ # The argument is not consulted any more: the predicates work on
30
+ # Doorkeeper's `current_resource_owner`. It stays so that existing
31
+ # callers keep working.
32
+ def oidc_consent_required?(_owner = nil)
33
+ !skip_authorization? && !oidc_earlier_token_stands_in_for_consent?
34
+ end
35
+
36
+ def oidc_earlier_token_stands_in_for_consent?
37
+ return can_authorize_response? if respond_to?(:can_authorize_response?, true)
38
+
39
+ # Doorkeeper < 5.7 has no #can_authorize_response?: the rule sits
40
+ # inline in #render_success, and before 5.6.6 it did not look at
41
+ # the client type at all (CVE-2023-34246). `prompt=none` is held
42
+ # to the fixed rule on every supported version.
43
+ pre_auth.client.application.confidential? && matching_token?
44
+ end
45
+
46
+ # Whether a `prompt=none` request finds an earlier token covering
47
+ # more than the scopes it asks for. See
48
+ # AuthorizationsExtension#matching_token?, the only caller.
49
+ def oidc_prompt_none_matching_token?
50
+ @_oidc_prompt_none && oidc_matching_subset_token?(current_resource_owner)
15
51
  end
16
52
 
17
53
  # Returns true if the resource owner already has an active token for this
@@ -36,17 +72,26 @@ module Doorkeeper
36
72
  batch_size = Doorkeeper.configuration.token_lookup_batch_size
37
73
 
38
74
  token_model.find_access_token_in_batches(relation, batch_size: batch_size) do |batch|
39
- return true if batch.any? { |token| token.scopes.scopes?(pre_auth.scopes) }
75
+ return true if batch.any? { |token| oidc_token_covers_request?(token) }
40
76
  end
41
77
  false
42
78
  end
43
79
 
44
- # Force Doorkeeper's `render_success` onto the auto-issue path when a
45
- # `prompt=none` subset-scope reauthorization has been validated above.
46
- def skip_authorization?
47
- return true if @_oidc_prompt_none_skip_authorization
80
+ def oidc_token_covers_request?(token)
81
+ token.scopes.scopes?(pre_auth.scopes) && oidc_token_audience_matches?(token)
82
+ end
83
+
84
+ # RFC 8707 (Doorkeeper >= 6.0): a token issued for another audience
85
+ # does not match, whatever its scopes. This is the one condition
86
+ # Doorkeeper applies per token, inside its own #matching_token?, so
87
+ # the scan above has to apply it as well.
88
+ def oidc_token_audience_matches?(token)
89
+ token_model = Doorkeeper.config.access_token_model
90
+ return true unless token_model.respond_to?(:resource_indicators_match?)
48
91
 
49
- super
92
+ token_model.resource_indicators_match?(
93
+ token, pre_auth.resource_indicators&.join(" ").presence,
94
+ )
50
95
  end
51
96
  end
52
97
  end
@@ -4,7 +4,7 @@ module Doorkeeper
4
4
  module OpenidConnect
5
5
  MAJOR = 2
6
6
  MINOR = 1
7
- TINY = 0
7
+ TINY = 1
8
8
  PRE = nil
9
9
 
10
10
  # Full version number
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper-openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Dengler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-10-20 00:00:00.000000000 Z
13
+ date: 2026-11-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: doorkeeper
@@ -60,20 +60,6 @@ dependencies:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
- - !ruby/object:Gem::Dependency
64
- name: conventional-changelog
65
- requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.2'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.2'
77
63
  - !ruby/object:Gem::Dependency
78
64
  name: drb
79
65
  requirement: !ruby/object:Gem::Requirement