Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-05 21:10:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-05 21:10:10 +0300
commitea4766228b5536c83f1917d6058be913472ffa2d (patch)
tree5ebf5ea0f996be6c6908e6b631b72c33bc13e997 /lib/gitlab
parent4b64dc27ae5bac20dec888431c236fef2bfdc449 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/base_doorkeeper_controller.rb2
-rw-r--r--lib/gitlab/checks/branch_check.rb12
-rw-r--r--lib/gitlab/markdown_cache.rb2
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/gitlab/base_doorkeeper_controller.rb b/lib/gitlab/base_doorkeeper_controller.rb
index b78993aba30..0f370850b5b 100644
--- a/lib/gitlab/base_doorkeeper_controller.rb
+++ b/lib/gitlab/base_doorkeeper_controller.rb
@@ -5,6 +5,8 @@
module Gitlab
class BaseDoorkeeperController < ActionController::Base
include Gitlab::Allowable
+ include EnforcesTwoFactorAuthentication
+
helper_method :can?
end
end
diff --git a/lib/gitlab/checks/branch_check.rb b/lib/gitlab/checks/branch_check.rb
index 7be0ef05a49..ad2a718ef67 100644
--- a/lib/gitlab/checks/branch_check.rb
+++ b/lib/gitlab/checks/branch_check.rb
@@ -12,7 +12,8 @@ module Gitlab
push_protected_branch: 'You are not allowed to push code to protected branches on this project.',
create_protected_branch: 'You are not allowed to create protected branches on this project.',
invalid_commit_create_protected_branch: 'You can only use an existing protected branch ref as the basis of a new protected branch.',
- non_web_create_protected_branch: 'You can only create protected branches using the web interface and API.'
+ non_web_create_protected_branch: 'You can only create protected branches using the web interface and API.',
+ prohibited_hex_branch_name: 'You cannot create a branch with a 40-character hexadecimal branch name.'
}.freeze
LOG_MESSAGES = {
@@ -32,11 +33,20 @@ module Gitlab
end
end
+ prohibited_branch_checks
protected_branch_checks
end
private
+ def prohibited_branch_checks
+ return unless Feature.enabled?(:prohibit_hexadecimal_branch_names, project, default_enabled: true)
+
+ if branch_name =~ /\A\h{40}\z/
+ raise GitAccess::ForbiddenError, ERROR_MESSAGES[:prohibited_hex_branch_name]
+ end
+ end
+
def protected_branch_checks
logger.log_timed(LOG_MESSAGES[:protected_branch_checks]) do
return unless ProtectedBranch.protected?(project, branch_name) # rubocop:disable Cop/AvoidReturnFromBlocks
diff --git a/lib/gitlab/markdown_cache.rb b/lib/gitlab/markdown_cache.rb
index 21797bf988d..ac3492dbe33 100644
--- a/lib/gitlab/markdown_cache.rb
+++ b/lib/gitlab/markdown_cache.rb
@@ -3,7 +3,7 @@
module Gitlab
module MarkdownCache
# Increment this number every time the renderer changes its output
- CACHE_COMMONMARK_VERSION = 23
+ CACHE_COMMONMARK_VERSION = 24
CACHE_COMMONMARK_VERSION_START = 10
BaseError = Class.new(StandardError)