diff options
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 6eea56ea117..fbe30aad120 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -94,6 +94,12 @@ module API Gitlab::AppLogger.info({ message: "File exceeds maximum size", file_bytes: file.size, project_id: user_project.id, project_path: user_project.full_path, upload_allowed: allowed }) end end + + def validate_projects_api_rate_limit_for_unauthenticated_users! + return unless Feature.enabled?(:rate_limit_for_unauthenticated_projects_api_access) + + check_rate_limit!(:projects_api_rate_limit_unauthenticated, scope: [ip_address]) if current_user.blank? + end end helpers do @@ -266,6 +272,8 @@ module API end # TODO: Set higher urgency https://gitlab.com/gitlab-org/gitlab/-/issues/211495 get feature_category: :projects, urgency: :low do + validate_projects_api_rate_limit_for_unauthenticated_users! + present_projects load_projects end |