doorkeeper 4.2.5 → 4.2.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of doorkeeper might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 990a2d9feaf3dd9945bac2a76742b719521e12c8
4
- data.tar.gz: 6a9e2f52ad07979a02040219f7a1f25c9768e353
3
+ metadata.gz: b4b94e7f1fb4975a36ad84ccfda9bcfb0b5e2bd7
4
+ data.tar.gz: fc5914c689e55572a9313caa07f2644c29f37574
5
5
  SHA512:
6
- metadata.gz: 641cb1c261a315bd330719a00ba622dbfd61c973f30124698db92ee33b3ff88314d4636e459fd367b73fffdd49da945307e3947a243bdbaf710f9a76a9c1759f
7
- data.tar.gz: cb2ff264f9e2e175bd3ed311d54ea24603d16f36b51bf4cdbb56fe4fe855e3785f668b9f0e8a5692ae85bc8057daaa47f14fde8c7cca367c6f08a6dce97bfb54
6
+ metadata.gz: f90cc508667ce0ec9693925a187fbc9ae5b9eeaf95b74648c9981ceea9eaef305d9981f75d48a8b8f0e00929bcc748a51da4b013b814ffa8a9344a4fc44257e1
7
+ data.tar.gz: 433cafea0488b8d0ab2d7d9b164b9510191f9a6d6534443674064e60c8ea2c0007494a9015b8c9d96a44b603182217496d4221db752c21d1cc5e56b1e377ae86
@@ -6,6 +6,7 @@ rvm:
6
6
  - 2.1
7
7
  - 2.2.6
8
8
  - 2.3.3
9
+ - 2.4.0
9
10
 
10
11
  before_install:
11
12
  - gem install bundler -v '~> 1.10'
data/NEWS.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  User-visible changes worth mentioning.
4
4
 
