diff --git a/Gemfile b/Gemfile index c1443a193b7325064e78e619a0981a3f1d748938..ecb3b77fa1d10038b708b7026fba2d89621fc1f2 100644 --- a/Gemfile +++ b/Gemfile @@ -25,8 +25,8 @@ gem 'marginalia', '~> 1.10.0' gem 'devise', '~> 4.7.2' # TODO: verify ARM compile issue on 3.1.13+ version (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/18828) gem 'bcrypt', '3.1.12' -gem 'doorkeeper', '~> 5.4.0' -gem 'doorkeeper-openid_connect', '~> 1.7.4' +gem 'doorkeeper', '~> 5.5.0.rc2' +gem 'doorkeeper-openid_connect', '~> 1.7.5' gem 'omniauth', '~> 1.8' gem 'omniauth-auth0', '~> 2.0.0' gem 'omniauth-azure-oauth2', '~> 0.0.9' diff --git a/Gemfile.lock b/Gemfile.lock index 59eb34212663afdfbcee76e1ea9295c2e9070f99..5e52a732906fe59541b866f42d193a2f2bf21b6b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -262,9 +262,9 @@ GEM docile (1.3.2) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.4.0) + doorkeeper (5.5.0.rc2) railties (>= 5) - doorkeeper-openid_connect (1.7.4) + doorkeeper-openid_connect (1.7.5) doorkeeper (>= 5.2, < 5.5) json-jwt (>= 1.11.0) dry-configurable (0.12.0) @@ -1329,8 +1329,8 @@ DEPENDENCIES diff_match_patch (~> 0.1.0) diffy (~> 3.3) discordrb-webhooks-blackst0ne (~> 3.3) - doorkeeper (~> 5.4.0) - doorkeeper-openid_connect (~> 1.7.4) + doorkeeper (~> 5.5.0.rc2) + doorkeeper-openid_connect (~> 1.7.5) ed25519 (~> 1.2) elasticsearch-api (~> 6.8.2) elasticsearch-model (~> 6.1) diff --git a/changelogs/unreleased/id-update-doorkeeper-gem.yml b/changelogs/unreleased/id-update-doorkeeper-gem.yml new file mode 100644 index 0000000000000000000000000000000000000000..a6504b7dcf5fa9d7b7cb2c0e4e38f66791aa68c6 --- /dev/null +++ b/changelogs/unreleased/id-update-doorkeeper-gem.yml @@ -0,0 +1,5 @@ +--- +title: Update doorkeeper to 5.5.0.rc2 +merge_request: 52171 +author: +type: other diff --git a/lib/api/applications.rb b/lib/api/applications.rb index 8b14e16b495412422cecb1cf2849cfe4e144abff..b883f83cc194410f5f3df86e78ab71270782be43 100644 --- a/lib/api/applications.rb +++ b/lib/api/applications.rb @@ -8,15 +8,6 @@ class Applications < ::API::Base feature_category :authentication_and_authorization resource :applications do - helpers do - def validate_redirect_uri(value) - uri = ::URI.parse(value) - !uri.is_a?(URI::HTTP) || uri.host - rescue URI::InvalidURIError - false - end - end - desc 'Create a new application' do detail 'This feature was introduced in GitLab 10.5' success Entities::ApplicationWithSecret @@ -30,13 +21,6 @@ def validate_redirect_uri(value) desc: 'Application will be used where the client secret is confidential' end post do - # Validate that host in uri is specified - # Please remove it when https://github.com/doorkeeper-gem/doorkeeper/pull/1440 is merged - # and the doorkeeper gem version is bumped - unless validate_redirect_uri(declared_params[:redirect_uri]) - render_api_error!({ redirect_uri: ["must be an absolute URI."] }, :bad_request) - end - application = Doorkeeper::Application.new(declared_params) if application.save diff --git a/spec/requests/api/applications_spec.rb b/spec/requests/api/applications_spec.rb index 63fbf6e32dd353af7874175519fd9e7eb1b103fe..ca09f5524ca8b630d6f57114f6b2651942994b4d 100644 --- a/spec/requests/api/applications_spec.rb +++ b/spec/requests/api/applications_spec.rb @@ -31,7 +31,7 @@ expect(response).to have_gitlab_http_status(:bad_request) expect(json_response).to be_a Hash - expect(json_response['message']['redirect_uri'][0]).to eq('must be an absolute URI.') + expect(json_response['message']['redirect_uri'][0]).to eq('must be a valid URI.') end it 'does not allow creating an application with a forbidden URI format' do diff --git a/spec/requests/api/oauth_tokens_spec.rb b/spec/requests/api/oauth_tokens_spec.rb index 23d5df873d411f968869ec9aa2ce722925d4dd11..52c7408545f123556ed3c743673413e2f3ce9c9b 100644 --- a/spec/requests/api/oauth_tokens_spec.rb +++ b/spec/requests/api/oauth_tokens_spec.rb @@ -26,17 +26,14 @@ def request_oauth_token(user, headers = {}) end context 'when user does not have 2FA enabled' do - # NOTE: using ROPS grant flow without client credentials will be deprecated - # and removed in the next version of Doorkeeper. - # See https://gitlab.com/gitlab-org/gitlab/-/issues/219137 context 'when no client credentials provided' do - it 'creates an access token' do + it 'does not create an access token' do user = create(:user) request_oauth_token(user) - expect(response).to have_gitlab_http_status(:ok) - expect(json_response['access_token']).not_to be_nil + expect(response).to have_gitlab_http_status(:unauthorized) + expect(json_response['access_token']).to be_nil end end @@ -54,15 +51,11 @@ def request_oauth_token(user, headers = {}) context 'with invalid credentials' do it 'does not create an access token' do - # NOTE: remove this after update to Doorkeeper 5.5 or newer, see - # https://gitlab.com/gitlab-org/gitlab/-/issues/219137 - pending 'Enable this example after upgrading Doorkeeper to 5.5 or newer' - user = create(:user) request_oauth_token(user, basic_auth_header(client.uid, 'invalid secret')) - expect(response).to have_gitlab_http_status(:bad_request) + expect(response).to have_gitlab_http_status(:unauthorized) expect(json_response['error']).to eq('invalid_client') end end