doorkeeper 5.1.2 → 5.2.2
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 +4 -4
- data/Appraisals +1 -1
- data/CHANGELOG.md +854 -0
- data/CONTRIBUTING.md +11 -9
- data/Dangerfile +2 -2
- data/Dockerfile +29 -0
- data/Gemfile +3 -2
- data/NEWS.md +1 -819
- data/README.md +11 -3
- data/RELEASING.md +6 -5
- data/app/controllers/doorkeeper/application_controller.rb +1 -1
- data/app/controllers/doorkeeper/application_metal_controller.rb +2 -1
- data/app/controllers/doorkeeper/applications_controller.rb +5 -3
- data/app/controllers/doorkeeper/authorizations_controller.rb +14 -7
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
- data/app/controllers/doorkeeper/tokens_controller.rb +32 -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 +8 -2
- data/doorkeeper.gemspec +9 -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 +88 -6
- data/lib/doorkeeper/errors.rb +13 -18
- data/lib/doorkeeper/grape/helpers.rb +5 -1
- data/lib/doorkeeper/helpers/controller.rb +23 -4
- data/lib/doorkeeper/models/access_token_mixin.rb +43 -2
- data/lib/doorkeeper/oauth/authorization/code.rb +11 -13
- data/lib/doorkeeper/oauth/authorization/token.rb +1 -1
- data/lib/doorkeeper/oauth/authorization_code_request.rb +18 -9
- data/lib/doorkeeper/oauth/base_request.rb +2 -0
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +14 -0
- data/lib/doorkeeper/oauth/client_credentials/validation.rb +8 -0
- data/lib/doorkeeper/oauth/code_request.rb +5 -11
- 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/invalid_request_response.rb +43 -0
- data/lib/doorkeeper/oauth/nonstandard.rb +39 -0
- data/lib/doorkeeper/oauth/password_access_token_request.rb +7 -2
- data/lib/doorkeeper/oauth/pre_authorization.rb +70 -37
- data/lib/doorkeeper/oauth/refresh_token_request.rb +13 -10
- data/lib/doorkeeper/oauth/token_introspection.rb +23 -13
- data/lib/doorkeeper/oauth/token_request.rb +4 -18
- 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 +15 -69
- data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +61 -0
- data/lib/doorkeeper/orm/active_record.rb +19 -3
- data/lib/doorkeeper/request/authorization_code.rb +2 -0
- data/lib/doorkeeper/request.rb +6 -11
- data/lib/doorkeeper/server.rb +2 -6
- data/lib/doorkeeper/stale_records_cleaner.rb +6 -2
- data/lib/doorkeeper/version.rb +1 -1
- data/lib/doorkeeper.rb +4 -0
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +6 -6
- data/lib/generators/doorkeeper/templates/initializer.rb +110 -33
- data/lib/generators/doorkeeper/templates/migration.rb.erb +4 -1
- data/spec/controllers/applications_controller_spec.rb +93 -0
- data/spec/controllers/authorizations_controller_spec.rb +143 -62
- data/spec/controllers/protected_resources_controller_spec.rb +3 -3
- 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/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +1 -1
- data/spec/lib/config_spec.rb +43 -1
- data/spec/lib/oauth/authorization_code_request_spec.rb +13 -1
- data/spec/lib/oauth/base_request_spec.rb +33 -16
- data/spec/lib/oauth/client_credentials/creator_spec.rb +3 -0
- data/spec/lib/oauth/code_request_spec.rb +27 -28
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +17 -2
- data/spec/lib/oauth/invalid_request_response_spec.rb +75 -0
- data/spec/lib/oauth/pre_authorization_spec.rb +76 -66
- data/spec/lib/oauth/refresh_token_request_spec.rb +1 -0
- data/spec/lib/oauth/token_request_spec.rb +20 -17
- data/spec/lib/server_spec.rb +0 -12
- data/spec/models/doorkeeper/access_grant_spec.rb +21 -2
- data/spec/models/doorkeeper/access_token_spec.rb +35 -4
- data/spec/models/doorkeeper/application_spec.rb +275 -370
- data/spec/requests/endpoints/authorization_spec.rb +21 -5
- data/spec/requests/endpoints/token_spec.rb +1 -1
- data/spec/requests/flows/authorization_code_errors_spec.rb +1 -0
- data/spec/requests/flows/authorization_code_spec.rb +93 -27
- data/spec/requests/flows/client_credentials_spec.rb +38 -0
- data/spec/requests/flows/implicit_grant_errors_spec.rb +22 -10
- data/spec/requests/flows/implicit_grant_spec.rb +9 -8
- data/spec/requests/flows/password_spec.rb +37 -0
- data/spec/requests/flows/refresh_token_spec.rb +1 -1
- data/spec/requests/flows/revoke_token_spec.rb +19 -11
- data/spec/support/doorkeeper_rspec.rb +1 -1
- data/spec/support/helpers/request_spec_helper.rb +14 -2
- data/spec/validators/redirect_uri_validator_spec.rb +40 -15
- metadata +16 -15
- 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
- data/app/validators/redirect_uri_validator.rb +0 -50
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
describe RedirectUriValidator do
|
5
|
+
describe Doorkeeper::RedirectUriValidator do
|
6
6
|
subject do
|
7
7
|
FactoryBot.create(:application)
|
8
8
|
end
|
@@ -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.2
|
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:
|
14
|
+
date: 2019-11-10 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
|
@@ -205,7 +198,6 @@ files:
|
|
205
198
|
- app/controllers/doorkeeper/token_info_controller.rb
|
206
199
|
- app/controllers/doorkeeper/tokens_controller.rb
|
207
200
|
- app/helpers/doorkeeper/dashboard_helper.rb
|
208
|
-
- app/validators/redirect_uri_validator.rb
|
209
201
|
- app/views/doorkeeper/applications/_delete_form.html.erb
|
210
202
|
- app/views/doorkeeper/applications/_form.html.erb
|
211
203
|
- app/views/doorkeeper/applications/edit.html.erb
|
@@ -268,7 +260,9 @@ files:
|
|
268
260
|
- lib/doorkeeper/oauth/helpers/scope_checker.rb
|
269
261
|
- lib/doorkeeper/oauth/helpers/unique_token.rb
|
270
262
|
- lib/doorkeeper/oauth/helpers/uri_checker.rb
|
263
|
+
- lib/doorkeeper/oauth/invalid_request_response.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
|
@@ -281,6 +275,7 @@ files:
|
|
281
275
|
- lib/doorkeeper/orm/active_record/access_grant.rb
|
282
276
|
- lib/doorkeeper/orm/active_record/access_token.rb
|
283
277
|
- lib/doorkeeper/orm/active_record/application.rb
|
278
|
+
- lib/doorkeeper/orm/active_record/redirect_uri_validator.rb
|
284
279
|
- lib/doorkeeper/orm/active_record/stale_records_cleaner.rb
|
285
280
|
- lib/doorkeeper/rails/helpers.rb
|
286
281
|
- lib/doorkeeper/rails/routes.rb
|
@@ -402,6 +397,7 @@ files:
|
|
402
397
|
- spec/lib/oauth/helpers/scope_checker_spec.rb
|
403
398
|
- spec/lib/oauth/helpers/unique_token_spec.rb
|
404
399
|
- spec/lib/oauth/helpers/uri_checker_spec.rb
|
400
|
+
- spec/lib/oauth/invalid_request_response_spec.rb
|
405
401
|
- spec/lib/oauth/invalid_token_response_spec.rb
|
406
402
|
- spec/lib/oauth/password_access_token_request_spec.rb
|
407
403
|
- spec/lib/oauth/pre_authorization_spec.rb
|
@@ -459,7 +455,12 @@ files:
|
|
459
455
|
homepage: https://github.com/doorkeeper-gem/doorkeeper
|
460
456
|
licenses:
|
461
457
|
- MIT
|
462
|
-
metadata:
|
458
|
+
metadata:
|
459
|
+
homepage_uri: https://github.com/doorkeeper-gem/doorkeeper
|
460
|
+
changelog_uri: https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md
|
461
|
+
source_code_uri: https://github.com/doorkeeper-gem/doorkeeper
|
462
|
+
bug_tracker_uri: https://github.com/doorkeeper-gem/doorkeeper/issues
|
463
|
+
documentation_uri: https://doorkeeper.gitbook.io/guides/
|
463
464
|
post_install_message:
|
464
465
|
rdoc_options: []
|
465
466
|
require_paths:
|
@@ -475,8 +476,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
475
476
|
- !ruby/object:Gem::Version
|
476
477
|
version: '0'
|
477
478
|
requirements: []
|
478
|
-
|
479
|
-
rubygems_version: 2.7.9
|
479
|
+
rubygems_version: 3.0.2
|
480
480
|
signing_key:
|
481
481
|
specification_version: 4
|
482
482
|
summary: OAuth 2 provider for Rails and Grape
|
@@ -564,6 +564,7 @@ test_files:
|
|
564
564
|
- spec/lib/oauth/helpers/scope_checker_spec.rb
|
565
565
|
- spec/lib/oauth/helpers/unique_token_spec.rb
|
566
566
|
- spec/lib/oauth/helpers/uri_checker_spec.rb
|
567
|
+
- spec/lib/oauth/invalid_request_response_spec.rb
|
567
568
|
- spec/lib/oauth/invalid_token_response_spec.rb
|
568
569
|
- spec/lib/oauth/password_access_token_request_spec.rb
|
569
570
|
- spec/lib/oauth/pre_authorization_spec.rb
|
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
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "uri"
|
4
|
-
|
5
|
-
class RedirectUriValidator < ActiveModel::EachValidator
|
6
|
-
def self.native_redirect_uri
|
7
|
-
Doorkeeper.configuration.native_redirect_uri
|
8
|
-
end
|
9
|
-
|
10
|
-
def validate_each(record, attribute, value)
|
11
|
-
if value.blank?
|
12
|
-
return if Doorkeeper.configuration.allow_blank_redirect_uri?(record)
|
13
|
-
|
14
|
-
record.errors.add(attribute, :blank)
|
15
|
-
else
|
16
|
-
value.split.each do |val|
|
17
|
-
uri = ::URI.parse(val)
|
18
|
-
next if native_redirect_uri?(uri)
|
19
|
-
|
20
|
-
record.errors.add(attribute, :forbidden_uri) if forbidden_uri?(uri)
|
21
|
-
record.errors.add(attribute, :fragment_present) unless uri.fragment.nil?
|
22
|
-
record.errors.add(attribute, :relative_uri) if uri.scheme.nil? || uri.host.nil?
|
23
|
-
record.errors.add(attribute, :secured_uri) if invalid_ssl_uri?(uri)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
rescue URI::InvalidURIError
|
27
|
-
record.errors.add(attribute, :invalid_uri)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def native_redirect_uri?(uri)
|
33
|
-
self.class.native_redirect_uri.present? && uri.to_s == self.class.native_redirect_uri.to_s
|
34
|
-
end
|
35
|
-
|
36
|
-
def forbidden_uri?(uri)
|
37
|
-
Doorkeeper.configuration.forbid_redirect_uri.call(uri)
|
38
|
-
end
|
39
|
-
|
40
|
-
def invalid_ssl_uri?(uri)
|
41
|
-
forces_ssl = Doorkeeper.configuration.force_ssl_in_redirect_uri
|
42
|
-
non_https = uri.try(:scheme) == "http"
|
43
|
-
|
44
|
-
if forces_ssl.respond_to?(:call)
|
45
|
-
forces_ssl.call(uri) && non_https
|
46
|
-
else
|
47
|
-
forces_ssl && non_https
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|