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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-03 12:59:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-03 12:59:43 +0300
commit6aefeb24873b0957456ae0deacbb431fc79a6a28 (patch)
treea803343e837f64c2d214a01098fa989097e203cb /lib
parent9d9ee598bc514eaee681b40cdff4d12a3a8f412a (diff)
Add latest changes from gitlab-org/security/gitlab@14-5-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities/project.rb4
-rw-r--r--lib/gitlab/regex.rb2
-rw-r--r--lib/gitlab/slash_commands/deploy.rb12
3 files changed, 15 insertions, 3 deletions
diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb
index e3f1e90b80f..662ca59852e 100644
--- a/lib/api/entities/project.rb
+++ b/lib/api/entities/project.rb
@@ -55,7 +55,9 @@ module API
expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:current_user]) }
expose(:container_registry_enabled) { |project, options| project.feature_available?(:container_registry, options[:current_user]) }
expose :service_desk_enabled
- expose :service_desk_address
+ expose :service_desk_address, if: -> (project, options) do
+ Ability.allowed?(options[:current_user], :admin_issue, project)
+ end
expose(:can_create_merge_request_in) do |project, options|
Ability.allowed?(options[:current_user], :create_merge_request_in, project)
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 8b2f786a91a..904fc744c6b 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -57,7 +57,7 @@ module Gitlab
end
def maven_version_regex
- @maven_version_regex ||= /\A(\.?[\w\+-]+\.?)+\z/.freeze
+ @maven_version_regex ||= /\A(?!.*\.\.)[\w+.-]+\z/.freeze
end
def maven_app_group_regex
diff --git a/lib/gitlab/slash_commands/deploy.rb b/lib/gitlab/slash_commands/deploy.rb
index 157d924f99f..9fcefd99f81 100644
--- a/lib/gitlab/slash_commands/deploy.rb
+++ b/lib/gitlab/slash_commands/deploy.rb
@@ -3,8 +3,18 @@
module Gitlab
module SlashCommands
class Deploy < BaseCommand
+ DEPLOY_REGEX = /\Adeploy\s/.freeze
+
def self.match(text)
- /\Adeploy\s+(?<from>\S+.*)\s+to+\s+(?<to>\S+.*)\z/.match(text)
+ return unless text&.match?(DEPLOY_REGEX)
+
+ from, _, to = text.sub(DEPLOY_REGEX, '').rpartition(/\sto+\s/)
+ return if from.blank? || to.blank?
+
+ {
+ from: from.strip,
+ to: to.strip
+ }
end
def self.help_message