5
+ ## master
6
+
7
+ - [#970] Escape certain attributes in authorization forms.
8
+
5
9
  ## 4.2.5
6
10
 
7
11
  - [#936] Deprecate `Doorkeeper#configured?`, `Doorkeeper#database_installed?`, and
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Doorkeeper - awesome oauth provider for your Rails app.
1
+ # Doorkeeper - awesome OAuth2 provider for your Rails app.
2
2
 
3
3
  [![Build Status](https://travis-ci.org/doorkeeper-gem/doorkeeper.svg?branch=master)](https://travis-ci.org/doorkeeper-gem/doorkeeper)
4
4
  [![Dependency Status](https://gemnasium.com/doorkeeper-gem/doorkeeper.svg?travis)](https://gemnasium.com/doorkeeper-gem/doorkeeper)
@@ -1,17 +1,10 @@
1
1
  # Releasing doorkeeper
2
2
 
3
+ How to release doorkeeper in five easy steps!
4
+
3
5
  1. Update `lib/doorkeeper/version.rb` file accordingly.
4
6
  2. Update `NEWS.md` to reflect the changes since last release.
5
- 3. Commit changes. There shouldn’t be code changes, and thus CI doesn’t need to
6
- run, you can then add “[ci skip]” to the commit message.
7
- 4. Tag the release: `git tag vVERSION -m "Release vVERSION"`
8
- 5. Push changes: `git push && git push --tags`
9
- 6. Build and publish the gem:
10
-
11
- ```bash
12
- gem build doorkeeper.gemspec
13
- gem push doorkeeper-*.gem
14
- ```
15
-
16
- 7. Announce the new release, making sure to say “thank you” to the contributors
7
+ 3. Commit changes: `git commit -am 'Bump to vVERSION'`
8
+ 4. Run `rake release`
9
+ 5. Announce the new release, making sure to say “thank you” to the contributors
17
10
  who helped shape this version!
@@ -21,7 +21,7 @@
21
21
  </span>
22
22
  <% if Doorkeeper.configuration.native_redirect_uri %>
23
23
  <span class="help-block">
24
- <%= raw t('doorkeeper.applications.help.native_redirect_uri', native_redirect_uri: "<code>#{ Doorkeeper.configuration.native_redirect_uri }</code>") %>
24
+ <%= raw t('doorkeeper.applications.help.native_redirect_uri', native_redirect_uri: content_tag(:code) { Doorkeeper.configuration.native_redirect_uri }) %>
25
25
  </span>
26
26
  <% end %>
27
27
  </div>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <main role="main">
6
6
  <p class="h4">
7
- <%= raw t('.prompt', client_name: "<strong class=\"text-info\">#{ @pre_auth.client.name }</strong>") %>
7
+ <%= raw t('.prompt', client_name: content_tag(:strong, class: 'text-info') { @pre_auth.client.name }) %>
8
8
  </p>
9
9
 
10
10
  <% if @pre_auth.scopes.count > 0 %>
@@ -26,5 +26,4 @@ Gem::Specification.new do |s|
26
26
  s.add_development_dependency "generator_spec", "~> 0.9.3"
27
27
  s.add_development_dependency "rake", ">= 11.3.0"
28
28
  s.add_development_dependency "rspec-rails"
29
- s.add_development_dependency "timecop", "~> 0.8.1"
30
29
  end
@@ -1,21 +1,39 @@
1
1
  module Doorkeeper
2
2
  module Errors
3
3
  class DoorkeeperError < StandardError
4
+ def type
5
+ message
6
+ end
4
7
  end
5
8
 
6
9
  class InvalidAuthorizationStrategy < DoorkeeperError
10
+ def type
11
+ :unsupported_response_type
12
+ end
7
13
  end
8
14
 
9
15
  class InvalidTokenReuse < DoorkeeperError
16
+ def type
17
+ :invalid_request
18
+ end
10
19
  end
11
20
 
12
21
  class InvalidGrantReuse < DoorkeeperError
22
+ def type
23
+ :invalid_grant
24
+ end
13
25
  end
14
26
 
15
27
  class InvalidTokenStrategy < DoorkeeperError
28
+ def type
29
+ :unsupported_grant_type
30
+ end
16
31
  end
17
32
 
18
33
  class MissingRequestStrategy < DoorkeeperError
34
+ def type
35
+ :invalid_request
36
+ end
19
37
  end
20
38
 
21
39
  class UnableToGenerateToken < DoorkeeperError
@@ -34,22 +34,7 @@ module Doorkeeper
34
34
  end
35
35
 
36
36
  def get_error_response_from_exception(exception)
37
- error_name = case exception
38
- when Errors::InvalidTokenStrategy
39
- :unsupported_grant_type
40
- when Errors::InvalidAuthorizationStrategy
41
- :unsupported_response_type
42
- when Errors::MissingRequestStrategy
43
- :invalid_request
44
- when Errors::InvalidTokenReuse
45
- :invalid_request
46
- when Errors::InvalidGrantReuse
47
- :invalid_grant
48
- when Errors::DoorkeeperError
49
- exception.message
50
- end
51
-
52
- OAuth::ErrorResponse.new name: error_name, state: params[:state]
37
+ OAuth::ErrorResponse.new name: exception.type, state: params[:state]
53
38
  end
54
39
 
55
40
  def handle_token_exception(exception)
@@ -1,3 +1,3 @@
1
1
  module Doorkeeper
2
- VERSION = "4.2.5".freeze
2
+ VERSION = "4.2.6".freeze
3
3
  end
@@ -3,9 +3,24 @@ require 'spec_helper_integration'
3
3
  describe Doorkeeper::AuthorizationsController, 'implicit grant flow' do
4
4
  include AuthorizationRequestHelper
5
5
 
6
- def fragments(param)
7
- fragment = URI.parse(response.location).fragment
8
- Rack::Utils.parse_query(fragment)[param]
6
+ if Rails::VERSION::MAJOR == 5
7
+ class ActionDispatch::TestResponse
8
+ def query_params
9
+ @_query_params ||= begin
10
+ fragment = URI.parse(location).fragment
11
+ Rack::Utils.parse_query(fragment)
12
+ end
13
+ end
14
+ end
15
+ else
16
+ class ActionController::TestResponse
17
+ def query_params
18
+ @_query_params ||= begin
19
+ fragment = URI.parse(location).fragment
20
+ Rack::Utils.parse_query(fragment)
21
+ end
22
+ end
23
+ end
9
24
  end
10
25
 
11
26
  def translated_error_message(key)
@@ -35,15 +50,15 @@ describe Doorkeeper::AuthorizationsController, 'implicit grant flow' do
35
50
  end
36
51
 
37
52
  it 'includes access token in fragment' do
38
- expect(fragments('access_token')).to eq(Doorkeeper::AccessToken.first.token)
53
+ expect(response.query_params['access_token']).to eq(Doorkeeper::AccessToken.first.token)
39
54
  end
40
55
 
41
56
  it 'includes token type in fragment' do
42
- expect(fragments('token_type')).to eq('bearer')
57
+ expect(response.query_params['token_type']).to eq('bearer')
43
58
  end
44
59
 
45
60
  it 'includes token expiration in fragment' do
46
- expect(fragments('expires_in').to_i).to eq(2.hours.to_i)
61
+ expect(response.query_params['expires_in'].to_i).to eq(2.hours.to_i)
47
62
  end
48
63
 
49
64
  it 'issues the token for the current client' do
@@ -70,15 +85,15 @@ describe Doorkeeper::AuthorizationsController, 'implicit grant flow' do
70
85
  end
71
86
 
72
87
  it 'does not include access token in fragment' do
73
- expect(fragments('access_token')).to be_nil
88
+ expect(response.query_params['access_token']).to be_nil
74
89
  end
75
90
 
76
91
  it 'includes error in fragment' do
77
- expect(fragments('error')).to eq('invalid_scope')
92
+ expect(response.query_params['error']).to eq('invalid_scope')
78
93
  end
79
94
 
80
95
  it 'includes error description in fragment' do
81
- expect(fragments('error_description')).to eq(translated_error_message(:invalid_scope))
96
+ expect(response.query_params['error_description']).to eq(translated_error_message(:invalid_scope))
82
97
  end
83
98
 
84
99
  it 'does not issue any access token' do
@@ -95,7 +110,7 @@ describe Doorkeeper::AuthorizationsController, 'implicit grant flow' do
95
110
  end
96
111
 
97
112
  it 'returns the existing access token in a fragment' do
98
- expect(fragments('access_token')).to eq(access_token.token)
113
+ expect(response.query_params['access_token']).to eq(access_token.token)
99
114
  end
100
115
 
101
116
  it 'does not creates a new access token' do
@@ -169,11 +184,11 @@ describe Doorkeeper::AuthorizationsController, 'implicit grant flow' do
169
184
  end
170
185
 
171
186
  it 'includes token type in fragment' do
172
- expect(fragments('token_type')).to eq('bearer')
187
+ expect(response.query_params['token_type']).to eq('bearer')
173
188
  end
174
189
 
175
190
  it 'includes token expiration in fragment' do
176
- expect(fragments('expires_in').to_i).to eq(2.hours.to_i)
191
+ expect(response.query_params['expires_in'].to_i).to eq(2.hours.to_i)
177
192
  end
178
193
 
179
194
  it 'issues the token for the current client' do
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'timecop'
3
2
  require 'active_support/time'
4
3
  require 'doorkeeper/models/concerns/expirable'
5
4
 
@@ -1,9 +1,10 @@
1
1
  require 'spec_helper_integration'
2
2
 
3
3
  feature 'Authorization Code Flow Errors' do
4
+ let(:client_params) { {} }
4
5
  background do
5
6
  config_is_set(:authenticate_resource_owner) { User.first || redirect_to('/sign_in') }
6
- client_exists
7
+ client_exists client_params
7
8
  create_resource_owner
8
9
  sign_in
9
10
  end
@@ -12,6 +13,15 @@ feature 'Authorization Code Flow Errors' do
12
13
  access_grant_should_not_exist
13
14
  end
14
15
 
16
+ context "with a client trying to xss resource owner" do
17
+ let(:client_name) { "<div id='xss'>XSS</div>" }
18
+ let(:client_params) { { name: client_name } }
19
+ scenario "resource owner visit authorization endpoint" do
20
+ visit authorization_endpoint_url(client: @client)
21
+ expect(page).not_to have_css("#xss")
22
+ end
23
+ end
24
+
15
25
  context 'when access was denied' do
16
26
  scenario 'redirects with error' do
17
27
  visit authorization_endpoint_url(client: @client)
@@ -16,7 +16,6 @@ require 'capybara/rspec'
16
16
  require 'dummy/config/environment'
17
17
  require 'rspec/rails'
18
18
  require 'generator_spec/test_case'
19
- require 'timecop'
20
19
  require 'database_cleaner'
21
20
 
22
21
  # Load JRuby SQLite3 if in that platform
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.5
4
+ version: 4.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-12 00:00:00.000000000 Z
13
+ date: 2017-05-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -124,20 +124,6 @@ dependencies:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
- - !ruby/object:Gem::Dependency
128
- name: timecop
129
- requirement: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - "~>"
132
- - !ruby/object:Gem::Version
133
- version: 0.8.1
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - "~>"
139
- - !ruby/object:Gem::Version
140
- version: 0.8.1
141
127
  description: Doorkeeper is an OAuth 2 provider for Rails and Grape.
142
128
  email:
143
129
  - me@jonathanmoss.me
@@ -400,7 +386,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
386
  version: '0'
401
387
  requirements: []
402
388
  rubyforge_project:
403
- rubygems_version: 2.5.2
389
+ rubygems_version: 2.6.11
404
390
  signing_key:
405
391
  specification_version: 4
406
392
  summary: OAuth 2 provider for Rails and Grape