Skip to content
Snippets Groups Projects

Add DPoP checks in GraphQL and API requests

Merged Ameya Darshan requested to merge ameya-dpop-2 into master
Compare and
9 files
+ 848
1
Compare changes
  • Side-by-side
  • Inline
Files
9
@@ -33,6 +33,8 @@ class GraphqlController < ApplicationController
before_action(only: [:execute]) { authenticate_sessionless_user!(:graphql_api) }
before_action :authorize_access_api!
# must come after authorize_access_api! to check for nil current_user
before_action(only: [:execute]) { :check_dpop! }
before_action :set_user_last_activity
before_action :track_vs_code_usage
before_action :track_jetbrains_usage
@@ -82,6 +84,12 @@ def execute
end
end
rescue_from Gitlab::Auth::DpopValidationError do |exception|
log_exception(exception)
render_error(exception.message, status: :unauthorized)
end
rescue_from Gitlab::Auth::TooManyIps do |exception|
log_exception(exception)
@@ -117,6 +125,11 @@ def feature_category
private
def check_dpop!
::Auth::DpopAuthenticationService.new(current_user, Gitlab::Auth::AuthFinders.get_personal_access_token,
request).execute
end
def permitted_params
@permitted_params ||= multiplex? ? permitted_multiplex_params : permitted_standalone_query_params
end
Loading