doorkeeper 5.1.0 → 5.2.0.rc2
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 +4 -4
- data/CHANGELOG.md +825 -0
- data/CONTRIBUTING.md +11 -9
- data/Dangerfile +2 -2
- data/Dockerfile +29 -0
- data/Gemfile +2 -1
- data/NEWS.md +1 -814
- data/README.md +2 -2
- data/RELEASING.md +6 -5
- data/app/controllers/doorkeeper/applications_controller.rb +2 -0
- data/app/controllers/doorkeeper/authorizations_controller.rb +6 -1
- data/app/controllers/doorkeeper/tokens_controller.rb +32 -9
- data/app/validators/redirect_uri_validator.rb +19 -9
- data/app/views/doorkeeper/applications/_form.html.erb +0 -6
- data/app/views/doorkeeper/applications/show.html.erb +1 -1
- data/config/locales/en.yml +3 -1
- data/doorkeeper.gemspec +1 -1
- data/gemfiles/rails_5_0.gemfile +1 -0
- data/gemfiles/rails_5_1.gemfile +1 -0
- data/gemfiles/rails_5_2.gemfile +1 -0
- data/gemfiles/rails_6_0.gemfile +2 -1
- data/gemfiles/rails_master.gemfile +1 -0
- data/lib/doorkeeper/config/option.rb +13 -7
- data/lib/doorkeeper/config.rb +33 -3
- data/lib/doorkeeper/grape/helpers.rb +5 -1
- data/lib/doorkeeper/helpers/controller.rb +16 -3
- data/lib/doorkeeper/models/access_token_mixin.rb +43 -2
- data/lib/doorkeeper/oauth/authorization/code.rb +10 -8
- data/lib/doorkeeper/oauth/authorization/token.rb +1 -1
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +14 -0
- data/lib/doorkeeper/oauth/code_response.rb +2 -2
- data/lib/doorkeeper/oauth/error_response.rb +1 -1
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +18 -4
- data/lib/doorkeeper/oauth/nonstandard.rb +39 -0
- data/lib/doorkeeper/oauth/refresh_token_request.rb +8 -8
- data/lib/doorkeeper/oauth/token_introspection.rb +19 -12
- data/lib/doorkeeper/orm/active_record/access_grant.rb +1 -1
- data/lib/doorkeeper/orm/active_record/access_token.rb +2 -2
- data/lib/doorkeeper/orm/active_record/application.rb +7 -1
- data/lib/doorkeeper/orm/active_record.rb +17 -1
- data/lib/doorkeeper/stale_records_cleaner.rb +6 -2
- data/lib/doorkeeper/version.rb +2 -2
- data/lib/doorkeeper.rb +3 -0
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +6 -6
- data/lib/generators/doorkeeper/templates/initializer.rb +57 -12
- data/lib/generators/doorkeeper/templates/migration.rb.erb +3 -0
- data/spec/controllers/applications_controller_spec.rb +93 -0
- data/spec/controllers/authorizations_controller_spec.rb +13 -0
- data/spec/controllers/tokens_controller_spec.rb +205 -37
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/config/initializers/doorkeeper.rb +54 -9
- data/spec/lib/config_spec.rb +11 -0
- data/spec/lib/oauth/client_credentials/creator_spec.rb +3 -0
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +17 -2
- data/spec/lib/oauth/pre_authorization_spec.rb +0 -15
- data/spec/requests/flows/authorization_code_spec.rb +16 -4
- data/spec/requests/flows/revoke_token_spec.rb +19 -11
- data/spec/support/doorkeeper_rspec.rb +1 -1
- data/spec/validators/redirect_uri_validator_spec.rb +39 -14
- metadata +7 -13
- data/.coveralls.yml +0 -1
- data/.github/ISSUE_TEMPLATE.md +0 -25
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -17
- data/.gitignore +0 -20
- data/.gitlab-ci.yml +0 -16
- data/.hound.yml +0 -3
- data/.rspec +0 -1
- data/.rubocop.yml +0 -50
- data/.travis.yml +0 -35
|
@@ -18,7 +18,7 @@ describe RedirectUriValidator do
|
|
|
18
18
|
#
|
|
19
19
|
# @see https://www.oauth.com/oauth2-servers/redirect-uris/redirect-uris-native-apps/
|
|
20
20
|
it "is valid when the uri is custom native URI" do
|
|
21
|
-
subject.redirect_uri = "myapp
|
|
21
|
+
subject.redirect_uri = "myapp:/callback"
|
|
22
22
|
expect(subject).to be_valid
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -27,33 +27,48 @@ describe RedirectUriValidator do
|
|
|
27
27
|
expect(subject).to be_valid
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
it "accepts
|
|
30
|
+
it "accepts nonstandard oob redirect uri" do
|
|
31
31
|
subject.redirect_uri = "urn:ietf:wg:oauth:2.0:oob"
|
|
32
32
|
expect(subject).to be_valid
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
it "
|
|
36
|
-
|
|
37
|
-
subject.
|
|
38
|
-
expect(subject).not_to be_valid
|
|
35
|
+
it "accepts nonstandard oob:auto redirect uri" do
|
|
36
|
+
subject.redirect_uri = "urn:ietf:wg:oauth:2.0:oob:auto"
|
|
37
|
+
expect(subject).to be_valid
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
it "is invalid when the uri is not a uri" do
|
|
42
41
|
subject.redirect_uri = "]"
|
|
43
42
|
expect(subject).not_to be_valid
|
|
44
|
-
expect(subject.errors[:redirect_uri].first).to eq("
|
|
43
|
+
expect(subject.errors[:redirect_uri].first).to eq(I18n.t("activerecord.errors.models.doorkeeper/application.attributes.redirect_uri.invalid_uri"))
|
|
45
44
|
end
|
|
46
45
|
|
|
47
46
|
it "is invalid when the uri is relative" do
|
|
48
47
|
subject.redirect_uri = "/abcd"
|
|
49
48
|
expect(subject).not_to be_valid
|
|
50
|
-
expect(subject.errors[:redirect_uri].first).to eq("
|
|
49
|
+
expect(subject.errors[:redirect_uri].first).to eq(I18n.t("activerecord.errors.models.doorkeeper/application.attributes.redirect_uri.relative_uri"))
|
|
51
50
|
end
|
|
52
51
|
|
|
53
52
|
it "is invalid when the uri has a fragment" do
|
|
54
53
|
subject.redirect_uri = "https://example.com/abcd#xyz"
|
|
55
54
|
expect(subject).not_to be_valid
|
|
56
|
-
expect(subject.errors[:redirect_uri].first).to eq("
|
|
55
|
+
expect(subject.errors[:redirect_uri].first).to eq(I18n.t("activerecord.errors.models.doorkeeper/application.attributes.redirect_uri.fragment_present"))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "is invalid when scheme resolves to localhost (needs an explict scheme)" do
|
|
59
|
+
subject.redirect_uri = "localhost:80"
|
|
60
|
+
expect(subject).to be_invalid
|
|
61
|
+
expect(subject.errors[:redirect_uri].first).to eq(I18n.t("activerecord.errors.models.doorkeeper/application.attributes.redirect_uri.unspecified_scheme"))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "is invalid if an ip address" do
|
|
65
|
+
subject.redirect_uri = "127.0.0.1:8080"
|
|
66
|
+
expect(subject).to be_invalid
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "accepts an ip address based URI if a scheme is specified" do
|
|
70
|
+
subject.redirect_uri = "https://127.0.0.1:8080"
|
|
71
|
+
expect(subject).to be_valid
|
|
57
72
|
end
|
|
58
73
|
|
|
59
74
|
context "force secured uri" do
|
|
@@ -62,13 +77,23 @@ describe RedirectUriValidator do
|
|
|
62
77
|
expect(subject).to be_valid
|
|
63
78
|
end
|
|
64
79
|
|
|
65
|
-
it "accepts
|
|
66
|
-
subject.redirect_uri = "
|
|
80
|
+
it "accepts custom scheme redirect uri (as per rfc8252 section 7.1)" do
|
|
81
|
+
subject.redirect_uri = "com.example.app:/oauth/callback"
|
|
82
|
+
expect(subject).to be_valid
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "accepts custom scheme redirect uri (as per rfc8252 section 7.1) #2" do
|
|
86
|
+
subject.redirect_uri = "com.example.app:/test"
|
|
87
|
+
expect(subject).to be_valid
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "accepts custom scheme redirect uri (common misconfiguration we have decided to allow)" do
|
|
91
|
+
subject.redirect_uri = "com.example.app://oauth/callback"
|
|
67
92
|
expect(subject).to be_valid
|
|
68
93
|
end
|
|
69
94
|
|
|
70
|
-
it "accepts
|
|
71
|
-
subject.redirect_uri = "
|
|
95
|
+
it "accepts custom scheme redirect uri (common misconfiguration we have decided to allow) #2" do
|
|
96
|
+
subject.redirect_uri = "com.example.app://test"
|
|
72
97
|
expect(subject).to be_valid
|
|
73
98
|
end
|
|
74
99
|
|
|
@@ -118,7 +143,7 @@ describe RedirectUriValidator do
|
|
|
118
143
|
subject.redirect_uri = "http://example.com/callback"
|
|
119
144
|
expect(subject).not_to be_valid
|
|
120
145
|
error = subject.errors[:redirect_uri].first
|
|
121
|
-
expect(error).to eq("
|
|
146
|
+
expect(error).to eq(I18n.t("activerecord.errors.models.doorkeeper/application.attributes.redirect_uri.secured_uri"))
|
|
122
147
|
end
|
|
123
148
|
end
|
|
124
149
|
|
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: 5.
|
|
4
|
+
version: 5.2.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Felipe Elias Philipp
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2019-
|
|
14
|
+
date: 2019-06-17 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: railties
|
|
@@ -174,19 +174,12 @@ executables: []
|
|
|
174
174
|
extensions: []
|
|
175
175
|
extra_rdoc_files: []
|
|
176
176
|
files:
|
|
177
|
-
- ".coveralls.yml"
|
|
178
|
-
- ".github/ISSUE_TEMPLATE.md"
|
|
179
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
180
|
-
- ".gitignore"
|
|
181
|
-
- ".gitlab-ci.yml"
|
|
182
|
-
- ".hound.yml"
|
|
183
|
-
- ".rspec"
|
|
184
|
-
- ".rubocop.yml"
|
|
185
|
-
- ".travis.yml"
|
|
186
177
|
- Appraisals
|
|
178
|
+
- CHANGELOG.md
|
|
187
179
|
- CODE_OF_CONDUCT.md
|
|
188
180
|
- CONTRIBUTING.md
|
|
189
181
|
- Dangerfile
|
|
182
|
+
- Dockerfile
|
|
190
183
|
- Gemfile
|
|
191
184
|
- MIT-LICENSE
|
|
192
185
|
- NEWS.md
|
|
@@ -269,6 +262,7 @@ files:
|
|
|
269
262
|
- lib/doorkeeper/oauth/helpers/unique_token.rb
|
|
270
263
|
- lib/doorkeeper/oauth/helpers/uri_checker.rb
|
|
271
264
|
- lib/doorkeeper/oauth/invalid_token_response.rb
|
|
265
|
+
- lib/doorkeeper/oauth/nonstandard.rb
|
|
272
266
|
- lib/doorkeeper/oauth/password_access_token_request.rb
|
|
273
267
|
- lib/doorkeeper/oauth/pre_authorization.rb
|
|
274
268
|
- lib/doorkeeper/oauth/refresh_token_request.rb
|
|
@@ -471,9 +465,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
471
465
|
version: '2.4'
|
|
472
466
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
473
467
|
requirements:
|
|
474
|
-
- - "
|
|
468
|
+
- - ">"
|
|
475
469
|
- !ruby/object:Gem::Version
|
|
476
|
-
version:
|
|
470
|
+
version: 1.3.1
|
|
477
471
|
requirements: []
|
|
478
472
|
rubygems_version: 3.0.2
|
|
479
473
|
signing_key:
|
data/.coveralls.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
service_name: travis-ci
|
data/.github/ISSUE_TEMPLATE.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
### Steps to reproduce
|
|
2
|
-
What we need to do to see your problem or bug?
|
|
3
|
-
|
|
4
|
-
The more detailed the issue, the more likely that we will fix it ASAP.
|
|
5
|
-
|
|
6
|
-
Don't use GitHub issues for questions like "How can I do that?" —
|
|
7
|
-
use [StackOverflow](https://stackoverflow.com/questions/tagged/doorkeeper)
|
|
8
|
-
instead with the corresponding tag.
|
|
9
|
-
|
|
10
|
-
### Expected behavior
|
|
11
|
-
Tell us what should happen
|
|
12
|
-
|
|
13
|
-
### Actual behavior
|
|
14
|
-
Tell us what happens instead
|
|
15
|
-
|
|
16
|
-
### System configuration
|
|
17
|
-
You can help us to understand your problem if you will share some very
|
|
18
|
-
useful information about your project environment (don't forget to
|
|
19
|
-
remove any confidential data if it exists).
|
|
20
|
-
|
|
21
|
-
**Doorkeeper initializer**:
|
|
22
|
-
|
|
23
|
-
**Ruby version**:
|
|
24
|
-
|
|
25
|
-
**Gemfile.lock**:
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
### Summary
|
|
2
|
-
|
|
3
|
-
Provide a general description of the code changes in your pull
|
|
4
|
-
request... were there any bugs you had fixed? If so, mention them. If
|
|
5
|
-
these bugs have open GitHub issues, be sure to tag them here as well,
|
|
6
|
-
to keep the conversation linked together.
|
|
7
|
-
|
|
8
|
-
### Other Information
|
|
9
|
-
|
|
10
|
-
If there's anything else that's important and relevant to your pull
|
|
11
|
-
request, mention that information here. This could include
|
|
12
|
-
benchmarks, or other information.
|
|
13
|
-
|
|
14
|
-
If you are updating NEWS.md file or are asked to update it by reviewers,
|
|
15
|
-
please add the changelog entry at the top of the file.
|
|
16
|
-
|
|
17
|
-
Thanks for contributing to Doorkeeper project!
|
data/.gitignore
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
.bundle/
|
|
2
|
-
.rbx
|
|
3
|
-
*.rbc
|
|
4
|
-
log/*.log
|
|
5
|
-
pkg/
|
|
6
|
-
spec/dummy/db/*.sqlite3
|
|
7
|
-
spec/dummy/log/*.log
|
|
8
|
-
spec/dummy/tmp/
|
|
9
|
-
spec/generators/tmp
|
|
10
|
-
Gemfile.lock
|
|
11
|
-
gemfiles/*.lock
|
|
12
|
-
.rvmrc
|
|
13
|
-
*.swp
|
|
14
|
-
.idea
|
|
15
|
-
/.yardoc/
|
|
16
|
-
/_yardoc/
|
|
17
|
-
/doc/
|
|
18
|
-
/rdoc/
|
|
19
|
-
coverage
|
|
20
|
-
*.gem
|
data/.gitlab-ci.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
dependency_scanning:
|
|
2
|
-
image: docker:stable
|
|
3
|
-
variables:
|
|
4
|
-
DOCKER_DRIVER: overlay2
|
|
5
|
-
allow_failure: true
|
|
6
|
-
services:
|
|
7
|
-
- docker:stable-dind
|
|
8
|
-
script:
|
|
9
|
-
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
|
10
|
-
- docker run
|
|
11
|
-
--env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}"
|
|
12
|
-
--volume "$PWD:/code"
|
|
13
|
-
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
14
|
-
"registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code
|
|
15
|
-
artifacts:
|
|
16
|
-
paths: [gl-dependency-scanning-report.json]
|
data/.hound.yml
DELETED
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--colour
|
data/.rubocop.yml
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
AllCops:
|
|
2
|
-
TargetRubyVersion: 2.4
|
|
3
|
-
Exclude:
|
|
4
|
-
- "spec/dummy/db/*"
|
|
5
|
-
- "spec/dummy/config/*"
|
|
6
|
-
- "Dangerfile"
|
|
7
|
-
- "gemfiles/*.gemfile"
|
|
8
|
-
|
|
9
|
-
Metrics/BlockLength:
|
|
10
|
-
Exclude:
|
|
11
|
-
- spec/**/*
|
|
12
|
-
- lib/doorkeeper/rake/*
|
|
13
|
-
|
|
14
|
-
Metrics/LineLength:
|
|
15
|
-
Exclude:
|
|
16
|
-
- spec/**/*
|
|
17
|
-
Max: 100
|
|
18
|
-
|
|
19
|
-
Metrics/MethodLength:
|
|
20
|
-
Exclude:
|
|
21
|
-
- spec/dummy/db/*
|
|
22
|
-
|
|
23
|
-
Style/StringLiterals:
|
|
24
|
-
EnforcedStyle: double_quotes
|
|
25
|
-
Style/StringLiteralsInInterpolation:
|
|
26
|
-
EnforcedStyle: double_quotes
|
|
27
|
-
|
|
28
|
-
Style/FrozenStringLiteralComment:
|
|
29
|
-
Enabled: true
|
|
30
|
-
|
|
31
|
-
Style/TrailingCommaInHashLiteral:
|
|
32
|
-
EnforcedStyleForMultiline: consistent_comma
|
|
33
|
-
Style/TrailingCommaInArrayLiteral:
|
|
34
|
-
EnforcedStyleForMultiline: consistent_comma
|
|
35
|
-
|
|
36
|
-
Style/SymbolArray:
|
|
37
|
-
MinSize: 3
|
|
38
|
-
Style/WordArray:
|
|
39
|
-
MinSize: 3
|
|
40
|
-
|
|
41
|
-
Style/ClassAndModuleChildren:
|
|
42
|
-
Exclude:
|
|
43
|
-
- spec/**/*
|
|
44
|
-
|
|
45
|
-
Layout/MultilineMethodCallIndentation:
|
|
46
|
-
EnforcedStyle: indented
|
|
47
|
-
Layout/TrailingBlankLines:
|
|
48
|
-
Enabled: true
|
|
49
|
-
Layout/DotPosition:
|
|
50
|
-
EnforcedStyle: leading
|
data/.travis.yml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
cache: bundler
|
|
3
|
-
|
|
4
|
-
rvm:
|
|
5
|
-
- 2.4
|
|
6
|
-
- 2.5
|
|
7
|
-
- 2.6
|
|
8
|
-
- ruby-head
|
|
9
|
-
|
|
10
|
-
#before_install:
|
|
11
|
-
# - gem update --system
|
|
12
|
-
# - gem install bundler
|
|
13
|
-
|
|
14
|
-
gemfile:
|
|
15
|
-
- gemfiles/rails_5_0.gemfile
|
|
16
|
-
- gemfiles/rails_5_1.gemfile
|
|
17
|
-
- gemfiles/rails_5_2.gemfile
|
|
18
|
-
- gemfiles/rails_6_0.gemfile
|
|
19
|
-
- gemfiles/rails_master.gemfile
|
|
20
|
-
|
|
21
|
-
matrix:
|
|
22
|
-
fast_finish: true
|
|
23
|
-
# Run Danger only once
|
|
24
|
-
include:
|
|
25
|
-
- rvm: 2.5
|
|
26
|
-
gemfile: gemfiles/rails_5_2.gemfile
|
|
27
|
-
script: bundle exec danger
|
|
28
|
-
exclude:
|
|
29
|
-
- gemfile: gemfiles/rails_6_0.gemfile
|
|
30
|
-
rvm: 2.4
|
|
31
|
-
- gemfile: gemfiles/rails_master.gemfile
|
|
32
|
-
rvm: 2.4
|
|
33
|
-
allow_failures:
|
|
34
|
-
- gemfile: gemfiles/rails_master.gemfile
|
|
35
|
-
- rvm: ruby-head
|