summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-30 16:57:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-30 16:57:06 +0000
commitb4cf4027c64afc4f009452a9bfade231e2ff421a (patch)
treecfa307b5d1583471285709032f559ab2ac4be1d5 /lib
parent0cb369aa5f70b59e5922d8f5431a3302fd93574e (diff)
downloadgitlab-ce-b4cf4027c64afc4f009452a9bfade231e2ff421a.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-5-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/api/ci/pipeline_schedules.rb2
-rw-r--r--lib/api/entities/ci/pipeline_schedule_details.rb4
-rw-r--r--lib/gitlab/regex.rb4
3 files changed, 8 insertions, 2 deletions
diff --git a/lib/api/ci/pipeline_schedules.rb b/lib/api/ci/pipeline_schedules.rb
index 18caf85f109..b669acf668c 100644
--- a/lib/api/ci/pipeline_schedules.rb
+++ b/lib/api/ci/pipeline_schedules.rb
@@ -36,7 +36,7 @@ module API
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
end
get ':id/pipeline_schedules/:pipeline_schedule_id' do
- present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails
+ present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails, user: current_user
end
desc 'Create a new pipeline schedule' do
diff --git a/lib/api/entities/ci/pipeline_schedule_details.rb b/lib/api/entities/ci/pipeline_schedule_details.rb
index b233728b95b..d661a8940ea 100644
--- a/lib/api/entities/ci/pipeline_schedule_details.rb
+++ b/lib/api/entities/ci/pipeline_schedule_details.rb
@@ -5,7 +5,9 @@ module API
module Ci
class PipelineScheduleDetails < PipelineSchedule
expose :last_pipeline, using: ::API::Entities::Ci::PipelineBasic
- expose :variables, using: ::API::Entities::Ci::Variable
+ expose :variables,
+ using: ::API::Entities::Ci::Variable,
+ if: ->(schedule, options) { Ability.allowed?(options[:user], :read_pipeline_schedule_variables, schedule) }
end
end
end
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 8dae77f68f3..1b169b6186b 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -46,6 +46,10 @@ module Gitlab
maven_app_name_regex
end
+ def nuget_package_name_regex
+ @nuget_package_name_regex ||= %r{\A[-+\.\_a-zA-Z0-9]+\z}.freeze
+ end
+
def nuget_version_regex
@nuget_version_regex ||= /
\A#{_semver_major_minor_patch_regex}(\.\d*)?#{_semver_prerelease_build_regex}\z